-
Notifications
You must be signed in to change notification settings - Fork 19
Tracing uniquely identifies requests #574
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
Conversation
Generate changelog in
|
|
needs more test coverage |
| public static final String TRACE_SAMPLED_KEY = "_sampled"; | ||
|
|
||
| /** The key under which tracing request ids are inserted into SLF4J {@link org.slf4j.MDC MDCs}. */ | ||
| public static final String REQUEST_ID_KEY = "_requestId"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will appear in every log line. Do we want to abbreviate it in some way? As written it's self-explanatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it as is
| /** | ||
| * Initializes the current thread's trace, erasing any previously accrued open spans. | ||
| * | ||
| * @deprecated Use {@link #initTraceWithSpan(Observability, String, String, SpanType)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there seems to be relatively little usage of this method, with the majority of it being in tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately many tests attempt to peel back layers of abstraction rather than testing results. These methods are only really used for server-incoming requests where we have prior knowledge of a request identifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry my comment was unclear, I was looking at internal usage across the fleet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense 👍
| if (!requestId.isPresent()) { | ||
| throw new SafeIllegalStateException("No requestId is set", SafeArg.of("span", detachedSpan)); | ||
| } | ||
| exchange.putAttachment(TracingAttachments.REQUEST_ID, requestId.get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add a response header as well for easier debugging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I'm ready to modify the wire api at this point, the traceid is more actionable in the majority of cases as an api consumer while the requestId gives us the ability to do stronger structured analysis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, we can add it later if needed
|
👍 looks great! |
|
Released 4.6.0 |
Before this PR
Many requests may share a single traceId, there was no identifying information to distinguish between requests.
After this PR
==COMMIT_MSG==
Tracing uniquely identifies requests
==COMMIT_MSG==
Possible downsides?