Skip to main content
Every Fonoster service, Routr included, can send traces, metrics and logs over OTLP/HTTP to any OpenTelemetry collector. Telemetry is off by default: nothing is sent until you set an endpoint. Every call’s spans, logs and metrics carry the attribute fonoster.call_ref, and the SIP side carries sip.call_id, so you can follow one call from the SIP edge to your app.

Before you begin

You need Fonoster installed with Docker Compose. See Install with Docker Compose. You also need a collector that accepts OTLP over HTTP (usually port 4318) and that the containers can reach. If you don’t have one yet, run Grafana next to Fonoster first.

Turn on telemetry

1

Set the endpoint in .env

In your fonoster folder, set your collector’s OTLP/HTTP endpoint in .env:
Give the base URL only. Each service sends to /v1/traces, /v1/metrics and /v1/logs under it.
2

Recreate the services

Recreate the containers so they get the new value:
Compose passes OTEL_EXPORTER_OTLP_ENDPOINT to the API server, AppBridge, the Roomr node, the hosted Autopilot and Routr. Routr reads the variable directly. The others read it through telemetry.otlpEndpoint in their file in config/:
An empty value turns telemetry off. To point one service at a different collector, change that line in its config/<service>.yaml and recreate that service (docker compose up -d --force-recreate <service>).

What each service sends

AppBridge, the Roomr node and Routr also send their logs. The API server’s stay in docker compose logs. A call is one trace: Routr’s SIP INVITE span, then the Roomr node’s call span, AppBridge’s appbridge.call and, for an agent, Autopilot’s spans. Each service passes the W3C traceparent to the next, on the SIP request and in the session start. When the INVITE arrives with a traceparent (from a carrier or another proxy), the call joins that trace. The Roomr node’s call span also carries sip.call_id, so later requests of the dialog, such as the BYE, are found by the same Call-ID. Metrics are sent every 15 seconds. An EdgePort SIP <METHOD> span ends as an error when its request gets no final response before the transaction times out (32 seconds). That’s how a request the far end never answered shows up.

Other settings

The services also read these standard OpenTelemetry variables: Compose passes OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS and OTEL_EXPORTER_OTLP_PROTOCOL from .env to each of those services. For a hosted collector that needs an auth header (Grafana Cloud, Honeycomb), set both in .env (and keep the file private, it holds a credential):
With Helm, set otel.endpoint and either otel.headers or, to keep the credential out of values, otel.headersSecret.name (and .key, default headers) pointing at a Secret that holds the string. To pass any other variable, add it to the service’s environment in a Compose file of your own (see the next section for how to add one). The hosted Autopilot reports autopilot.session (a child of AppBridge’s call span, so one trace covers the call), autopilot.turn (the caller’s final transcript to the end of the reply) and autopilot.llm.request spans, plus fonoster.autopilot.turns, fonoster.autopilot.llm.requests and fonoster.autopilot.llm.latency_ms (the sum of the time to the first token; divide by requests).

See it in Grafana

If you don’t have a backend, run grafana/otel-lgtm next to Fonoster. It’s one container with an OpenTelemetry collector, Tempo for traces, Loki for logs, Prometheus for metrics and Grafana to look at them. It keeps data on its own disk, so it suits one server, not a cluster.
1

Add the container

Save this as compose.telemetry.yaml, next to compose.yaml. It runs the stack on Fonoster’s network and publishes Grafana on the server’s loopback address only:
2

Point Fonoster at it

In .env, add the file to COMPOSE_FILE and set the endpoint:
If COMPOSE_FILE already lists compose.tls.yaml, keep it and add :compose.telemetry.yaml at the end.
3

Start it

Start the container and recreate the services so they get the endpoint:
4

Open Grafana

Open http://localhost:3000 on the server. Within 15 seconds, metrics arrive from the API server, AppBridge, the Roomr node and Routr’s EdgePort. Make a call to see its traces and logs.
Grafana listens on the server’s loopback address only. From your computer, open an SSH tunnel and browse to http://localhost:3000:

Find a call

In Grafana, open Explore.
  • By call ref. Pick the Tempo data source and run this TraceQL query with the call ref from the dashboard’s Calls page. It returns the call’s spans from AppBridge, the Roomr node and Autopilot:
  • By SIP Call-ID. Search by the Call-ID of the INVITE (from a softphone, a carrier or a packet capture). It returns Routr’s SIP <METHOD> spans for that dialog and the Roomr node’s call span, which gives you the call ref:
  • Its logs. Pick the Loki data source. This query returns one call’s log records from every Fonoster service (Loki writes the attribute’s dots as underscores):

Spot dropped SIP messages

The EdgePort counts every SIP message it drops instead of sending, in routr.sip.send_dropped, by routr.drop.reason. In Grafana, pick the Prometheus data source and run:
Each drop also logs a record that names the message’s first line and Call-ID, or says it was the TLS handshake of a new outbound connection. This Loki query lists them:
The request that was never delivered shows up in Tempo as an EdgePort span that ended as an error when its transaction timed out:
A browser call that stays connected after your app hangs up is one way this shows up: a SIP BYE span that ends in error after about 32 seconds, and a drop with reason ws_reconnect. The EdgePort couldn’t deliver the BYE to the browser.