Skip to content

Commit 53b54cc

Browse files
authored
fix minor inconsistency in sampler test (#7932)
1 parent 23799f2 commit 53b54cc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/trace/samplers/ComposableRuleBasedSamplerTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ class ComposableRuleBasedSamplerTest {
3131
private static final class AttributePredicate<T> implements SamplingPredicate {
3232

3333
private final AttributeKey<T> key;
34+
private final T value;
3435
private final String description;
3536

3637
private AttributePredicate(AttributeKey<T> key, T value) {
3738
this.key = key;
39+
this.value = value;
3840
this.description = key.getKey() + "=" + value;
3941
}
4042

@@ -46,7 +48,7 @@ public boolean matches(
4648
SpanKind spanKind,
4749
Attributes attributes,
4850
List<LinkData> parentLinks) {
49-
return "/health".equals(attributes.get(key));
51+
return value.equals(attributes.get(key));
5052
}
5153

5254
@Override
@@ -116,7 +118,7 @@ void rules() {
116118
Sampler sampler =
117119
CompositeSampler.wrap(
118120
ComposableSampler.ruleBasedBuilder()
119-
.add(new AttributePredicate<>(HTTP_ROUTE, "/health"), ComposableSampler.alwaysOff())
121+
.add(new AttributePredicate<>(HTTP_ROUTE, "/check"), ComposableSampler.alwaysOff())
120122
.add(IsRootPredicate.INSTANCE, ComposableSampler.alwaysOn())
121123
.build());
122124

@@ -128,7 +130,7 @@ void rules() {
128130
TraceId.fromLongs(1, 2),
129131
SpanId.fromLong(3),
130132
SpanKind.SERVER,
131-
Attributes.of(HTTP_ROUTE, "/health"),
133+
Attributes.of(HTTP_ROUTE, "/check"),
132134
Collections.emptyList())
133135
.getDecision())
134136
.isEqualTo(SamplingDecision.DROP);

0 commit comments

Comments
 (0)