-
Notifications
You must be signed in to change notification settings - Fork 437
fix(otel): support tag flattening [AIT-9352] [backport 2.5] #8093
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ensures otel tags/attribute values with the type List, Tuple and/or set are flattened. This operation is already done by the Datadog UI when displaying tags. However we should also do this in the tracer to better align with other languages. The flattening logic must follow this spec: ``` Array values must decay into as many keys as there are entries in the array. The keys must be mapped by concatenating the outer and inner key values together, recursively, separated by a dot. In pseudo-code: fn addArrayAttribute(key, array): for (subkey, value) in array: addScalarOrArrayAttribute(key + "." + subkey, value) Example: Given attributes {"key": [[1,2], ["3", "4"]]}, we will have {"key.0.0": "1", "key.0.1": 2, "key.1.0": 3, "key.1.1":4}. ``` ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [ ] Title is accurate. - [ ] No unnecessary changes are introduced. - [ ] Description motivates each change. - [ ] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [ ] Testing strategy adequately addresses listed risk(s). - [ ] Change is maintainable (easy to change, telemetry, documentation). - [ ] Release note makes sense to a user of the library. - [ ] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment. - [ ] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) - [ ] If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. - [ ] This PR doesn't touch any of that. (cherry picked from commit 7c75365)
BenchmarksBenchmark execution time: 2024-01-17 04:36:16 Comparing candidate commit a0da092 in PR branch Found 14 performance improvements and 13 performance regressions! Performance is the same for 168 metrics, 9 unstable metrics. scenario:coreapiscenario-context_with_data_listeners_and_all_listeners
scenario:coreapiscenario-core_dispatch_listeners
scenario:coreapiscenario-core_dispatch_listeners_and_all_listeners
scenario:coreapiscenario-core_dispatch_with_results_listeners_and_all_listeners
scenario:coreapiscenario-core_dispatch_with_results_no_listeners
scenario:coreapiscenario-core_dispatch_with_results_only_all_listeners
scenario:coreapiscenario-get_item_missing
scenario:httppropagationextract-b3_headers
scenario:httppropagationextract-empty_headers
scenario:httppropagationextract-invalid_trace_id_header
scenario:httppropagationextract-wsgi_empty_headers
scenario:httppropagationextract-wsgi_invalid_span_id_header
scenario:httppropagationinject-with_priority_and_origin
scenario:httppropagationinject-with_tags_invalid
scenario:httppropagationinject-with_tags_max_size
scenario:otelspan-add-metrics
scenario:otelspan-add-tags
scenario:sethttpmeta-no-useragentvariant
scenario:sethttpmeta-obfuscation-regular-case-explicit-query
scenario:sethttpmeta-obfuscation-worst-case-explicit-query
scenario:sethttpmeta-useragentvariant_exists_1
scenario:sethttpmeta-useragentvariant_exists_2
scenario:sethttpmeta-useragentvariant_exists_3
scenario:span-start-finish
scenario:tracer-large
scenario:tracer-medium
scenario:tracer-small
|
mabdinur
approved these changes
Jan 12, 2024
emmettbutler
approved these changes
Jan 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 7c75365 from #8042 to 2.5.
Ensures otel tags/attribute values with the type List, Tuple and/or set are flattened. This operation is already done by the Datadog UI when displaying tags. However we should also do this in the tracer to better align with other languages.
The flattening logic must follow this spec:
Checklist
changelog/no-changelog
.Reviewer Checklist
@DataDog/security-design-and-guidance
.