Inject method in OpenTelemetry

157 Views Asked by At

We are migrating from open-tracing to open telemetry .

We have inject function like below in open-tracing.

getTracer().inject(getActiveSpanContet(), Builtin.HTTP_HEADERS, new TextMapAdapter(contextValues));

Could some one please help what would be equivalent for same in openTelemetry? I tried searching on google I couldn’t get equivalent for same .

1

There are 1 best solutions below

2
Tyler B On

OpenTelemetry has a similar inject method on the Propagators API

openTelemetry.getPropagators().getTextMapPropagator().inject(Context.current(), transportLayer, setter);