-
Notifications
You must be signed in to change notification settings - Fork 254
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
New loki.process stage structured_metadata_regex, to move all labels matching a regex to structured metadata #2578
Conversation
…matching a regex to structured metadata
Thank you for the PR! I personally would prefer if there is a new optional argument in the |
Hey, to add to @ptodev's comment, I would recommend adding a stage "label_extract" to move labels to the extracted values map. This way you can combine it with the structured_metadata stage; and any other processing stages since most of them can interact with the extracted values map. |
Yes, just like the |
To add a But the current Should the Unlike adding |
@akevdmeer the structured_metadata should only process data from the extracted map. To move values from labels to the extracted map you should create a new stage "label_extract" |
Clear. But that means that in addition to supporting |
Aaah sorry I missed this behavior. This is undocumented, I thought that the structured_metadata step was only processing the data from the extracted map and not the labels... Thanks for clarifying. That leaves us with two options:
I think that the first option offers more modularity + simpler logic. But it's a breaking change (of undocumented behavior but still annoying if a lot of users rely on it) + the new "label_extract" stage would need to be of stability GA right away to avoid forcing users to lower their stability level to achieve the same behavior. Which options do you prefer? @akevdmeer @ptodev |
Discussed in our proposal review meeting today, we think that the option to not do breaking changes to the structured_metadata stage is the best. We're ok to have an argument "regex" which will match with the extracted values map and the labels. Ideally it would be nice to have the possibility to modify the label name (like the |
Shall we close this PR, and I'll open a new one with the implementation as discussed above? |
yeah sounds good, you can link this PR in the new PR to keep the context. Thanks for your work, let us know if you need help! |
PR Description
This adds a stage to loki.process
structured_metadata_regex
, that takes a string attrregex
, e.g.All labels that match the regular expression are moved to structured metadata (so removed as labels).
Which issue(s) this PR fixes
Fixes #926
Notes to the Reviewer
Please advise:
Is it reasonable to introduce a new loki.process stage for this?
I considered extending
loki.relabel
but that is a Loki wrapper around prometheus relabel so I decided against that. Then I considered extending the existingstructured_metadata
stage ofloki.process
, but also decided against that to not modify/embed the existingLabelsConfig
.Happy to re-work this per your guidance to get this feature merged.
PR Checklist