Skip to content

Commit 1dc31d0

Browse files
[otel-col] Add host metrics receiver (#1675)
* feat: add hostmetrics receiver for docker deployment * chore: add changelog entry * Update src/otelcollector/otelcol-config.yml Co-authored-by: Juliano Costa <[email protected]> * enable hostmetrics memory utilization metric --------- Co-authored-by: Juliano Costa <[email protected]>
1 parent 9b5478b commit 1dc31d0

File tree

5 files changed

+66
-1
lines changed

5 files changed

+66
-1
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ TRACETEST_IMAGE=kubeshop/tracetest:v1.3.0
2222
ENV_PLATFORM=local
2323

2424
# OpenTelemetry Collector
25+
HOST_FILESYSTEM=/
2526
DOCKER_SOCK=/var/run/docker.sock
2627
OTEL_COLLECTOR_HOST=otelcol
2728
OTEL_COLLECTOR_PORT_GRPC=4317

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ the release.
1919
([#1666](https://github.com/open-telemetry/opentelemetry-demo/pull/1666))
2020
* [frontend] Update nodejs to latest LTS and bump dependencies
2121
([#1670](https://github.com/open-telemetry/opentelemetry-demo/pull/1670))
22+
* [otel-col] Add host metrics receiver
23+
([#1675](https://github.com/open-telemetry/opentelemetry-demo/pull/1675))
2224

2325
## 1.11.0
2426

docker-compose.minimal.yml

+2
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ services:
585585
command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ]
586586
user: 0:0
587587
volumes:
588+
- ${HOST_FILESYSTEM}:/hostfs:ro
588589
- ${DOCKER_SOCK}:/var/run/docker.sock:ro
589590
- ${OTEL_COLLECTOR_CONFIG}:/etc/otelcol-config.yml
590591
- ${OTEL_COLLECTOR_CONFIG_EXTRAS}:/etc/otelcol-config-extras.yml
@@ -596,6 +597,7 @@ services:
596597
logging: *logging
597598
environment:
598599
- ENVOY_PORT
600+
- HOST_FILESYSTEM
599601
- OTEL_COLLECTOR_HOST
600602
- OTEL_COLLECTOR_PORT_GRPC
601603
- OTEL_COLLECTOR_PORT_HTTP

docker-compose.yml

+2
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ services:
695695
command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ]
696696
user: 0:0
697697
volumes:
698+
- ${HOST_FILESYSTEM}:/hostfs:ro
698699
- ${DOCKER_SOCK}:/var/run/docker.sock:ro
699700
- ${OTEL_COLLECTOR_CONFIG}:/etc/otelcol-config.yml
700701
- ${OTEL_COLLECTOR_CONFIG_EXTRAS}:/etc/otelcol-config-extras.yml
@@ -706,6 +707,7 @@ services:
706707
logging: *logging
707708
environment:
708709
- ENVOY_PORT
710+
- HOST_FILESYSTEM
709711
- OTEL_COLLECTOR_HOST
710712
- OTEL_COLLECTOR_PORT_GRPC
711713
- OTEL_COLLECTOR_PORT_HTTP

src/otelcollector/otelcol-config.yml

+59-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,64 @@ receivers:
2121
endpoint: "valkey-cart:6379"
2222
username: "valkey"
2323
collection_interval: 10s
24+
# Host metrics
25+
hostmetrics:
26+
root_path: /hostfs
27+
scrapers:
28+
cpu:
29+
metrics:
30+
system.cpu.utilization:
31+
enabled: true
32+
disk:
33+
load:
34+
filesystem:
35+
exclude_mount_points:
36+
mount_points:
37+
- /dev/*
38+
- /proc/*
39+
- /sys/*
40+
- /run/k3s/containerd/*
41+
- /var/lib/docker/*
42+
- /var/lib/kubelet/*
43+
- /snap/*
44+
match_type: regexp
45+
exclude_fs_types:
46+
fs_types:
47+
- autofs
48+
- binfmt_misc
49+
- bpf
50+
- cgroup2
51+
- configfs
52+
- debugfs
53+
- devpts
54+
- devtmpfs
55+
- fusectl
56+
- hugetlbfs
57+
- iso9660
58+
- mqueue
59+
- nsfs
60+
- overlay
61+
- proc
62+
- procfs
63+
- pstore
64+
- rpc_pipefs
65+
- securityfs
66+
- selinuxfs
67+
- squashfs
68+
- sysfs
69+
- tracefs
70+
match_type: strict
71+
memory:
72+
metrics:
73+
system.memory.utilization:
74+
enabled: true
75+
network:
76+
paging:
77+
processes:
78+
process:
79+
mute_process_exe_error: true
80+
mute_process_io_error: true
81+
mute_process_user_error: true
2482
# Collector metrics
2583
prometheus:
2684
config:
@@ -68,7 +126,7 @@ service:
68126
processors: [transform, batch]
69127
exporters: [otlp, debug, spanmetrics]
70128
metrics:
71-
receivers: [docker_stats, httpcheck/frontendproxy, otlp, prometheus, redis, spanmetrics]
129+
receivers: [hostmetrics, docker_stats, httpcheck/frontendproxy, otlp, prometheus, redis, spanmetrics]
72130
processors: [batch]
73131
exporters: [otlphttp/prometheus, debug]
74132
logs:

0 commit comments

Comments
 (0)