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

Renaming metrics with match_type Regex? #480

Open
na-wu opened this issue Jan 9, 2023 · 1 comment
Open

Renaming metrics with match_type Regex? #480

na-wu opened this issue Jan 9, 2023 · 1 comment

Comments

@na-wu
Copy link

na-wu commented Jan 9, 2023

Curious if there's a way to dynamically rename metrics matched by regex in the same deterministic way it's done via glob matching

For example:

- match: "old.metric1.*.*.*"
   name: "new_metric_name_${1}_${2}_${3}"

What I mean by deterministic is that we know how many wildcards are matched, so I know how many variables I can use

My question is whether the same can be done with Regex when the number of matching wildcards is unknown, for example:

- match: "old(\\.(\\w+)+)"
   match_type: regex

should match
old.metric
old.metric.var1
old.metric.var1.var2

I want to rename these metrics to
new_metric
new_metric_var1
new_metric_var1_var2

Is this possible?

Thanks

@matthiasr
Copy link
Contributor

There is no way to do this currently. To be honest, I am learning today that unbounded match groups are possible 😂

I would like to avoid reinventing syntax for this. Is there an example of regular expression "search and replace" that supports this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants