-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Configure to promote all resource attributes except ignore ones using 'otlp.ignore_resource_attributes' #16426
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
Conversation
a325e2b
to
39be55f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks pretty solid! I've added a few comments here and there.
Before approving I'd love to get other maintainers to review the idea itself as well
config/testdata/otlp_promote_ignore_resource_attributes2.bad.yml
Outdated
Show resolved
Hide resolved
storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go
Outdated
Show resolved
Hide resolved
storage/remote/otlptranslator/prometheusremotewrite/helper_test.go
Outdated
Show resolved
Hide resolved
storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in my previous comment on the feature request, I suspect that there should still be an explicit configuration parameter for enabling promotion of all resource attributes.
Replied there #15158 (comment) |
ca9bc96
to
e27e625
Compare
Taking a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said in my previous review, I think promoting all resource attributes should have an explicit configuration parameter.
… 'ignore_resource_attributes' Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
… 'ignore_resource_attributes' Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
1ed97bc
to
37888b7
Compare
Do I understand correctly that |
@ArthurSens I haven't reviewed yet, but that sounds like the logical behaviour to me. Logically, why should |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new method for configuring the promotion of resource attributes using a new configuration field (otlp.ignore_resource_attributes) instead of the legacy promote_resource_attributes slice. The changes include updated handling in the write handler and Prometheus remote write translator, revised configuration validation and documentation updates, as well as expanded test cases to cover both the legacy and new behaviors.
- Updated write handler to use the new ResourceAttributesSetting instance.
- Added new types and logic in the Prometheus remote write translator to support promotion of all resource attributes except the ignored ones.
- Modified configuration validation, documentation, and test cases accordingly.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
storage/remote/write_handler.go | Updated configuration usage from PromoteResourceAttributes to ResourceAttributesSetting. |
storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go | Introduced ResourceAttributeAction, ResourceAttributesSetting, and related helper functions. |
storage/remote/otlptranslator/prometheusremotewrite/helper_test.go | Updated test cases to reflect the changes in resource attribute promotion configuration. |
storage/remote/otlptranslator/prometheusremotewrite/helper.go | Refactored label creation to use the new ResourceAttributesSetting and added a call to reset the setting. |
docs/configuration/configuration.md | Revised documentation to include new configuration fields and usage guidelines. |
config/* | Updated configuration structure, validation, and test files to support the new resource attribute promotion logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting my review. You'll have to fix the merge conflict at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my suggestions for a solution that's both easier to reason about and diverges less from the original code (i.e., reduces the amount of changes).
storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go
Outdated
Show resolved
Hide resolved
storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go
Outdated
Show resolved
Hide resolved
storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go
Outdated
Show resolved
Hide resolved
storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
Signed-off-by: Antonio Jimenez <123171955+antonjim-te@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors resource attribute promotion by introducing a new PromoteResourceAttributes type and associated logic, allowing users to configure promotion of all resource attributes (with the option to ignore specific ones) while enforcing mutual exclusivity with the previous promote_resource_attributes configuration.
- Updated the write handler to use a constructor for PromoteResourceAttributes.
- Adjusted tests and documentation to reflect the new pointer‐based configuration and mutual exclusive validations.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
storage/remote/write_handler.go | Refactored to use the new PromoteResourceAttributes constructor. |
storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go | Introduced the new PromoteResourceAttributes type and updated settings handling. |
storage/remote/otlptranslator/prometheusremotewrite/helper_test.go | Updated test cases to work with the pointer-based PromoteResourceAttributes. |
storage/remote/otlptranslator/prometheusremotewrite/helper.go | Replaced the manual loop with a call to the promotedAttributes method. |
docs/configuration/configuration.md | Documented the new configuration fields and clarified their mutually exclusive usage. |
config/* | Updated configuration validation and tests to enforce exclusivity between promotion and ignore settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please revert the changes to the existing test cases in storage/remote/otlptranslator/prometheusremotewrite/helper_test.go
? The PR should not change pre-existing test cases. Just add the test case fields I suggest, and modify the creation of Settings
to use NewPromoteResourceAttributes
accordingly instead.
storage/remote/otlptranslator/prometheusremotewrite/helper_test.go
Outdated
Show resolved
Hide resolved
storage/remote/otlptranslator/prometheusremotewrite/helper_test.go
Outdated
Show resolved
Hide resolved
storage/remote/otlptranslator/prometheusremotewrite/helper_test.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better now, but some issues still remain - please see suggestions.
storage/remote/otlptranslator/prometheusremotewrite/helper_test.go
Outdated
Show resolved
Hide resolved
storage/remote/otlptranslator/prometheusremotewrite/helper_test.go
Outdated
Show resolved
Hide resolved
storage/remote/otlptranslator/prometheusremotewrite/helper_test.go
Outdated
Show resolved
Hide resolved
storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one small nit
Signed-off-by: Antonio Jimenez <antonjim@thousandEyes.com>
@aknuds1 could you please take a look at the PR? Thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
Fixes #15158
Configure to promote all resource attributes except ignore ones using new config field
'otlp.ignore_resource_attributes'
It cannot be configured simultaneously with
'promote_resource_attributes'
. Default stay as it is today to not promote any resource attribute.You can now promote all resource attributes by setting
otlp.ignore_resource_attributes: []