Tracing

The DLC utilizes the APM (ActivePivot’s Application Performance Monitoring library) to handle tracing of events. The library relies on openzipkin/brave for the tracing. All events will be traced with a TraceId and SpanId which are unique Hex Strings such as “7a8c982a87b050f2”

Required Configurations

The required configurations for Tracing can be found in the Required Required APM Configurations

TraceContext

A TraceContext will be added to HealthEvents. This TraceContext object has a TraceId and SpandId property. The TraceContext is added to HealthEvents through the APMHealthEventDispatcher. TraceContext’s can be null if the APM Tracing has not properly been configured as stated above. When a DLC process is started a Tracer will be created. All processes started from within the DLC process will be traced with the same traceId. A TraceContext contains three values:

TraceContext Property Value
TraceId Globally unique ID. All tracers created under the parent tracer will contain the same TraceId.
ParentId Parent tracer’s SpanId. This is the SpanId of the parent tracer.
SpanId Globally unique ID of the current process. Every time a new tracer is created (even under a parent) this value will be unique.

Below we can see an example of how the TraceContext is used and tracked through child processes.

Example:

Here we can see the TraceContext in action. In the below image we have two DLC operations to execute in the DLC. Each DLC Operation will be given its own TaskTracer to trace all proceses. Every time a new sub-process is created a child tracer will be created under the current tracer. Here we can see how all tracers for a DLC operation have the same Trace ID. This is because all child tracers created from an existing tracer share the Trace ID. We can also see that all child tracers have a unique Span ID. The Span ID for the first tracer is the same as the Trace ID - this is because this is the root tracer. Additionally all Span ID’s are used as child TraceContext’s Parent ID. With this information we can trace back an event to its parent and vice versa. TraceContextDiagram