Exempt specific GenAI attributes values from custom properties truncation#45596
Merged
rads-1996 merged 3 commits intoAzure:mainfrom Mar 10, 2026
Merged
Exempt specific GenAI attributes values from custom properties truncation#45596rads-1996 merged 3 commits intoAzure:mainfrom
rads-1996 merged 3 commits intoAzure:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Azure Monitor OpenTelemetry exporter custom-properties handling to avoid truncating values for a specific allowlist of GenAI-related attribute keys.
Changes:
- Add a
_GEN_AI_ATTRIBUTESallowlist and exempt those keys’ values from the 64KiB truncation. - Update
_filter_custom_propertiestruncation logic to apply truncation only to non-GenAI keys. - Update unit tests and documentation/changelog entries related to custom properties truncation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py |
Introduces _GEN_AI_ATTRIBUTES allowlist of GenAI attribute keys. |
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py |
Updates _filter_custom_properties to bypass truncation for allowlisted GenAI keys. |
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_utils.py |
Replaces env-var-based truncation tests with GenAI allowlist and mixed-key truncation tests. |
sdk/monitor/azure-monitor-opentelemetry-exporter/README.md |
Removes documentation for the truncation env var. |
sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md |
Adds an entry about GenAI truncation exemption (but needs reconciliation with other truncation entries). |
Comments suppressed due to low confidence (1)
sdk/monitor/azure-monitor-opentelemetry-exporter/CHANGELOG.md:18
- The unreleased changelog entries around custom properties truncation are now inconsistent with the implementation in
_filter_custom_properties: it no longer supportsAZURE_MONITOR_DISABLE_CUSTOM_DIMENSIONS_LIMIT, yet the changelog still claims an env var exists, and it also includes an entry saying truncation was removed. Please reconcile these entries so they match the actual shipped behavior (and move any behavior removal to Breaking Changes if applicable).
- Exempt specific GenAI attributes values from custom properties truncation
([#45596](https://github.com/Azure/azure-sdk-for-python/pull/45596))
- Add environment variable to disable/enable custom properties truncation
([#45479](https://github.com/Azure/azure-sdk-for-python/pull/45479))
- Fix io counters import issue in performance counters
([#45286](https://github.com/Azure/azure-sdk-for-python/pull/45286))
- Remove custom properties truncation
You can also share your feedback on Copilot code review. Take the survey.
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py
Outdated
Show resolved
Hide resolved
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_utils.py
Outdated
Show resolved
Hide resolved
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/test_utils.py
Outdated
Show resolved
Hide resolved
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_utils.py
Show resolved
Hide resolved
1e281d6 to
ad98a4a
Compare
hectorhdzg
approved these changes
Mar 10, 2026
aprilk-ms
pushed a commit
that referenced
this pull request
Mar 11, 2026
…tion (#45596) * Exempt specific GenAI attributes values from custom properties truncation * Fix format * Fix tests
singankit
pushed a commit
that referenced
this pull request
Mar 16, 2026
…tion (#45596) * Exempt specific GenAI attributes values from custom properties truncation * Fix format * Fix tests
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
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.
All SDK Contribution checklist:
General Guidelines and Best Practices