Skip to content

Conversation

@SungJin1212
Copy link
Member

@SungJin1212 SungJin1212 commented Oct 30, 2025

Add a per-tenant flag -distributor.enable-type-and-unit-labels which enables to add __unit__ and __type__ labels for remote write v2 and OTLP requests.

Which issue(s) this PR fixes:
Fixes #7059

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@dosubot dosubot bot added the type/feature label Oct 30, 2025
@SungJin1212 SungJin1212 force-pushed the Add-type-and-unit-labels-to-prw2 branch from c14d273 to 5ab3a6a Compare October 30, 2025 06:06
# EXPERIMENTAL: If true, the __type__ and __unit__ labels are added to metrics.
# This only applies to remote write v2 requests.
# CLI flag: -distributor.rw2-enable-type-and-unit-labels
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to mention rw2 in the config name? I would align the config name with Prometheus and callout that this feature is only for RW2 in the description.

Copy link
Member Author

Choose a reason for hiding this comment

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

Then this flag has same name with the -distributor.otlp.enable-type-and-unit-labels field. Doesn't it matter?

Copy link
Contributor

Choose a reason for hiding this comment

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

My concern is that users don't know what rw2 means. We should avoid using abbreviations in the config name. I think it should be ok to use 1 flag to control both. Maybe we can unify to be distributor.enable-type-and-unit-labels?

Copy link
Member Author

Choose a reason for hiding this comment

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

I add -distributor.enable-type-and-unit-labels flag which works for OTLP and PRW2. I think this PR should be included in version 1.20.

CHANGELOG.md Outdated
* [FEATURE] Querier: Support for configuring query optimizers and enabling XFunctions in the Thanos engine. #6873
* [FEATURE] Query Frontend: Add support /api/v1/format_query API for formatting queries. #6893
* [FEATURE] Query Frontend: Add support for /api/v1/parse_query API (experimental) to parse a PromQL expression and return it as a JSON-formatted AST (abstract syntax tree). #6978
* [FEATURE] Distributor: Add a per-tenant flag `-distributor.rw2-enable-type-and-unit-labels` which enables to add `__unit__` and `__type__` labels for remote write v2 requests. #7077
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please move the changelog to unreleased section?

Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
@SungJin1212 SungJin1212 force-pushed the Add-type-and-unit-labels-to-prw2 branch from 5ab3a6a to bacadc7 Compare November 1, 2025 23:26
Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
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.

PRW2: support type and unit labels

2 participants