Skip to content

[receiver/prometheusremotewrite] Align job label mapping with prometheusreceiver - #52626

Open
dashpole wants to merge 4 commits into
open-telemetry:mainfrom
dashpole:fix-prometheusremotewrite-job
Open

dashpole wants to merge 4 commits into
open-telemetry:mainfrom
dashpole:fix-prometheusremotewrite-job

Conversation

@dashpole

@dashpole dashpole commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR aligns the prometheusremotewritereceiver with the standard pull-based prometheusreceiver, ensuring that the job label is consistently mapped directly to service.name without splitting in both receivers. This prevents us from having to codify divergent receiver behaviors in the OpenTelemetry specification.

To ensure a safe migration path for existing users who rely on the legacy splitting behavior, this PR introduces an alpha feature gate receiver.prometheus_remote_write.disableJobSplit.

When this feature gate is enabled, the receiver preserves the job label as-is and maps the entire string directly to service.name, omitting service.namespace. Because it starts in the alpha stage, the gate is disabled by default, completely preserving the legacy splitting behavior. This provides a safe transition path to eventually deprecate the splitting logic.

Testing

  • Added TestParseJobAndInstanceFeatureGate to verify that when the feature gate is enabled, the job string is preserved exactly as service.name.
  • Confirmed that all existing module tests pass out-of-the-box with the feature gate disabled (the default behavior).

Documentation

Updated metadata.yaml to include the new feature gate description.

Authorship

  • I, a human, wrote this pull request description myself.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-11-09 09:54 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@dashpole
dashpole force-pushed the fix-prometheusremotewrite-job branch 6 times, most recently from cce1013 to 622236e Compare November 3, 2026 00:33
@dashpole
dashpole marked this pull request as ready for review November 3, 2026 02:51
@dashpole
dashpole requested review from a team and ArthurSens as code owners November 3, 2026 02:51
dashpole added a commit to dashpole/opentelemetry-collector-contrib that referenced this pull request Nov 3, 2026
…tests

Set from_version to v0.165.0 and reference_url to open-telemetry#52626, regenerate metadata, and expand unit and translateV2 tests for receiver.prometheus_remote_write.disableJobSplit.
@dashpole dashpole changed the title receiver/prometheusremotewrite: align job label mapping with prometheusreceiver [receiver/prometheusremotewrite] Align job label mapping with prometheusreceiver Nov 3, 2026

@himanshu130700 himanshu130700 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@dashpole
dashpole force-pushed the fix-prometheusremotewrite-job branch from 58724c9 to 28ca409 Compare November 5, 2026 14:16
@dashpole
dashpole requested a review from krajorama November 5, 2026 14:16
dashpole added a commit to dashpole/opentelemetry-collector-contrib that referenced this pull request Nov 5, 2026
…tests

Set from_version to v0.165.0 and reference_url to open-telemetry#52626, regenerate metadata, and expand unit and translateV2 tests for receiver.prometheus_remote_write.disableJobSplit.
@singhvibhanshu

Copy link
Copy Markdown
Member

Needs rebase.

@ArthurSens ArthurSens 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.

Isn't this doing the exact opposite of what is being described in open-telemetry/opentelemetry-specification#5356?

@dashpole

dashpole commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Needs rebase.

Rebased onto main.

Isn't this doing the exact opposite of what is being described in open-telemetry/opentelemetry-specification#5356?

@ArthurSens In open-telemetry/opentelemetry-specification#5356 (comment) (and #52626 (comment)), @krajorama and I agreed to treat the job / split in prometheusremotewritereceiver as an implementation bug rather than codifying it in the spec, since a valid service.name can itself contain /. open-telemetry/opentelemetry-specification#5356 just hasn't been updated yet to reflect that discussion.

dashpole added a commit to dashpole/opentelemetry-collector-contrib that referenced this pull request Nov 6, 2026
…tests

Set from_version to v0.165.0 and reference_url to open-telemetry#52626, regenerate metadata, and expand unit and translateV2 tests for receiver.prometheus_remote_write.disableJobSplit.
@dashpole
dashpole force-pushed the fix-prometheusremotewrite-job branch from 28ca409 to 754fa26 Compare November 6, 2026 20:06
@dashpole
dashpole requested a review from ArthurSens November 6, 2026 20:06
@ArthurSens

Copy link
Copy Markdown
Member

Would it be ok to proceed with this PR only once we make the appropriate change in the spec? I'd love to avoid the possibility of us making a change here and eventually disagreeing on the spec change

This introduces an alpha feature gate `receiver.prometheus_remote_write.preserveJobLabel` which, when enabled, prevents the receiver from splitting the prometheus job label into service.namespace and service.name, preserving the full job label as service.name.
…tests

Set from_version to v0.165.0 and reference_url to open-telemetry#52626, regenerate metadata, and expand unit and translateV2 tests for receiver.prometheus_remote_write.disableJobSplit.
@dashpole

dashpole commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Would it be ok to proceed with this PR only once we make the appropriate change in the spec? I'd love to avoid the possibility of us making a change here and eventually disagreeing on the spec change

@ArthurSens Since the existing spec on main doesn't specify splitting job on / (that text was only drafted in open-telemetry/opentelemetry-specification#5356 to document current receiver behavior, and @krajorama agreed above to drop it), and this PR is gated behind a default-off alpha feature gate (receiver.prometheus_remote_write.disableJobSplit), landing it now wouldn't change default behavior or lock us in if the spec discussion changes. That said, I'm also fine holding off on merging until #5356 is updated if you prefer.

@dashpole
dashpole force-pushed the fix-prometheusremotewrite-job branch from 754fa26 to d9e8777 Compare November 7, 2026 20:26

@krajorama krajorama 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

@dashpole dashpole assigned dashpole and unassigned dashpole Nov 9, 2026

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants