Class EnvVarBraveTracePropagatorImpl
- java.lang.Object
-
- com.netflix.genie.common.internal.tracing.brave.impl.EnvVarBraveTracePropagatorImpl
-
- All Implemented Interfaces:
BraveTracePropagator,TracePropagator<brave.propagation.TraceContext>
public class EnvVarBraveTracePropagatorImpl extends java.lang.Object implements BraveTracePropagator
Implementation ofTracePropagatorbased 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
Constructors Constructor Description EnvVarBraveTracePropagatorImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<brave.propagation.TraceContext>extract(java.util.Map<java.lang.String,java.lang.String> environment)Extract the trace context from the supplied set of key value pairs.java.util.Map<java.lang.String,java.lang.String>injectForAgent(brave.propagation.TraceContext traceContext)Inject the trace context from U into the returned set of key value pairs for propagation to Agent.java.util.Map<java.lang.String,java.lang.String>injectForJob(brave.propagation.TraceContext traceContext)Inject the trace context from U into the returned set of key value pairs for propagation to job.
-
-
-
Method Detail
-
extract
public java.util.Optional<brave.propagation.TraceContext> extract(java.util.Map<java.lang.String,java.lang.String> environment)
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:
extractin interfaceTracePropagator<brave.propagation.TraceContext>- Parameters:
environment- Generally this will be the result ofSystem.getenv()- Returns:
- A new instance of
TracePropagatorcontaining the extracted context orOptional.empty()if no context information was found
-
injectForAgent
public java.util.Map<java.lang.String,java.lang.String> injectForAgent(brave.propagation.TraceContext traceContext)
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:
injectForAgentin 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
public java.util.Map<java.lang.String,java.lang.String> injectForJob(brave.propagation.TraceContext traceContext)
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:
injectForJobin 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
-
-