[ 
https://issues.apache.org/jira/browse/HDDS-17581?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

rajesh updated HDDS-17581:
--------------------------
    Summary: Add TracingUtil span helpers and span-kind aware tracing proxies  
(was: Tracing common span helpers)

> Add TracingUtil span helpers and span-kind aware tracing proxies
> ----------------------------------------------------------------
>
>                 Key: HDDS-17581
>                 URL: https://issues.apache.org/jira/browse/HDDS-17581
>             Project: Apache Ozone
>          Issue Type: Sub-task
>            Reporter: Sravani Revuri
>            Assignee: rajesh
>            Priority: Major
>
> h3. Why
> This is the first, common-only step of adding OpenTelemetry tracing to OM 
> (and later SCM and datanodes). Upcoming PRs will:
>  * create OM components as tracing proxies through their interfaces, such as 
> the request handler, client requests, the key, volume and bucket managers, 
> and the authorizer;
>  * add attributes, events and error status from inside request handling.
> For that we need a few things that {{hdds-common}} doesn't have yet:
>  * proxies that work at startup;
>  * proxies whose span kind matches what the delegate does: INTERNAL for 
> in-process components, CLIENT for RPC clients;
>  * exceptions recorded in a standard way;
>  * small null-safe helpers for the current span;
>  * a test helper to assert on collected spans.
> This PR adds only these building blocks. It doesn't add new spans to any 
> service.
> h3. What
> *Span helpers in {{{}TracingUtil{}}}:*
>  * {{createSpan(name)}} and {{createSpan(name, SpanKind)}} create a span that 
> is a child of the current span.
>  * {{recordException(span, t)}} and {{recordExceptionInCurrentSpan(t)}} 
> record the exception event and set the ERROR status, using the exception 
> message as the description.
>  * {{addAttributesToCurrentSpan(key, String|long|boolean)}} and 
> {{addEventToCurrentSpan(name, key, value)}} do nothing when there is no 
> recording span, and skip null values.
>  * New {{SpanAttributeKeys}} holds the shared attribute keys, starting with 
> {{{}ozone.status{}}}.
> *Tracing proxies:*
>  * {{TraceAllMethod}} takes a {{{}SpanKind{}}}. {{@InternalSpanKind}} can now 
> go on a whole delegate class as well as on a method.
>  * Exceptions thrown by the delegate are recorded on the proxy span. Methods 
> missing from the delegate, and {{@SkipTracing}} methods, are called directly 
> instead of throwing {{{}NoSuchMethodException{}}}.
>  * {{createProxy(delegate, itf, conf)}} now creates INTERNAL spans. The new 
> {{createClientProxy(delegate, itf, conf)}} creates CLIENT spans. The existing 
> RPC client proxies switch to {{{}createClientProxy{}}}, so their span kind 
> stays CLIENT:
>  ** the SCM block, container location, security and secret key clients, in 
> {{HAUtils}} and {{{}HddsServerUtil{}}};
>  ** the OM client in {{{}RpcClient{}}}.
>  * New {{createProxy(delegate, itf, spanPrefix, spanKind)}} names spans 
> {{{}<spanPrefix>.<method>{}}}, for example {{{}KeyManagerImpl.listStatus{}}}. 
> It doesn't need a current span, so it can wrap objects created at service 
> startup when application-aware tracing is on.
> *Error recording on existing spans:*
>  * {{executeInSpan}} and {{OzoneProtocolMessageDispatcher#processRequest}} 
> now use {{{}recordException{}}}. Failed spans carry the exception event and 
> the error message, not only the ERROR status.
> *Tests:*
>  * New {{TestSpanCollector}} installs an in-memory span processor and has 
> assertion helpers.
>  * New tests in {{{}TestTracingUtil{}}}, {{{}TestTraceAllMethod{}}}, 
> {{{}TestTracingAnnotations{}}}, {{TestTracingInitModes}} and 
> {{{}TestOzoneProtocolMessageDispatcher{}}}.
>  * The test tracer providers get a span processor. With OpenTelemetry 1.67, 
> an {{SdkTracerProvider}} without a processor returns no-op spans.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to