Prometheus Metrics from an Embedded Daemon
Expose health and throughput counters from a C++ service running on a small target.
- Runs out of the box: yes
- Tests: no
- CI: no
- Docs: yes
- Used in production: no
Learning demo, not turnkey. This example is experimental: it shows an idea that works on the bench, but it has not been reviewed for production use. Expect rough edges and check with the owner before reusing it.
Purpose#
A C++ daemon that serves a plain-text metrics endpoint with a few counters (messages handled, queue depth, last error) and a readiness flag. The metrics code is a single header with no heap allocation after startup, which matters on a target with limited memory.
A sample scrape configuration and dashboard sketch show how a bench server collects metrics from several boards.
Technologies & features#
- Technologies
- C++PrometheusLinux
- Features
- Health CheckStructured Logging
- Topics
- Observability & MonitoringprimaryEmbedded/Linux
Lessons learned#
- Note
Counters are incremented from several threads with relaxed atomics; the scrape handler reads them without locks.
Try it#
git clone https://git.example.internal/embedded-platforms/metrics-daemon.git
cd metrics-daemon
cmake -S . -B build && cmake --build build
./build/daemon &
curl http://localhost:9102/metricsCommands come from the owner’s README. Credentials are never stored here.