Replies: 4 comments 1 reply
-
moving to the instrumentation repository |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can modify response by HttpServerResponseCustomizer @AutoService(HttpServerResponseCustomizer.class)
public class TraceIdHttpServerResponseCustomizer implements HttpServerResponseCustomizer {
@Override
public <T> void customize(Context serverContext, T response, HttpServerResponseMutator<T> responseMutator) {
SpanContext spanContext = Span.fromContext(serverContext).getSpanContext();
if (!spanContext.isValid()) {
return;
}
responseMutator.appendHeader(response, "X-Trace-Id", spanContext.getTraceId());
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
Do I misunderstand or this is actually what the (draft) standard |
Beta Was this translation helpful? Give feedback.
1 reply
-
Note that Spring Boot 3.5.0-M2 is now capable of including an |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I couldn't find any information if this is by design or if I miss-configured something.
I just implemented OpenTelemetry on a new Spring Boot application. I can see tracing works as I can see the requests in Jaeger and also in the console from the logging exporter. However, I don't get the trace-id back in the
curl
request.I would like to have this returned for the original request. This not only facilitate testing, it will also make it easy for clients to report problems. This doesn't seem to be the default behavior. Looking through the code for the code for the instrumenter (
SpringWebMvcTelemetry
and related classes), it only extracts information from the headers and doesn't seem to add anything once the request is done processing.Is this already supported? Is there any reason this is not implemented or should not be implemented?
P.S: I can easily implement a Spring Filter to get the current context and return the relevant headers. Or perhaps use create
OperationListener
to copy the context to the HTTP response headers.Beta Was this translation helpful? Give feedback.
All reactions