Reputation: 87
I have a requirement to add certain labels to metric, so grafana can filter based on its value. I am wondering if there is a way to do it in the ServiceMonitor, so that I dont need to change the code in my springboot project.
Upvotes: 2
Views: 2835
Reputation: 87
My final solution is adding a metricRelabelings under endpoints in ServiceMonitor.
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
...
spec:
...
endpoints:
- ...
metricRelabelings:
- separator: ;
regex: (.*)
targetLabel: LABLE_NAME
replacement: VALUE
action: replace
Upvotes: 2