Skip to content

[service] Remove duplicated service labels on every datapoint in prometheus output#14811

Merged
dmitryax merged 3 commits into
open-telemetry:mainfrom
dmitryax:remove-attributes-duplication
Mar 20, 2026
Merged

[service] Remove duplicated service labels on every datapoint in prometheus output#14811
dmitryax merged 3 commits into
open-telemetry:mainfrom
dmitryax:remove-attributes-duplication

Conversation

@dmitryax

@dmitryax dmitryax commented Mar 19, 2026

Copy link
Copy Markdown
Member

Partially resolves #14814 (removes duplicated attributes)

Internal collector metrics exposed with Prometheus by default have duplicated service labels (service_name, service_instance_id, service_version) on every datapoint while the same service attributes emitted as target_info labels ending up as proper resource attributes which the metrics scraped with Prometheus receiver (service.name, service.instance.id, service. version)

The duplicated labels on every internal metric datapoint were added for OpenCensus backwards compatibility in #9029 long time ago. Given that now the target_info is correctly translated to Resource attributes and the duplication leads to open-telemetry/opentelemetry-collector-contrib#47011, it should be good time to remove it.

… metrics

Resource attributes (service_name, service_instance_id, service_version)
were stamped as constant labels on every internal metric datapoint via
WithResourceConstantLabels for OpenCensus backwards compatibility (added
in open-telemetry#9029). These attributes are already carried by target_info, so the
duplication inflates cardinality and causes label name inconsistencies
when the Prometheus translation strategy changes (as seen in #47011).

Remove WithResourceConstantLabels from the default config so resource
attributes appear only in target_info, following the correct Prometheus
and OTel data model convention.

Assisted-by: Claude Opus 4.6
@dmitryax
dmitryax requested a review from a team as a code owner March 19, 2026 18:22
@dmitryax
dmitryax requested a review from codeboten March 19, 2026 18:22
@codspeed-hq

codspeed-hq Bot commented Mar 19, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 7 untouched benchmarks
⏩ 76 skipped benchmarks1


Comparing dmitryax:remove-attributes-duplication (ef83103) with main (4447440)

Open in CodSpeed

Footnotes

  1. 76 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@codecov

codecov Bot commented Mar 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.37%. Comparing base (86b87dc) to head (ef83103).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14811      +/-   ##
==========================================
- Coverage   91.39%   91.37%   -0.03%     
==========================================
  Files         695      695              
  Lines       44403    44405       +2     
==========================================
- Hits        40584    40576       -8     
- Misses       2686     2692       +6     
- Partials     1133     1137       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread .chloggen/remove-resource-constant-labels.yaml Outdated

@songy23 songy23 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@dmitryax
dmitryax added this pull request to the merge queue Mar 20, 2026
Merged via the queue into open-telemetry:main with commit 4d10484 Mar 20, 2026
66 checks passed
@dmitryax
dmitryax deleted the remove-attributes-duplication branch March 20, 2026 14:15
TimoBehrendt pushed a commit to TimoBehrendt/tracebasedlogsampler that referenced this pull request Apr 7, 2026
…ocessortest to v0.149.0 (#49)

This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [go.opentelemetry.io/collector/processor/processortest](https://github.com/open-telemetry/opentelemetry-collector) | `v0.148.0` → `v0.149.0` | ![age](https://developer.mend.io/api/mc/badges/age/go/go.opentelemetry.io%2fcollector%2fprocessor%2fprocessortest/v0.149.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/go/go.opentelemetry.io%2fcollector%2fprocessor%2fprocessortest/v0.148.0/v0.149.0?slim=true) |

---

### Release Notes

<details>
<summary>open-telemetry/opentelemetry-collector (go.opentelemetry.io/collector/processor/processortest)</summary>

### [`v0.149.0`](https://github.com/open-telemetry/opentelemetry-collector/blob/HEAD/CHANGELOG.md#v1550v01490)

[Compare Source](open-telemetry/opentelemetry-collector@v0.148.0...v0.149.0)

##### 🛑 Breaking changes 🛑

- `pkg/service`: Remove `service_name`, `service_instance_id`, and `service_version` as constant labels on every internal metric datapoint. These attributes are already present in `target_info` and were being duplicated on each series for OpenCensus backwards compatibility. ([#&#8203;14811](open-telemetry/opentelemetry-collector#14811))
  Previously, the collector stamped every internal metric series (e.g. `otelcol_process_runtime_heap_alloc_bytes`)
  with `service_name`, `service_instance_id`, and `service_version` labels to match the old OpenCensus behavior.
  These attributes are now only present in the `target_info` metric, which is the correct Prometheus/OTel convention.
  Users who filter or group by these labels on individual metrics will need to update their queries to use
  `target_info` joins instead.

##### 💡 Enhancements 💡

- `all`: Move aix/ppc64 to tier 3 support ([#&#8203;13380](open-telemetry/opentelemetry-collector#13380))

- `all`: Upgrade the profiles stability status to alpha ([#&#8203;14817](open-telemetry/opentelemetry-collector#14817))
  The following components have their profiles status upgraded from development to alpha:

  - pdata/pprofile
  - connector/forward
  - exporter/debug
  - receiver/nop
  - exporter/nop
  - exporter/otlp\_grpc
  - exporter/otlp\_http

- `cmd/mdatagen`: Add semconv reference for attributes ([#&#8203;13297](open-telemetry/opentelemetry-collector#13297))

##### 🧰 Bug fixes 🧰

- `cmd/mdatagen`: Fix entity code generation so `extra_attributes` are emitted as resource attributes instead of entity descriptive attributes. ([#&#8203;14778](open-telemetry/opentelemetry-collector#14778))

<!-- previous-version -->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My41LjQiLCJ1cGRhdGVkSW5WZXIiOiI0My41LjQiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

Reviewed-on: https://gitea.t000-n.de/t.behrendt/tracebasedlogsampler/pulls/49
Reviewed-by: t.behrendt <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
TimoBehrendt pushed a commit to TimoBehrendt/tracebasedlogsampler that referenced this pull request Apr 7, 2026
…1.55.0 (#44)

This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [go.opentelemetry.io/collector/confmap](https://github.com/open-telemetry/opentelemetry-collector) | `v1.54.0` → `v1.55.0` | ![age](https://developer.mend.io/api/mc/badges/age/go/go.opentelemetry.io%2fcollector%2fconfmap/v1.55.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/go/go.opentelemetry.io%2fcollector%2fconfmap/v1.54.0/v1.55.0?slim=true) |

---

### Release Notes

<details>
<summary>open-telemetry/opentelemetry-collector (go.opentelemetry.io/collector/confmap)</summary>

### [`v1.55.0`](https://github.com/open-telemetry/opentelemetry-collector/blob/HEAD/CHANGELOG.md#v1550v01490)

##### 🛑 Breaking changes 🛑

- `pkg/service`: Remove `service_name`, `service_instance_id`, and `service_version` as constant labels on every internal metric datapoint. These attributes are already present in `target_info` and were being duplicated on each series for OpenCensus backwards compatibility. ([#&#8203;14811](open-telemetry/opentelemetry-collector#14811))
  Previously, the collector stamped every internal metric series (e.g. `otelcol_process_runtime_heap_alloc_bytes`)
  with `service_name`, `service_instance_id`, and `service_version` labels to match the old OpenCensus behavior.
  These attributes are now only present in the `target_info` metric, which is the correct Prometheus/OTel convention.
  Users who filter or group by these labels on individual metrics will need to update their queries to use
  `target_info` joins instead.

##### 💡 Enhancements 💡

- `all`: Move aix/ppc64 to tier 3 support ([#&#8203;13380](open-telemetry/opentelemetry-collector#13380))

- `all`: Upgrade the profiles stability status to alpha ([#&#8203;14817](open-telemetry/opentelemetry-collector#14817))
  The following components have their profiles status upgraded from development to alpha:

  - pdata/pprofile
  - connector/forward
  - exporter/debug
  - receiver/nop
  - exporter/nop
  - exporter/otlp\_grpc
  - exporter/otlp\_http

- `cmd/mdatagen`: Add semconv reference for attributes ([#&#8203;13297](open-telemetry/opentelemetry-collector#13297))

##### 🧰 Bug fixes 🧰

- `cmd/mdatagen`: Fix entity code generation so `extra_attributes` are emitted as resource attributes instead of entity descriptive attributes. ([#&#8203;14778](open-telemetry/opentelemetry-collector#14778))

<!-- previous-version -->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My41LjQiLCJ1cGRhdGVkSW5WZXIiOiI0My41LjQiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

Reviewed-on: https://gitea.t000-n.de/t.behrendt/tracebasedlogsampler/pulls/44
Reviewed-by: t.behrendt <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
andrzej-stencel added a commit to andrzej-stencel/opentelemetry-collector-releases that referenced this pull request Apr 8, 2026
github-merge-queue Bot pushed a commit to open-telemetry/opentelemetry-collector-releases that referenced this pull request Apr 8, 2026
blakerouse pushed a commit to blakerouse/opentelemetry-collector that referenced this pull request May 13, 2026
…etheus output (open-telemetry#14811)

Partially resolves
open-telemetry#14814
(removes duplicated attributes)

Internal collector metrics exposed with Prometheus by default have
duplicated service labels (`service_name`, `service_instance_id`,
`service_version`) on every datapoint while the same service attributes
emitted as `target_info` labels ending up as proper resource attributes
which the metrics scraped with Prometheus receiver (`service.name`,
`service.instance.id`, `service. version`)

The duplicated labels on every internal metric datapoint were added for
OpenCensus backwards compatibility in open-telemetry#9029 long time ago. Given that
now the `target_info` is correctly translated to Resource attributes and
the duplication leads to
open-telemetry/opentelemetry-collector-contrib#47011,
it should be good time to remove it.

---------

Co-authored-by: Yang Song <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[service] Internal collector metrics use underscore service attrs after 0.148.0 upgrade

2 participants