Skip to content

OTLP: Add configuration parameters to control label name translation#17345

Merged
aknuds1 merged 1 commit into
prometheus:mainfrom
aknuds1:arve/add-otlptranslator-params-with-config
Oct 22, 2025
Merged

OTLP: Add configuration parameters to control label name translation#17345
aknuds1 merged 1 commit into
prometheus:mainfrom
aknuds1:arve/add-otlptranslator-params-with-config

Conversation

@aknuds1

@aknuds1 aknuds1 commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

As a follow-up to #17344, add two configuration parameters for controlling label name translation, both defaulting to on for backwards compatibility (currently these behaviours are hardcoded as enabled):

  • otlp.label_name_underscore_sanitization => Prefix label names starting with a single underscore with key_ when translating OTel attribute names
  • otlp.label_name_preserve_multiple_underscores => Keep multiple consecutive underscores in label names when translating OTel attribute names

Which issue(s) does the PR fix:

Related to #17342, although that's in itself fixed already by #17344. This PR just makes the behaviour configurable.

Does this PR introduce a user-facing change?

[ENHANCEMENT] OTLP: Add two configuration parameters (default on): `otlp.label_name_underscore_sanitization`, which enables or disables prefixing of label names starting with a single underscore with `key_` when translating OTel attribute names, and `otlp.label_name_preserve_multiple_underscores`, which enables or disables keeping of multiple consecutive underscores in label names when translating OTel attribute names

@aknuds1
aknuds1 force-pushed the arve/add-otlptranslator-params-with-config branch from 1588af8 to d92a808 Compare October 17, 2025 10:43
@aknuds1
aknuds1 marked this pull request as draft October 17, 2025 10:48
@aknuds1
aknuds1 marked this pull request as ready for review October 17, 2025 10:54
@aknuds1
aknuds1 force-pushed the arve/add-otlptranslator-params-with-config branch 2 times, most recently from 35eb4df to 72bf5d3 Compare October 17, 2025 11:23
As a follow-up to prometheus#17344, add two configuration parameters for controlling label
name translation, both defaulting to on for backwards compatibility (currently
these behaviours are hardcoded as enabled):

* otlp.label_name_underscore_sanitization => Prefix label names starting with a
  single underscore with key_ when translating OTel attribute names
* otlp.label_name_preserve_multiple_underscores => Keep multiple consecutive
  underscores in label names when translating OTel attribute names

Signed-off-by: Arve Knudsen <[email protected]>
@aknuds1
aknuds1 force-pushed the arve/add-otlptranslator-params-with-config branch from 72bf5d3 to d28bb7e Compare October 17, 2025 11:26

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

LGTM

One single comment, the configuration option label_underscore_sanitization could probably be renamed to something closer to its behavior. We're inheriting that naming in otlptranslator because we aimed for it to be used by OTel Collector;s feature gate "DropSanitization", that already existed before we started working on otlptranslator.

This name might not be easy to understand from a Prometheus user perspective, but I'm also failing to come up with better naming 😅. Anyways, I'm not gonna block the PR because of this.

Any other suggestions @ywwg ?

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

I think the name is fine esp when coupled with the explanation. Lgtm

@aknuds1
aknuds1 merged commit ef42c08 into prometheus:main Oct 22, 2025
28 checks passed
@aknuds1
aknuds1 deleted the arve/add-otlptranslator-params-with-config branch October 22, 2025 06:27
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.

3 participants