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

allow same metric name #160

Open
frenkye opened this issue Jul 29, 2021 · 2 comments
Open

allow same metric name #160

frenkye opened this issue Jul 29, 2021 · 2 comments

Comments

@frenkye
Copy link

frenkye commented Jul 29, 2021

Hi,

tried to find out if this was somewhere discused or I'am doing something wrong. Is there any reason why can we reuse metric name?

Getting error:
Invalid metric configuration: metric '<metricName>' defined twice

This should not be a problem, if labels differ like event or message, becase you can't have 2 metric with same labels in output, that would be a problem.

In our use case we have multiple patterns on few log files and now we have to have for each pattern diffrent metric which mean we have to have diffrent alert for each pattern a list go on. While if we could reuse metric name, but differ by labels we could have few alerts and adding new pattern to grok, will be much easier.

@fstab
Copy link
Owner

fstab commented Aug 9, 2021

One thing you can try is to create a single pattern that matches all cases. For example, if you have

- type: counter
  name: my_metric
  match: pattern1
  ...

and

- type: counter
  name: my_metric
  match: pattern2
  ...

you could convert this to

- type: counter
  name: my_metric
  match: pattern1|pattern2
  ...

@frenkye
Copy link
Author

frenkye commented Sep 25, 2021

I know that is possible, but this doesn't allow for custom message per match.

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

No branches or pull requests

2 participants