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

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

Open
chattytak opened this issue Nov 11, 2024 · 1 comment

Comments

@chattytak
Copy link

chattytak commented Nov 11, 2024

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
@twz123
Copy link
Member

twz123 commented Nov 11, 2024

There was some discussion about more comprehensive examples in #3759 (comment) about a year ago. Pull requests most definitely welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants