Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change otlp attribute conversion to be consistent with prometheus #6272

Conversation

SungJin1212
Copy link
Member

@SungJin1212 SungJin1212 commented Oct 16, 2024

Change otlp handler to consist with the prometheus otlp handler.

Changes are as follows:

  • Enable target_info metric by default, it is only disabled when distributor.otlp-config.disable-target-info is true.
  • Add -distributor.otlp-config.convert-all-attributes flag to retain the existing behavior (always convert all metric attributes)
  • Add a per tenant config distributor.promote-resource-attributes to specify promte resource attributes for each tenants. It works only if distributor.otlp-config.convert-all-attributes is false.

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

Checklist

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

@SungJin1212 SungJin1212 force-pushed the Change-otlp-handler-to-consist-with-prometheus branch from a42d813 to 633baf5 Compare October 16, 2024 07:55
@SungJin1212
Copy link
Member Author

@yeya24
Could you review it when you time have?

CHANGELOG.md Outdated
@@ -9,6 +9,7 @@
* [FEATURE] Ruler: Minimize chances of missed rule group evaluations that can occur due to OOM kills, bad underlying nodes, or due to an unhealthy ruler that appears in the ring as healthy. This feature is enabled via `-ruler.enable-ha-evaluation` flag. #6129
* [FEATURE] Store Gateway: Add an in-memory chunk cache. #6245
* [FEATURE] Chunk Cache: Support multi level cache and add metrics. #6249
* [ENHANCEMENT] OTLP: Change otlp handler to consist with the Prometheus otlp handler. #6272
Copy link
Contributor

@yeya24 yeya24 Oct 19, 2024

Choose a reason for hiding this comment

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

Let's be more specific about the change. I can see 3 main changes:

  • By default we don't convert all attributes to labels. This is a change
  • Target info will be behind a FF. Enabled by default.
  • New config to specify promote_resource_attributes per tenant

@SungJin1212
Copy link
Member Author

@yeya24
Thanks for the review. Doesn't the DisableTargetInfo flag need to be set per user?

@yeya24
Copy link
Contributor

yeya24 commented Oct 20, 2024

I think it needs to be consistent with the disable convert all attributes flag. If that flag is not per tenant then target info shouldn't be per tenant.

If our intended behavior is to be consistent with Prometheus then I think it makes more sense to be global and not per tenant. Only resource attribute promotion is per tenant and it should be only valid if all attributes conversion is disabled

@SungJin1212 SungJin1212 force-pushed the Change-otlp-handler-to-consist-with-prometheus branch 3 times, most recently from 77f9e92 to 878f14e Compare October 24, 2024 01:58
@yeya24 yeya24 changed the title Change otlp attribute conversion to consist with prometheus Change otlp attribute conversion to be consistent with prometheus Oct 24, 2024
@SungJin1212 SungJin1212 force-pushed the Change-otlp-handler-to-consist-with-prometheus branch 2 times, most recently from 3bc34b2 to 0230822 Compare October 25, 2024 08:04
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Great work! I like the implementation. Thanks for updating the tests!
Just some nits.

@@ -188,6 +196,9 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {

f.Float64Var(&cfg.InstanceLimits.MaxIngestionRate, "distributor.instance-limits.max-ingestion-rate", 0, "Max ingestion rate (samples/sec) that this distributor will accept. This limit is per-distributor, not per-tenant. Additional push requests will be rejected. Current ingestion rate is computed as exponentially weighted moving average, updated every second. 0 = unlimited.")
f.IntVar(&cfg.InstanceLimits.MaxInflightPushRequests, "distributor.instance-limits.max-inflight-push-requests", 0, "Max inflight push requests that this distributor can handle. This limit is per-distributor, not per-tenant. Additional requests will be rejected. 0 = unlimited.")

f.BoolVar(&cfg.OTLPConfig.ConvertAllAttributes, "distributor.otlp-config.convert-all-attributes", false, "If enabled, all resource attributes are converted to labels.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just simplify the flag name to be distributor.otlp.xxx?

@@ -188,6 +196,9 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {

f.Float64Var(&cfg.InstanceLimits.MaxIngestionRate, "distributor.instance-limits.max-ingestion-rate", 0, "Max ingestion rate (samples/sec) that this distributor will accept. This limit is per-distributor, not per-tenant. Additional push requests will be rejected. Current ingestion rate is computed as exponentially weighted moving average, updated every second. 0 = unlimited.")
f.IntVar(&cfg.InstanceLimits.MaxInflightPushRequests, "distributor.instance-limits.max-inflight-push-requests", 0, "Max inflight push requests that this distributor can handle. This limit is per-distributor, not per-tenant. Additional requests will be rejected. 0 = unlimited.")

f.BoolVar(&cfg.OTLPConfig.ConvertAllAttributes, "distributor.otlp-config.convert-all-attributes", false, "If enabled, all resource attributes are converted to labels.")
f.BoolVar(&cfg.OTLPConfig.DisableTargetInfo, "distributor.otlp-config.disable-target-info", false, "If enabled, a target_info metric is not ingested.")
Copy link
Contributor

Choose a reason for hiding this comment

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

How about If true, target_info metric is not ingested.?
If enabled might be a bit confusing to users.

I suggest we describe what target_info metric does or put some relevant links to Opentelemetry

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, Adding a link explaining what target_info is would be good.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 4, 2024
CHANGELOG.md Outdated
@@ -12,6 +12,7 @@
* [ENHANCEMENT] S3 Bucket Client: Add a list objects version configs to configure list api object version. #6280
* [ENHANCEMENT] Query Frontend: Add new query stats metrics `cortex_query_samples_scanned_total` and `cortex_query_peak_samples` to track scannedSamples and peakSample per user. #6228
* [ENHANCEMENT] Ingester: Disable chunk trimming. #6270
* [ENHANCEMENT] OTLP: Change otlp handler to consist with the Prometheus otlp handler. Enable `target_info` metric and disable convert all attributes to labels by default. Add a config to specify promote resource attributes for tenants. #6272
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a change instead of an enhancement.

@SungJin1212 SungJin1212 force-pushed the Change-otlp-handler-to-consist-with-prometheus branch from 0230822 to 2942e00 Compare November 4, 2024 09:26
@SungJin1212
Copy link
Member Author

@yeya24
Thanks for the review and good comments.
I have applied your comments.

@SungJin1212 SungJin1212 force-pushed the Change-otlp-handler-to-consist-with-prometheus branch 5 times, most recently from 6f53a03 to c04f607 Compare November 5, 2024 01:10
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Just a small comment about changelog. We can merge this after!

@SungJin1212 SungJin1212 force-pushed the Change-otlp-handler-to-consist-with-prometheus branch 2 times, most recently from 18dad00 to 4f43226 Compare November 5, 2024 06:05
@SungJin1212 SungJin1212 force-pushed the Change-otlp-handler-to-consist-with-prometheus branch from 4f43226 to fcd9f51 Compare November 5, 2024 06:11
@yeya24 yeya24 merged commit 2e5488a into cortexproject:master Nov 5, 2024
16 checks passed
CharlieTLe pushed a commit to CharlieTLe/cortex that referenced this pull request Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/distributor lgtm This PR has been approved by a maintainer size/L
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

OTLP handler inconsistent behavior with Prometheus OTLP handler
2 participants