Skip to content

The ServiceMonitor sample presented in “System components monitoring” is unfriendly. #5213

Open

Description

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: k0s
  namespace: k0s-system
spec:
  endpoints:
  - port: http
  selector:
    matchLabels:
      app: k0s-observability
      component: pushgateway
      k0s.k0sproject.io/stack: metrics

The above sample is provided, but the metrics retrieved using this sample are prefixed with “exported_”.
Example: If the original metric is job=“etcd”, then job=“k0s-pushgateway”, exported_job=“etcd”.
The job will be the actual pod name, k0s-pushgateway, and the original job name will be prefixed with “exported_”.
Therefore, it does not match the Prometheus rules provided.

I think this is an unfriendly sample.
If you add the following option, the original metrics data is retained and no replacement is performed.
Shouldn't this be a sample?

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: k0s
  namespace: k0s-system
spec:
  endpoints:
  - port: http
    honorLabels: true  <--- Add 
  selector:
    matchLabels:
      app: k0s-observability
      component: pushgateway
      k0s.k0sproject.io/stack: metrics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions