-
Notifications
You must be signed in to change notification settings - Fork 323
Remove RadixTreeCache for int status and protect httpStatus short cache #10236
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1092,14 +1092,24 @@ public void processTagsAndBaggage( | |
| samplingPriority != PrioritySampling.UNSET ? samplingPriority : getSamplingPriority(), | ||
| measured, | ||
| topLevel, | ||
| httpStatusCode == 0 ? null : HTTP_STATUSES.get(httpStatusCode), | ||
| httpStatusCode == 0 ? null : shortStatusCodeToString(httpStatusCode), | ||
| // Get origin from rootSpan.context | ||
| getOrigin(), | ||
| longRunningVersion, | ||
| ProcessTags.getTagsForSerialization())); | ||
| } | ||
| } | ||
|
|
||
| private UTF8BytesString shortStatusCodeToString(short httpStatusCode) { | ||
| try { | ||
| return HTTP_STATUSES.get(httpStatusCode); | ||
| } catch (Throwable t) { | ||
| // RadixTreeCache seems to have issues on semeru11 - NPE on AtomicReferenceArray cas | ||
| // skip the cache in those cases and just create a String | ||
| return UTF8BytesString.create(Short.toString(httpStatusCode)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Will this create too many allocations.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's not supposed to fail the cache acccess. Note that this method is on the hot path when finish is called on the root span -> write is called. If this throw we might bubble the application code IMO. Better to allocate something than throw
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the failure constant on Semeru? Or is it sporadic? I've started debating using UTF8BytesString for values, since we now have the UTF8 cache. I also have some evidence that some caches are doing more harm than good now. Long term, I'm hoping that TagMap will provide a more elegant solution to these problems, but unfortunately, I'm not there yet.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well I think more that there are no failures in the real life but only happens in CI. The stacktrace is very weird since it sounds like implying that either unsafe is null (sounds impossible) either the array is itself is null (that sounds not possible as well unless the class is unsafely allocated). In CI it passes on a retry run on a fresh JVM that looks indicating that something is gets corrupted on the used jvm? I put this catch in a defensive way - I can remove if needed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How many semeru 11 hosts can be impacted ? |
||
| } | ||
| } | ||
|
|
||
| void injectW3CBaggageTags(Map<String, String> baggageItemsWithPropagationTags) { | ||
| List<String> baggageTagKeys = Config.get().getTraceBaggageTagKeys(); | ||
| if (baggageTagKeys.isEmpty()) { | ||
|
|
||
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.
Just curious if we can use
inthere too? Same as you did withport?Or it would be a huge refactoring?
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.
Indeed I think it can be just an
int(I see we use ashortindeed) since in other parts is casted as intThere 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.
According to
dd-trace-java/dd-trace-core/src/main/java/datadog/trace/core/DDSpan.java
Line 421 in 701d1e5
so at this point in the metadata it should become a string I believe