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

Default relabelling to (.*) and $1 ? #1222

Closed
brian-brazil opened this Issue Nov 14, 2015 · 7 comments

Comments

Projects
None yet
5 participants
@brian-brazil
Copy link
Member

brian-brazil commented Nov 14, 2015

Relabelling has a lot of irreducible complexity due to the abundance of different configurations we must allow for, however I think there's some scope for making the syntax a little easier.

I propose that we default the regex to (.*) and the replacement to $1. The effect of this is that copies and setting static labels will both be much easier, both of which are very common uses.

- regex: .*
  replacement: staticvalue
  target_label: myLabel
- source_labels: [src]
  regex: (.*)
  replacement: $1
  target_label: myLabel

would become

- replacement: staticvalue
  target_label: myLabel
- source_labels: [src]
  target_label: myLabel

This is a small bit magic which may cause confusion, but overall I think it'd be a benefit.

@fabxc @beorn7 @juliusv

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Nov 14, 2015

That's a good idea 👍

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Nov 14, 2015

👍

1 similar comment
@beorn7

This comment has been minimized.

Copy link
Member

beorn7 commented Nov 15, 2015

👍

@jimmidyson

This comment has been minimized.

Copy link
Member

jimmidyson commented Nov 25, 2015

Should the default regex actually be (.+) so at least something should be present?

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Nov 25, 2015

Then the case for assigning a static value wouldn't work. No source labels are present, so the concatenated value is the empty string, .+ wouldn't mach, and the replacement would be skipped.

Did you see an issue with .* for any particular case?

@jimmidyson

This comment has been minimized.

Copy link
Member

jimmidyson commented Nov 25, 2015

Good point.

The problem was actually with Kubernetes discovery (of course ;)) where we relabel the metrics path from the service annotation, but this was setting empty path if there was no annotation. I'll update the config there instead.

Closing.

@jimmidyson jimmidyson closed this Nov 25, 2015

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.