Class TraceContextPropagation
java.lang.Object
com.linecorp.armeria.client.brave.TraceContextPropagation
Manually propagates a
TraceContext to a BraveClient.-
Method Summary
-
Method Details
-
inject
@UnstableApi public static Consumer<com.linecorp.armeria.client.ClientRequestContext> inject(Supplier<brave.propagation.TraceContext> traceContextSupplier) Injects the currentTraceContextthroughClientBuilder.contextCustomizer(Consumer)orClients.withContextCustomizer(Consumer). The injectedTraceContextwill be propagated toBraveClientas a parentSpan.Basically, a parent
TraceContextis automatically propagated toBraveClientif you useBraveService. This method is useful if you want to manually propagate the currentTraceContexttoBraveClientin non-Armeria server environment.Tracing threadLocalTracing = ...; Tracing requestContextTracing = Tracing.newBuilder() .currentTraceContext(RequestContextCurrentTraceContext.ofDefault()) .build(); Clients.builder(...) .contextCustomizer(TraceContextPropagation.inject(() -> { return threadLocalTracing.currentTraceContext().get(); }) .decorator(BraveClient.newDecorator(requestContextTracing)) .build();
-