Repository navigation
opentelemetry-sdk: preserve metric instrument name casing - #5881
mertefesensoy wants to merge 3 commits into
Conversation
Fixes open-telemetry#3207. Preserve the first registered spelling while keeping registration, View selection, and conflict detection case-insensitive. Assisted-by: Codex (GPT-6) Signed-off-by: MERT EFE ŞENSOY <sensoymertefe@gmail.com>
|
|
Pull request dashboard statusWaiting on reviewers · refreshed 2026-11-05 06:32 UTC Review the latest changes. Status above doesn't look right?
|
The changelog check requires .changelog/<PR_NUMBER>.<type>; the fragment was named after issue open-telemetry#3207. Assisted-by: Claude Code (claude-opus-5-5) Signed-off-by: MERT EFE ŞENSOY <sensoymertefe@gmail.com>
|
Took a detailed look through the changes in _internal/init.py\ and the test suite. Preserving the original casing across all seven instrument constructors directly resolves the long-standing behavior from #3207 where names like \RequestCount\ were forced to lowercase. Adding _log_instrument_name_conflict\ provides the exact warning recommended by the SDK specification when another spelling attempts to register against an existing instrument. Keeping view matching case-insensitive in _view_instrument_match.py\ while preserving the casing chosen in the view definition is a clean approach. It ensures existing view configurations won't silently stop matching previously declared instruments. The tests in \ est_meter.py\ and \ est_view.py\ cover the casing preservation, conflict warnings, and case-insensitive view lookups thoroughly. Nice work putting this together! |
Description
Preserves names such as
RequestCountin collected and OTLP-encoded metrics. On main, the same input becomesrequestcountfor all seven instrument kinds; the local before/after probe verifies the original spelling after this change.Fixes #3207, following the agreed direction to stop lowercasing names.
Registration still treats names case-insensitively and returns the first spelling. View selection and conflict detection compare names case-insensitively too. Registering another spelling emits the warning required by the SDK name-conflict rule.
Existing queries that depend on lowercase metric names may need updating. The changelog filename is a placeholder for now until this draft PR receives its number.
Type of change
Validation
Codex ran the new tests on unchanged main: 22 failed, 5 passed.
I ran these on Windows (Python 3.13.14) with this change:
Checklist:
tox -e precommittox -e typecheckAI-assisted with Codex. Validation commands and results are recorded above.