Skip to content

Exempt specific GenAI attributes values from custom properties truncation#45596

Merged
rads-1996 merged 3 commits intoAzure:mainfrom
rads-1996:do-not-truncate-genai-attrs
Mar 10, 2026
Merged

Exempt specific GenAI attributes values from custom properties truncation#45596
rads-1996 merged 3 commits intoAzure:mainfrom
rads-1996:do-not-truncate-genai-attrs

Conversation

@rads-1996
Copy link
Member

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Copilot AI review requested due to automatic review settings March 9, 2026 22:40
@github-actions github-actions bot added the Monitor - Exporter Monitor OpenTelemetry Exporter label Mar 9, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_ATTRIBUTES allowlist and exempt those keys’ values from the 64KiB truncation.
  • Update _filter_custom_properties truncation 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 supports AZURE_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.

Copy link
Member

@JacksonWeber JacksonWeber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rads-1996 rads-1996 force-pushed the do-not-truncate-genai-attrs branch from 1e281d6 to ad98a4a Compare March 10, 2026 15:20
@rads-1996 rads-1996 merged commit ccbf8d4 into Azure:main Mar 10, 2026
20 checks passed
@rads-1996 rads-1996 deleted the do-not-truncate-genai-attrs branch March 10, 2026 17:02
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Monitor - Exporter Monitor OpenTelemetry Exporter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants