Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ class ComposableRuleBasedSamplerTest {
private static final class AttributePredicate<T> implements SamplingPredicate {

private final AttributeKey<T> key;
private final T value;
private final String description;

private AttributePredicate(AttributeKey<T> key, T value) {
this.key = key;
this.value = value;
this.description = key.getKey() + "=" + value;
}

Expand All @@ -46,7 +48,7 @@ public boolean matches(
SpanKind spanKind,
Attributes attributes,
List<LinkData> parentLinks) {
return "/health".equals(attributes.get(key));
return value.equals(attributes.get(key));
}

@Override
Expand Down Expand Up @@ -116,7 +118,7 @@ void rules() {
Sampler sampler =
CompositeSampler.wrap(
ComposableSampler.ruleBasedBuilder()
.add(new AttributePredicate<>(HTTP_ROUTE, "/health"), ComposableSampler.alwaysOff())
.add(new AttributePredicate<>(HTTP_ROUTE, "/check"), ComposableSampler.alwaysOff())
.add(IsRootPredicate.INSTANCE, ComposableSampler.alwaysOn())
.build());

Expand All @@ -128,7 +130,7 @@ void rules() {
TraceId.fromLongs(1, 2),
SpanId.fromLong(3),
SpanKind.SERVER,
Attributes.of(HTTP_ROUTE, "/health"),
Attributes.of(HTTP_ROUTE, "/check"),
Collections.emptyList())
.getDecision())
.isEqualTo(SamplingDecision.DROP);
Expand Down
Loading