Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I add the Pinpoint-TraceID header to the response header through the pinpoint agent? #9223

Open
linux0x5c opened this issue Sep 23, 2022 · 2 comments

Comments

@linux0x5c
Copy link
Contributor

I want to see the TraceID of pinpoint through the client browser. Can I add this response header through the pinpoint agent configuration? If not, is there any API interface that can obtain the TraceID of this request?

@emeroad
Copy link
Member

emeroad commented Sep 23, 2022

Currently there is no such feature, It probably won't be difficult to develop.

public class ServletResponseListener<RESP> {
    public void destroyed(RESP response, final Throwable throwable, final int statusCode) {
        //~~~
        final Trace trace = this.traceContext.currentRawTraceObject();
        if (trace == null) {
            return;
        }

        if (trace.canSampled()) {
            final SpanRecorder spanRecorder = trace.getSpanRecorder();
            this.httpStatusCodeRecorder.record(spanRecorder, statusCode);
            this.serverResponseHeaderRecorder.recordHeader(spanRecorder, response);
            // Dump traceId to Response
            if (enableDump) {
                TraceId traceId = trace.getTraceId();
                // Add setHeader API
                serverResponseHeaderRecorder.setHeader(response, "Pinpoint-Response-TraceID", traceId.toString());
            }
        }
    }
}

How about developing this feature?

@linux0x5c
Copy link
Contributor Author

@emeroad This is an exciting feature that extracts Trace-IDs directly from the browser's debug mode, allowing us to quickly locate problems,thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants