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)

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

1 participant