Skip to content

fix: support sequence metric attributes in view aggregation keys#5341

Open
naveenvenk17 wants to merge 1 commit into
open-telemetry:mainfrom
naveenvenk17:naveenvenk17/otel/fix-metric-sequence-attributes
Open

fix: support sequence metric attributes in view aggregation keys#5341
naveenvenk17 wants to merge 1 commit into
open-telemetry:mainfrom
naveenvenk17:naveenvenk17/otel/fix-metric-sequence-attributes

Conversation

@naveenvenk17

Copy link
Copy Markdown

Fixes #3750.

Summary

  • Use the SDK's attribute-key helper for metric view aggregation keys instead of frozenset(attributes.items()).
  • Normalize sequence-valued attributes to tuples for the private aggregation key while preserving the original datapoint attributes.
  • Broaden the existing get_dict_as_key helper from list values to non-string sequence values.
  • Add a regression test for list and tuple metric attributes.

Evidence

  • .tox\\py312-test-opentelemetry-sdk\\Scripts\\pytest.exe opentelemetry-sdk\\tests\\metrics\\test_view_instrument_match.py -q passed: 11 passed.
  • uv run ruff check opentelemetry-sdk\\src\\opentelemetry\\sdk\\metrics\\_internal\\_view_instrument_match.py opentelemetry-sdk\\src\\opentelemetry\\sdk\\util\\__init__.py opentelemetry-sdk\\tests\\metrics\\test_view_instrument_match.py passed.
  • .tox\\lint-opentelemetry-sdk\\Scripts\\pylint.exe opentelemetry-sdk\\src\\opentelemetry\\sdk\\metrics\\_internal\\_view_instrument_match.py opentelemetry-sdk\\src\\opentelemetry\\sdk\\util\\__init__.py opentelemetry-sdk\\tests\\metrics\\test_view_instrument_match.py passed: 10.00/10.
  • Earlier full SDK tox run for this branch with uv run tox -e py312-test-opentelemetry-sdk -- opentelemetry-sdk/tests/metrics/test_view_instrument_match.py passed: 1098 passed, 13 skipped.
  • git diff --check passed.

@naveenvenk17 naveenvenk17 requested a review from a team as a code owner June 22, 2026 15:02
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 22, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: naveenvenk17 / name: naveenvenk17 (dcb6629)

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale label Jul 7, 2026
@lzchen

lzchen commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@naveenvenk17

I think there's a PR out that addresses this issue already? #5303

@github-actions github-actions Bot removed the Stale label Jul 8, 2026
@xrmx

xrmx commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This needs a changelog entry in .changelog, more details in CONTRIBUTING.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Metric attributes does not accept all types of sequences

3 participants