Class EnvVarBraveTracePropagatorImpl
java.lang.Object
com.netflix.genie.common.internal.tracing.brave.impl.EnvVarBraveTracePropagatorImpl
- All Implemented Interfaces:
BraveTracePropagator
,TracePropagator<brave.propagation.TraceContext>
Implementation of
TracePropagator
based on Brave and
B3 Propagation. This particular implementation leverages
environment variables to pass context between processes.
Note: This current implementation kind of breaks the contract as we don't propagate all the expected headers.
- Since:
- 4.0.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionOptional<brave.propagation.TraceContext>
Extract the trace context from the supplied set of key value pairs.injectForAgent
(brave.propagation.TraceContext traceContext) Inject the trace context from U into the returned set of key value pairs for propagation to Agent.injectForJob
(brave.propagation.TraceContext traceContext) Inject the trace context from U into the returned set of key value pairs for propagation to job.
-
Constructor Details
-
EnvVarBraveTracePropagatorImpl
public EnvVarBraveTracePropagatorImpl()
-
-
Method Details
-
extract
Extract the trace context from the supplied set of key value pairs.Implementations should swallow all exceptions as tracing is not critical to the completion of a job on behalf of the user.
- Specified by:
extract
in interfaceTracePropagator<brave.propagation.TraceContext>
- Parameters:
environment
- Generally this will be the result ofSystem.getenv()
- Returns:
- A new instance of
TracePropagator
containing the extracted context orOptional.empty()
if no context information was found
-
injectForAgent
Inject the trace context from U into the returned set of key value pairs for propagation to Agent.Implementations should swallow all exceptions as tracing is not critical to the completion of a job on behalf of the user.
- Specified by:
injectForAgent
in interfaceTracePropagator<brave.propagation.TraceContext>
- Parameters:
traceContext
- The context for the active unit of work (span in Brave parlance)- Returns:
- A set of key value pairs that should be propagated to the agent in some manner to be extracted in
TracePropagator.extract(Map)
-
injectForJob
Inject the trace context from U into the returned set of key value pairs for propagation to job.Implementations should swallow all exceptions as tracing is not critical to the completion of a job on behalf of the user.
- Specified by:
injectForJob
in interfaceTracePropagator<brave.propagation.TraceContext>
- Parameters:
traceContext
- The context for the active unit of work (span in Brave parlance)- Returns:
- A set of key value pairs that should be propagated to the job in some manner which can be extracted by downstream systems if they so desire
-