Skip to content

Commit

Permalink
[Grafana] Use PodMonitor instead of ServiceMonitor for the Head Node …
Browse files Browse the repository at this point in the history
…to avoid metric duplication

Signed-off-by: win5923 <[email protected]>
  • Loading branch information
win5923 committed Dec 26, 2024
1 parent 9321b2d commit e7df204
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 25 deletions.
39 changes: 39 additions & 0 deletions config/prometheus/podMonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,42 @@ spec:
relabelings:
- sourceLabels: [__meta_kubernetes_pod_label_ray_io_cluster]
targetLabel: ray_io_cluster
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
labels:
# `release: $HELM_RELEASE`: Prometheus can only detect PodMonitor with this label.
release: prometheus
name: ray-head-monitor
namespace: prometheus-system
spec:
jobLabel: ray-head
# Only select Kubernetes Pods in the "default" namespace.
namespaceSelector:
matchNames:
- default
# Only select Kubernetes Pods with "matchLabels".
selector:
matchLabels:
ray.io/node-type: head
# A list of endpoints allowed as part of this PodMonitor.
podMetricsEndpoints:
- port: metrics
relabelings:
- action: replace
sourceLabels:
- __meta_kubernetes_pod_label_ray_io_cluster
targetLabel: ray_io_cluster
- port: as-metrics # autoscaler metrics
relabelings:
- action: replace
sourceLabels:
- __meta_kubernetes_pod_label_ray_io_cluster
targetLabel: ray_io_cluster
- port: dash-metrics # dashboard metrics
relabelings:
- action: replace
sourceLabels:
- __meta_kubernetes_pod_label_ray_io_cluster
targetLabel: ray_io_cluster
25 changes: 0 additions & 25 deletions config/prometheus/serviceMonitor.yaml

This file was deleted.

0 comments on commit e7df204

Please sign in to comment.