Skip to content

Commit 346d778

Browse files
authored
Enabled the cpu utilization and logical count metrics (#1010)
* chore: added the cpu utilization metrics * chore: enable cpu metrics * chore: graphana
1 parent 6589cba commit 346d778

File tree

3 files changed

+208
-0
lines changed

3 files changed

+208
-0
lines changed

internal/collector/otelcol.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ receivers:
77
{{- if .Receivers.HostMetrics.Scrapers }}
88
{{- if .Receivers.HostMetrics.Scrapers.CPU }}
99
cpu:
10+
metrics:
11+
system.cpu.utilization:
12+
enabled: true
13+
system.cpu.logical.count:
14+
enabled: true
1015
{{- end }}
1116
{{- if .Receivers.HostMetrics.Scrapers.Disk }}
1217
disk:

test/config/collector/test-opentelemetry-collector-agent.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ receivers:
44
initial_delay: 1s
55
scrapers:
66
cpu:
7+
metrics:
8+
system.cpu.utilization:
9+
enabled: true
10+
system.cpu.logical.count:
11+
enabled: true
712
disk:
813
filesystem:
914
memory:

test/mock/collector/grafana/provisioning/dashboards/host-metrics.json

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,204 @@
415415
],
416416
"title": "System Network IO",
417417
"type": "timeseries"
418+
},
419+
{
420+
"datasource": {
421+
"type": "prometheus",
422+
"uid": "otel-prometheus-scraper"
423+
},
424+
"fieldConfig": {
425+
"defaults": {
426+
"color": {
427+
"mode": "palette-classic"
428+
},
429+
"custom": {
430+
"axisBorderShow": false,
431+
"axisCenteredZero": false,
432+
"axisColorMode": "text",
433+
"axisLabel": "",
434+
"axisPlacement": "auto",
435+
"barAlignment": 0,
436+
"drawStyle": "line",
437+
"fillOpacity": 0,
438+
"gradientMode": "none",
439+
"hideFrom": {
440+
"legend": false,
441+
"tooltip": false,
442+
"viz": false
443+
},
444+
"insertNulls": false,
445+
"lineInterpolation": "linear",
446+
"lineWidth": 1,
447+
"pointSize": 5,
448+
"scaleDistribution": {
449+
"type": "linear"
450+
},
451+
"showPoints": "auto",
452+
"spanNulls": false,
453+
"stacking": {
454+
"group": "A",
455+
"mode": "none"
456+
},
457+
"thresholdsStyle": {
458+
"mode": "off"
459+
}
460+
},
461+
"mappings": [],
462+
"thresholds": {
463+
"mode": "absolute",
464+
"steps": [
465+
{
466+
"color": "green",
467+
"value": null
468+
},
469+
{
470+
"color": "red",
471+
"value": 80
472+
}
473+
]
474+
}
475+
},
476+
"overrides": []
477+
},
478+
"gridPos": {
479+
"h": 8,
480+
"w": 12,
481+
"x": 12,
482+
"y": 8
483+
},
484+
"id": 6,
485+
"options": {
486+
"legend": {
487+
"calcs": [],
488+
"displayMode": "list",
489+
"placement": "bottom",
490+
"showLegend": true
491+
},
492+
"tooltip": {
493+
"mode": "single",
494+
"sort": "none"
495+
}
496+
},
497+
"targets": [
498+
{
499+
"datasource": {
500+
"type": "prometheus",
501+
"uid": "otel-prometheus-scraper"
502+
},
503+
"disableTextWrap": false,
504+
"editorMode": "builder",
505+
"expr": "system_cpu_utilization",
506+
"fullMetaSearch": false,
507+
"includeNullMetadata": false,
508+
"instant": false,
509+
"legendFormat": "__auto",
510+
"range": true,
511+
"refId": "A",
512+
"useBackend": false
513+
}
514+
],
515+
"title": "System CPU Utilization",
516+
"type": "timeseries"
517+
},
518+
{
519+
"datasource": {
520+
"type": "prometheus",
521+
"uid": "otel-prometheus-scraper"
522+
},
523+
"fieldConfig": {
524+
"defaults": {
525+
"color": {
526+
"mode": "palette-classic"
527+
},
528+
"custom": {
529+
"axisBorderShow": false,
530+
"axisCenteredZero": false,
531+
"axisColorMode": "text",
532+
"axisLabel": "",
533+
"axisPlacement": "auto",
534+
"barAlignment": 0,
535+
"drawStyle": "line",
536+
"fillOpacity": 0,
537+
"gradientMode": "none",
538+
"hideFrom": {
539+
"legend": false,
540+
"tooltip": false,
541+
"viz": false
542+
},
543+
"insertNulls": false,
544+
"lineInterpolation": "linear",
545+
"lineWidth": 1,
546+
"pointSize": 5,
547+
"scaleDistribution": {
548+
"type": "linear"
549+
},
550+
"showPoints": "auto",
551+
"spanNulls": false,
552+
"stacking": {
553+
"group": "A",
554+
"mode": "none"
555+
},
556+
"thresholdsStyle": {
557+
"mode": "off"
558+
}
559+
},
560+
"mappings": [],
561+
"thresholds": {
562+
"mode": "absolute",
563+
"steps": [
564+
{
565+
"color": "green",
566+
"value": null
567+
},
568+
{
569+
"color": "red",
570+
"value": 80
571+
}
572+
]
573+
}
574+
},
575+
"overrides": []
576+
},
577+
"gridPos": {
578+
"h": 8,
579+
"w": 12,
580+
"x": 0,
581+
"y": 8
582+
},
583+
"id": 7,
584+
"options": {
585+
"legend": {
586+
"calcs": [],
587+
"displayMode": "list",
588+
"placement": "bottom",
589+
"showLegend": true
590+
},
591+
"tooltip": {
592+
"mode": "single",
593+
"sort": "none"
594+
}
595+
},
596+
"targets": [
597+
{
598+
"datasource": {
599+
"type": "prometheus",
600+
"uid": "otel-prometheus-scraper"
601+
},
602+
"disableTextWrap": false,
603+
"editorMode": "builder",
604+
"expr": "system_cpu_logical_count",
605+
"fullMetaSearch": false,
606+
"includeNullMetadata": true,
607+
"instant": false,
608+
"legendFormat": "__auto",
609+
"range": true,
610+
"refId": "A",
611+
"useBackend": false
612+
}
613+
],
614+
"title": "System CPU Logical Count",
615+
"type": "timeseries"
418616
}
419617
],
420618
"refresh": "",

0 commit comments

Comments
 (0)