Skip to content

Commit

Permalink
Response 返回 traceid #67
Browse files Browse the repository at this point in the history
  • Loading branch information
liurui committed Jan 5, 2024
1 parent 6828847 commit a3464cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static boolean onEnter(
if (response instanceof HttpServletResponse) {
// Default value for checking for uncaught error later
InstrumentationContext.get(ServletResponse.class, Integer.class).put(response, 200);
((HttpServletResponse) response).setHeader("guance_trace_id", GlobalTracer.get().getTraceId());
}

final AgentSpan.Context.Extracted extractedContext = DECORATE.extract(httpServletRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static boolean onEnter(
scope = activateSpan(castDispatchSpan);
return false;
}

httpServletResponse.setHeader("guance_trace_id", GlobalTracer.get().getTraceId());
finishSpan = true;

Object spanAttrValue = request.getAttribute(DD_SPAN_ATTRIBUTE);
Expand Down

0 comments on commit a3464cd

Please sign in to comment.