Add span kind to sampling overrides#1960
Conversation
This reverts commit cf5b048.
|
|
||
| public enum SpanKind { | ||
| @JsonProperty("server") | ||
| SERVER(io.opentelemetry.api.trace.SpanKind.SERVER), |
There was a problem hiding this comment.
is io.opentelemetry.api.trace.SpanKind an enum? can we reuse it rather than create a new one? if their spankind is updated, we shouldn't need to update ours.
There was a problem hiding this comment.
our convention is for json enum values to be lowercase, and we can't add @JsonProperty to those classes since they are not under our control. I will add a TODO marker here to investigate other options for mapping external annotations to lowercase.
|
|
||
| public static class SamplingOverride { | ||
| // TODO (trask) consider making this required when moving out of preview | ||
| @Nullable public SpanKind spanKind; |
There was a problem hiding this comment.
declare it as io.opentelemetry.api.trace.SpanKind?
| void shouldFilterStrictMatchWithNullSpanKind() { | ||
| // given | ||
| List<SamplingOverride> overrides = | ||
| singletonList(newOverride(null, 0, newStrictAttribute("one", "1"))); |
There was a problem hiding this comment.
when it's null, it will match any span kind?
|
|
||
| // expect | ||
| assertThat(sampler.getOverride(attributes).getPercentage()).isEqualTo(0); | ||
| assertThat(sampler.getOverride(SpanKind.SERVER, attributes).getPercentage()).isEqualTo(0); |
There was a problem hiding this comment.
assertThat(sampler.getOverride(SpanKind.CLIENT, attributes).getPercentage))).isEqualTo(0); should work too?
it's currently hard to suppress all outgoing http client spans, since those have essentially the same attributes as incoming http server spans.
attaching snapshot for testing: applicationinsights-agent-3.2.4-BETA-SNAPSHOT.jar.zip