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 Object implements BraveTracePropagator
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 Details

    • EnvVarBraveTracePropagatorImpl

      public EnvVarBraveTracePropagatorImpl()
  • Method Details

    • extract

      public Optional<brave.propagation.TraceContext> extract(Map<String,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:
      extract in interface TracePropagator<brave.propagation.TraceContext>
      Parameters:
      environment - Generally this will be the result of System.getenv()
      Returns:
      A new instance of TracePropagator containing the extracted context or Optional.empty() if no context information was found
    • injectForAgent

      public Map<String,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:
      injectForAgent in interface TracePropagator<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 Map<String,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:
      injectForJob in interface TracePropagator<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