File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
sdk-usage/src/main/java/io/opentelemetry/sdk/example Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,12 @@ dependencies {
1212 compile " io.grpc:grpc-protobuf:${ grpcVersion} "
1313 compile " io.grpc:grpc-stub:${ grpcVersion} "
1414 compile " io.grpc:grpc-netty-shaded:${ grpcVersion} "
15+
16+ if (JavaVersion . current(). isJava9Compatible()) {
17+ // Workaround for @javax.annotation.Generated
18+ // see: https://github.com/grpc/grpc-java/issues/3633
19+ compileOnly " javax.annotation:javax.annotation-api:1.3.2"
20+ }
1521}
1622
1723protobuf {
Original file line number Diff line number Diff line change 2626import io .opentelemetry .sdk .trace .export .SimpleSpanProcessor ;
2727import io .opentelemetry .trace .Link ;
2828import io .opentelemetry .trace .Span ;
29+ import io .opentelemetry .trace .Span .Kind ;
2930import io .opentelemetry .trace .SpanContext ;
3031import io .opentelemetry .trace .TraceId ;
3132import io .opentelemetry .trace .Tracer ;
@@ -109,15 +110,16 @@ public static void main(String[] args) {
109110 class MySampler implements Sampler {
110111
111112 @ Override
112- public Decision shouldSample (
113+ public SamplingResult shouldSample (
113114 SpanContext parentContext ,
114115 TraceId traceId ,
115116 String name ,
116- Span . Kind spanKind ,
117+ Kind spanKind ,
117118 ReadableAttributes attributes ,
118119 List <Link > parentLinks ) {
119120 // We sample only if the Span name contains "SAMPLE"
120- return Samplers .emptyDecision (name .contains ("SAMPLE" ));
121+ return Samplers .emptySamplingResult (
122+ name .contains ("SAMPLE" ) ? Decision .RECORD_AND_SAMPLED : Decision .NOT_RECORD );
121123 }
122124
123125 @ Override
You can’t perform that action at this time.
0 commit comments