rajeshkumarchandolu commented on code in PR #12145:
URL: https://github.com/apache/ozone/pull/12145#discussion_r4695109026


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/ha/TestSCMRatisServerImpl.java:
##########
@@ -232,6 +243,82 @@ public void testGetRatisRolesKeepsHostname() throws 
Exception {
     }
   }
 
+  @Test
+  public void testSubmitRequestIsTracedUnderTheCurrentSpan() throws Exception {
+    ArgumentCaptor<RaftClientRequest> submitted = 
ArgumentCaptor.forClass(RaftClientRequest.class);
+    SCMRatisServerImpl scmRatisServer = newScmRatisServer(submitted, null);
+    SCMRatisRequest request = SCMRatisRequest.of(RequestType.PIPELINE, "op", 
new Class<?>[0]);
+
+    try (TestSpanCollector collector = TestSpanCollector.install("scm")) {
+      TracingUtil.executeInNewSpan("request", () -> 
scmRatisServer.submitRequest(request));
+
+      collector.assertParent("SCMRatisServerImpl.submit.op", "request");
+      // The request is encoded inside the span, so the apply span on each SCM 
continues from it.
+      String traceID = 
SCMRatisRequest.decode(submitted.getValue().getMessage()).getTraceID();
+      TracingUtil.executeAsChildSpan("apply", traceID, () -> { });
+      collector.assertParent("apply", "SCMRatisServerImpl.submit.op");
+    }
+  }
+

Review Comment:
   Thanks. Every failure path in SCM covered by this PR marks the span as an 
error and records the exception — whether the exception is thrown (recorded by 
the dispatcher) or swallowed and returned in the response (block, security and 
secret key protocols, deleteKeyBlocks, and a rejected Ratis submit like the one 
in this test). So to find failed requests, operators can search with the tag 
error=true, which returns every trace with an error regardless of how SCM 
reported it.
   
   Where the response itself carries a protocol status code (block, security 
and secret key protocols), it is also added as ozone.error.status — renamed 
from ozone.status in <commit> to make clear it is only set on failures — so 
those can be filtered by a specific code, e.g. 
ozone.error.status=FAILED_TO_FIND_SUITABLE_NODE. For the others, the error and 
the exception type and message are on the span.



-- 
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