grok_exporter
grok_exporter copied to clipboard
allow same metric name
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.
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
...
I know that is possible, but this doesn't allow for custom message per match.