rich7420 commented on code in PR #12039:
URL: https://github.com/apache/ozone/pull/12039#discussion_r4758737855


##########
hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/tracing/TestSpanCollector.java:
##########
@@ -53,14 +53,19 @@ private TestSpanCollector() {
 
   /** Registers a collecting SDK as the global OpenTelemetry and initializes 
Ozone tracing with it. */
   public static TestSpanCollector install(String serviceName) {
+    OzoneConfiguration conf = new OzoneConfiguration();
+    conf.setBoolean("ozone.tracing.enabled", true);
+    return install(serviceName, conf);
+  }
+
+  /** Same as {@link #install(String)} with an explicit configuration (e.g. 
internal tracing keys). */
+  public static TestSpanCollector install(String serviceName, 
OzoneConfiguration conf) {
     TracingUtil.shutdownTracing();
     GlobalOpenTelemetry.resetForTest();
     TestSpanCollector collector = new TestSpanCollector();
     GlobalOpenTelemetry.set(OpenTelemetrySdk.builder()
         
.setTracerProvider(SdkTracerProvider.builder().addSpanProcessor(collector).build())

Review Comment:
   All 34 tests still pass with both `isSampled()` checks removed. Can we test 
with the production sampler?



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java:
##########
@@ -452,7 +455,8 @@ private boolean submitPurgeRequest(boolean purgeSuccess, 
PurgeKeysRequest.Builde
 
     OzoneManagerProtocolProtos.OMRequest omRequest =
         
OzoneManagerProtocolProtos.OMRequest.newBuilder().setCmdType(OzoneManagerProtocolProtos.Type.PurgeKeys)
-            
.setPurgeKeysRequest(requestBuilder.build()).setClientId(getClientId().toString()).build();
+            
.setPurgeKeysRequest(requestBuilder.build()).setClientId(getClientId().toString())
+            .setTraceID(TracingUtil.exportCurrentSpan()).build();

Review Comment:
   `submitSetSnapshotRequests` still sends no trace ID, and its DB span is a 
new root. Same fix there?



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java:
##########
@@ -366,6 +383,10 @@ public static Span importAndCreateSpan(String name, String 
encodedParent,
 
     W3CTraceContextPropagator propagator = 
W3CTraceContextPropagator.getInstance();
     Context extract = propagator.extract(Context.current(), encodedParent, 
TextExtractor.INSTANCE);
+    SpanContext remote = Span.fromContext(extract).getSpanContext();
+    if (remote.isValid() && !remote.isSampled()) {

Review Comment:
   This also drops server spans for clients sending a valid unsampled 
`traceparent`, not only internal work. Intended?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to