Open tamalsaha opened 5 months ago
Historically, we have avoided making the service monitor too customizable because I am worried the the MySQL crd will become an amalgamation of both MySQL and ServiceMonitor crds. What we have recommended users to do is this:
Create the MySQL crd with the monitoring agent "prometheus.io" instead of "prometheus.io/operator". This will inject the prometheus exporter sidecar but not create the ServiceMonitor. Then users can create the ServiceMonitor separately and use all the fields from the ServiceMonitor crd that they seem fit.
apiVersion: kubedb.com/v1alpha2
kind: MySQL
metadata:
name: coreos-prom-mysql
namespace: demo
spec:
version: "8.0.35"
terminationPolicy: WipeOut
storage:
storageClassName: "standard"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
monitor:
agent: [prometheus.io](http://prometheus.io/)
prometheus:
serviceMonitor:
labels:
release: prometheus
interval: 10s
We have been cleaning up our metrics from prometheus and I found out that we are not able to define metricRelabelings for service monitor created by kubedb mysql. It would be great to have that feature.
E.g. in bitnami mysql helm chart you can see an implementation example. There is metrics.serviceMonitor.metricRelabelings value available which can be defined as follows:
So in your case the metricRelabelings should be definiable in here: