rajeshkumarchandolu commented on code in PR #12145:
URL: https://github.com/apache/ozone/pull/12145#discussion_r4704671794
##########
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:
Understood. In this PR ozone.error.status mirrors what the protocol itself
reports: it is added where the response carries a status code (block, security
and secret key protocols). Where a protocol throws instead (e.g. the container
location protocol), the failure is recorded on the span as an error with the
exception type and message, so error=true finds it, but no status code is
reported back to the caller, so the attribute is not added. The tracing code
does not derive codes of its own.
If those protocols report a status code in their responses later, the same
attribute can be added there with one line, so no redesign of the tracing is
needed. I'd prefer to keep this PR limited to what the protocols expose today.
--
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]