Package brave.propagation
Interface TraceContext.Injector<R>
-
- Enclosing class:
- TraceContext
public static interface TraceContext.Injector<R>
Used to send the trace context downstream. For example, as http headers.For example, to put the context on an
HttpURLConnection
, you can do this:// in your constructor injector = tracing.propagation().injector(URLConnection::setRequestProperty); // later in your code, reuse the function you created above to add trace headers HttpURLConnection connection = (HttpURLConnection) new URL("http://myserver").openConnection(); injector.inject(span.context(), connection);
Note: This type is safe to implement as a lambda, or use as a method reference as it is effectively a
FunctionalInterface
. It isn't annotated as such because the project has a minimum Java language level 6.- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
inject(TraceContext traceContext, R request)
Usually calls a setter for each propagation field to send downstream.
-
-
-
Method Detail
-
inject
void inject(TraceContext traceContext, R request)
Usually calls a setter for each propagation field to send downstream.- Parameters:
traceContext
- possibly unsampled.request
- holds propagation fields. For example, an outgoing message or http request.
-
-