-
Notifications
You must be signed in to change notification settings - Fork 199
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
RootIds generated by TelemetryCorrelationUtils can be < 32 characters #910
Comments
@raedur thanks for opening the issue. I am curious when do you see this behavior. Have you turned on W3C for both agent and sdk? |
This is not using the javaagent, just the sdk. I'll have to double check if W3C is on, but the function should probably be fixed anyway, for now in my code I have created an interceptor that generates the root Id instead of letting application insights do it. |
We hit the same bug with 2.4.0 version. Also, with AI agent instrumenting Apache Http Client, this bug prevents some of the outgoing http requests from executing:
In this particular case, traceId was 31 symbols long.
|
This is pretty significant issue for the users of AI agent. |
Hi @vlev, yes, a PR would be great. As far as releasing dedicated 2.4.1 for this, it looks like this exception is caught and logged by TraceContextCorrelation.java, so it should not prevent the outgoing http request from executing, can you confirm what you are seeing? |
Hi @trask,
It seems, that createChildIdFromTraceparentString() won't work with null value.
This method is called thru cryptic asm instrumentation:
|
Fixed in version 2.4.1, releasing this week. |
Thanks @vlev ! |
* Add document describing current problem with context propagation * Update docs/contributing/inter-thread-context-propagation.md Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com> * Update docs/contributing/inter-thread-context-propagation.md Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com> * More clarifications * More clarifications * Better example Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
Expected behavior
Traceparent.validate doesn't throw an exception on generated traceIds
Actual behavior
Traceparent.validate sometimes throws an exception on generated traceIds if they are not 32 characters long
Traceparent.validate requires traceIds to be 32 characters long, however those created by TelemetryCorrelationUtils are not guaranteed to be 32 characters long, the current code is as follows:
This generates 32 char ids most of the time, (e.g. for UUIDs of "bb1141ac-f798-4a6c-1234-76774462e31f") but if the generated UUID contains multiple 0s in a row (e.g. bb1141ac-f798-4a6c-0000-76774462e31f) it omits the 0s in the generated id (i.e. it generates bb1141acf7984a6c76774462e31f) which is only 28 characters long which subsequently throws the exception in Traceparent.validate
Maybe the generateRootId should be:
The text was updated successfully, but these errors were encountered: