-
Notifications
You must be signed in to change notification settings - Fork 398
swap out the existing headers normalization logic with the tag normalizer #5041
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?
Conversation
… This is still missing memoization and additional tests.
…he payload has the process tag only when the feature is enabled.
…versions so this fixes that.
Co-authored-by: Marco Costa <marco.costa@datadoghq.com>
…uby conflict with sqlite and it is not needed for this test
…izer used for spans
|
👋 Hey @DataDog/ruby-guild, please fill "Change log entry" section in the pull request description. If changes need to be present in CHANGELOG.md you can state it this way **Change log entry**
Yes. A brief summary to be placed into the CHANGELOG.md(possible answers Yes/Yep/Yeah) Or you can opt out like that **Change log entry**
None.(possible answers No/Nope/None) Visited at: 2025-11-12 16:20:11 UTC |
| it 'preserves them' do | ||
| is_expected.to eq(tag) | ||
| is_expected.to eq("") | ||
| end | ||
| end | ||
|
|
||
| context 'with unsupported characters' do | ||
| let(:tag) { "\\ \t!@?" } | ||
|
|
||
| it 'replaces each with an underscore' do | ||
| is_expected.to eq('_' * tag.size) | ||
| # turns into an empty string because in a tag, the first character must be a letter | ||
| is_expected.to eq('') | ||
| end | ||
| end |
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.
When changing the logic -- please update the test description as well! It'd be quite confusing to have a test saying "it replaces each with an underscore" that actually is not true :P
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.
oh! good catch, I'll use a better description for this!
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 updated the description but open to feedback on the wording !
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.
Seems reasonable! :)
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.
Thanks! Just a heads up I'm still changing the normalization logic in #5033, so I'll circle back to this PR after the process tags PR to see if I need to update these test assertions.
… environment variable.
Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>
Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>
Co-authored-by: Marco Costa <marco.costa@datadoghq.com>
Co-authored-by: Marco Costa <marco.costa@datadoghq.com>
Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>
Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>
…xist, small fixes, and add comments to the normalizer.rb explaining the expected usage
Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>
Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>
| context 'with a mix of unsupported and supported characters' do | ||
| let(:tag) { "\\ \t!@?a" } | ||
|
|
||
| it 'the first letter to show up is the supported character' do |
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.
We try to make out of this line a real statement, readable by us, now that reads
it the first letter to show up is the supported character
to be honest I don't get what it said. Check out some other tests, you will find something like
it 'returns only supported characters'
or something similar
…xtend self on process.rb
…r and update tests to show some new assertions
Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>
Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>
…ts are allowed for tag values
… before setting process tags.
BenchmarksBenchmark execution time: 2025-11-22 00:24:16 Comparing candidate commit 2f4d1c6 in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 43 metrics, 2 unstable metrics. scenario:tracing - Propagation - Trace Context
|
What does this PR do?
Uses the new tag normalization logic that was copied from the Trace Agent for headers.
Motivation:
While working on #5033, it was noticed that the current normalization logic in dd-trace-rb is missing some of the logic from https://github.com/DataDog/datadog-agent/blob/45799c842bbd216bcda208737f9f11cade6fdd95/pkg/trace/traceutil/normalize.go#L131 , specifically around:
_are mergedChange log entry
feat: swap out the existing headers normalization logic with the tag normalizer
Additional Notes:
I am not sure if we consider this to be a bug or a missing feature, but note that with this new logic, some of the headers results are going to be empty strings ie:
"", which can be seen in the tests below.How to test the change?
I've been using: