spanmetrics: fall back to mapped attribute when no source_label matches - #7802
Open
buiducnhat wants to merge 2 commits into
Open
spanmetrics: fall back to mapped attribute when no source_label matches#7802buiducnhat wants to merge 2 commits into
buiducnhat wants to merge 2 commits into
Conversation
When a dimension_mapping's name matches an attribute that is already present on a span/resource (e.g. http_response_status_code after normalization), use that value as a fallback so spans carrying the new convention are labelled consistently with spans that only have a legacy source_label. Fixes grafana#3256
buiducnhat
requested review from
carles-grafana,
electron0zero,
ie-pham,
javiermolinar,
knylander-grafana,
mapno,
mattdurham,
mdisibio,
ruslan-mikhailov,
stoewer,
yvrhdn,
zalegrala and
zhxiaogg
as code owners
August 20, 2026 04:14
Contributor
Signed commits report2 of 2 commits between
This repository requires all commits to be signed. See GitHub docs on commit signature verification. |
|
|
1 similar comment
|
|
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.
What this PR does:
When a span-metrics
dimension_mappingsentry'snamematches an attribute that is already present on a span/resource (e.g.http_response_status_code), that value is now used as a fallback when none of the configuredsource_labelsmatch.Motivation: With a config like
spans that still send the legacy
http.status_codeget their value remapped tohttp_response_status_code, but spans that have already migrated to the new attribute end up with an emptyhttp_response_status_codelabel and land on a different metric series. This splits a single logical signal across two series and makes migration of instrumentation conventions painful.Behaviour change: only when no
source_labelproduced a value does the processor consult the attribute nameddimension_mappings.namedirectly. Existing behaviour for spans that match asource_labelis unchanged (no double-counting, no reordering).Which issue(s) this PR fixes:
Fixes #3256
Checklist
TestSpanMetricsDimensionMappingIncludesMappedAttributecovers both the mapped and direct-attribute paths)dimension_mappings).chloggen/