-
Notifications
You must be signed in to change notification settings - Fork 397
feat: add process tags to traces #5033
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.
|
👋 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-11 18:46:13 UTC |
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage 🔗 Commit SHA: 9ad5be5 | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
|
|
||
| def entrypoint_basedir | ||
| current_basedir = File.expand_path(File.dirname($0.to_s)) | ||
| normalized_basedir = current_basedir.tr(File::SEPARATOR, '/') |
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 convert possible windows separator to unix, correct?
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 don't have a way to test in Windows to confirm this, but also based on the compatibility docs we don't support Windows: https://docs.datadoghq.com/tracing/trace_collection/compatibility/ruby/#supported-operating-systems?
| def tag_process_tags! | ||
| return unless trace.experimental_propagate_process_tags_enabled | ||
| process_tags = Core::Environment::Process.formatted_process_tags_k1_v1 | ||
| return if process_tags.empty? |
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 is impossible right? If so, we can remove it, as it would give us a false sense of uncertainty here.
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 I fixed it in 8dae705 by just removing the check in process tags, but let me know if you spot issues with it!
…he payload has the process tag only when the feature is enabled.
…versions so this fixes that.
Co-authored-by: Marco Costa <[email protected]>
BenchmarksBenchmark execution time: 2025-11-11 20:54:12 Comparing candidate commit f5ca84a in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 44 metrics, 2 unstable metrics. |
| format! | ||
| expect(first_span.meta).to include('_dd.tags.process') | ||
| expect(first_span.meta['_dd.tags.process']).to eq(Datadog::Core::Environment::Process.serialized) | ||
| # TODO figure out if we need an assertion for the value, ie |
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.
@marcotc - do you think there's value in asserting for the values of the tag? Or is the test in process_spec enough?
Typing analysisNote: Ignored files are excluded from the next sections. Untyped methodsThis PR introduces 5 untyped methods and 2 partially typed methods. It decreases the percentage of typed methods from 53.12% to 52.89% (-0.23%). Untyped methods (+5-0)❌ Introduced:Partially typed methods (+2-0)❌ Introduced:Untyped other declarationsThis PR introduces 1 untyped other declaration. It increases the percentage of typed other declarations from 66.92% to 67.05% (+0.13%). Untyped other declarations (+1-0)❌ Introduced:If you believe a method or an attribute is rightfully untyped or partially typed, you can add |
…uby conflict with sqlite and it is not needed for this test
What does this PR do?
The goal of AIDM-253 is to add process tags to the trace payloads.
I'm creating a draft for now but I still need to research some things like:
[x] add memoization or some kind of cache to avoid looking for these values over and over when are fixed by process
[] figure out the best place to add more tests to assert on the overall behavior (right now I have a test in process_spec to assert on the values)
[x] research if Windows is part of this testing strategy -> Not supported
[x] determine how to approach server type since it's not at the process level -> Will remove in this PR and add later
[x] normalization of tags
After this gets merged, the next step is to add it for the other products.
Main tests:
Motivation:
Change log entry
Add process tags to trace payloads.
Additional Notes:
How to test the change?