Metrics from a robot behind a home router
You will: Get metrics off a robot into one place, and avoid the traps that make a working pipeline show nothing.
Builds on Alive is not the same as ready.
A robot that only tells you things while you are watching is a robot you cannot debug. The failures that matter happen at 2 a.m., once, and do not reproduce.
Robots push metrics; nothing scrapes them, for the reasons the deployment lesson gave. They use OTLP, the OpenTelemetry protocol, chosen for one property: instrument once, and the backend becomes swappable by editing a collector config. The robot builds OTLP's JSON form with the standard library. The official SDK was measured and declined — about 20 MB and a dozen packages, on an image that had just been cut to a third of its size.
The honest cost: no traces. Tracing is what the SDK is genuinely good at, and a trace across perception, planning and action is exactly what you would want to answer "why did it do that". When that is needed, the dependency will have earned itself. Metrics did not need it.
Three traps, all hit here. Names are translated. The collector
rewrites threevn.robot.ready into a Prometheus-style name with a
suffix derived from its unit and type. The first dashboard queried the
original names and every panel was empty — a working pipeline behind a
dashboard showing nothing. Units are load-bearing: a count of
controllers declared with unit 1 arrived with a _ratio suffix,
which is simply wrong. Labels can vanish: without one setting, the
robot's id, commit and version are dropped, and every robot looks the
same. And Grafana's datasource must declare an explicit id, or a
provisioned dashboard points at one that does not exist.
The stack runs on its own small server, because monitoring that dies with the host it monitors tells you nothing when you need it. Grafana is reachable only through an SSH tunnel: no public login page, nothing to brute force. The collector's memory limiter is first in its pipeline, so under load it refuses data rather than being killed.
There is no alerting yet, on purpose. Alerts belong once there is a robot whose normal behaviour is known. Alerting on a system with no baseline mostly produces noise, and an alarm that cries wolf gets switched off. When it comes, it will watch readiness, not liveness.
In the simulation
No metrics leave this page, but the idea is the same: what happened is only knowable later if it was kept while it happened. Watch the readings a dashboard would turn into metrics, record a run, and play it back after you have looked away.
Kinematic: joints move at their real speed limit, but there is no gravity, no load and no physics. That is what the steps below are for.
The SO-101 loads as you reach it.
make drive keysIn this lesson
- Open Inspect, then /joint_states. These positions and velocities are what the robot reports about itself.
- Press Record, jog a few joints, and press Record again to stop.
- Home the arm, then press Replay and watch the run you were not watching come back.
Joints · SO-101 follower
1–5 joint · , . jog · [ ] jaw · - + step · h home · f frames
the keys of make drive
The buttons do what the keys do: hold one to repeat.
Limits from the description; speed capped at 1.7434 rad/s, the servo's datasheet derated. Poses from the profile.
Inspector
Code
The repository's own code behind what you do here appears once you move the arm.
Do it
Bring the monitoring stack up locally.
cd monitoring && docker compose up -d && cd .. docker compose -f monitoring/compose.yml psExpect: Three containers up, VictoriaMetrics
healthy. The collector has no health status on purpose — its image has no shell to run a check with — so ask it from a neighbour:docker compose -f monitoring/compose.yml exec victoriametrics wget -qO- http://collector:13133/answers"Server available".With
make mockrunning, start a dashboard that pushes to it. From inside the container, your machine ishost.docker.internal.make shell THREEVN_OTLP_ENDPOINT=http://host.docker.internal:4318/v1/metrics THREEVN_OTLP_INTERVAL=5 ros2 launch threevn_dashboard dashboard.launch.pyExpect:
exporting metrics to http://host.docker.internal:4318/v1/metrics every 5sin the log.After half a minute, open http://localhost:3000 and sign in as
admin/admin(local only — a real box setsGRAFANA_ADMIN_PASSWORD). Open 3VN Robotics → Robot health, and use Explore to querythreevn_robot_ready_ratio.Expect: A value of 1, labelled with the robot's id and software version — and a
git_commitlabel ofunknown, because you started this dashboard by hand rather than throughmake dash, which passes the commit in. The version-block lesson, visible in a time series. None of the names the robot emitted are stored in their original form.Read where the collector puts its memory limiter, and the setting that keeps the labels.
grep -n -E "memory_limiter|resource_to_telemetry_conversion|processors:" monitoring/collector/config.yamlTake it down when you are done.
docker compose -f monitoring/compose.yml down
When it goes wrong
Every Grafana panel is empty, and the collector reports no errors.
Why: The dashboard queries the OpenTelemetry names; the stored names were translated.
Fix: Query the translated names — threevn_robot_ready_ratio, threevn_robot_uptime_seconds.
Every robot looks identical in Grafana.
Why: Resource attributes were dropped on the way to storage.
Fix: Enable resource_to_telemetry_conversion in the collector's exporter.
A provisioned dashboard fails to load with no useful message.
Why: The datasource has no explicit uid, so Grafana generated a random one.
Fix: Declare the uid in the datasource provisioning file.
Terms
- OTLP
- The OpenTelemetry protocol for sending metrics, logs and traces. Instrument once; change backends in the collector.
- Metric name translation
- The collector rewriting OpenTelemetry names into Prometheus conventions, adding suffixes from unit and type.
- Memory limiter
- A collector stage that refuses data under memory pressure rather than growing until the process is killed.
Every term in the course: glossary.
Check yourself
Answer in your head first, then open it.
The pipeline works and the dashboard is empty. What is the most likely cause here?
The dashboard queries untranslated names.
Why no alerting yet?
With no baseline of normal behaviour, alerts are mostly noise, and noisy alerts get ignored — taking the real ones with them.
Why decline the OpenTelemetry SDK, and what did that cost?
About 20 MB and a dozen packages on a deliberately small robot image. It cost traces and auto-instrumentation, which are exactly what the SDK is good at.
Stretch
Write the one alert rule you would add first, as a query over the translated metric names, with a threshold and a duration. Then write down what "normal" would have to look like for a week before you would trust it.