Skip to content

Commit 42a1d4e

Browse files
Added the demo on how to query metrics
Signed-off-by: Shivansh Bhatnagar <shivansh.bhatnagar.mat22@itbhu.ac.in>
1 parent 5ac3439 commit 42a1d4e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

docs/reference/instrumentation/metrics.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,50 @@ title: Karmada Metrics Reference
77
This section details the metrics that different Karmada components export.
88
You can query the metrics endpoint for these components using an HTTP scrape, and fetch the current metrics data in Prometheus format.
99

10+
### Step 1: Expose Karmada Metrics
11+
Ensure Karmada components are configured to expose metrics. By default, Karmada components expose metrics at endpoints like /metrics. Verify this in your configuration.
12+
13+
### Step 2: Set Up Prometheus
14+
Prometheus should be configured to scrape metrics from Karmada components.
15+
16+
#### prometheus.yml:
17+
```yml
18+
scrape_configs:
19+
- job_name: 'karmada-controller-manager'
20+
static_configs:
21+
- targets: ['karmada-controller-manager.karmada-system.svc:8080']
22+
23+
- job_name: 'karmada-scheduler'
24+
static_configs:
25+
- targets: ['karmada-scheduler.karmada-system.svc:8080']
26+
27+
- job_name: 'karmada-agent'
28+
static_configs:
29+
- targets: ['karmada-agent.karmada-system.svc:8080']
30+
```
31+
### Step 3: Query Metrics in Prometheus
32+
After setting up Prometheus, you can query Karmada metrics.
33+
34+
#### Example Queries:
35+
36+
Karmada Controller Manager Reconciliation Loops:
37+
38+
```promql
39+
karmada_controller_resource_match_policy_duration_seconds
40+
```
41+
This metric tracks the duration in seconds to find a matched propagation policy for the resource template.
42+
43+
Karmada Scheduler Scheduling Latency:
44+
```promql
45+
karmada_scheduler_schedule_attempts_total
46+
```
47+
This metric gives the number of attempts to schedule resourceBinding.
48+
49+
Cluster Health Metrics:
50+
```promql
51+
karmada_agent_cluster_node_number
52+
```
53+
This metric gives the number of nodes in the cluster.
1054

1155

1256
### List of karmada-scheduler metrics

0 commit comments

Comments
 (0)