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

*: MetricRelabelings feature KubeDB managed ServiceMonitors #1

Open
tamalsaha opened this issue Jul 3, 2024 · 1 comment
Open

*: MetricRelabelings feature KubeDB managed ServiceMonitors #1

tamalsaha opened this issue Jul 3, 2024 · 1 comment

Comments

@tamalsaha
Copy link
Member

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:

metrics:
  serviceMonitor:
    metricRelabelings:
       - action: keep
         regex: (mysql_global_status_aborted_clients|....)
         sourceLabels:
           - __name__

So in your case the metricRelabelings should be definiable in here:

$ kubectl explain mysql.spec.monitor.prometheus.serviceMonitor
GROUP:      [kubedb.com](http://kubedb.com/)
KIND:       MySQL
VERSION:    v1alpha2

FIELD: serviceMonitor <Object>

DESCRIPTION:
    <empty>
FIELDS:
  interval      <string>
  labels        <map[string]string>
@tamalsaha
Copy link
Member Author

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

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

1 participant