Telemetry export
Probeward can send its own logs, metrics and traces to an OpenTelemetry collector, so that an installation can be watched with the tools that already watch everything else. Most installations will never use this, and it is built so that they do not notice it:
- It is off. Unless you set an endpoint, nothing is created: no exporter, no background task, no connection, no queue. The cost of the code being there is one atomic load on a few hot paths. See the cost.
- It never connects anywhere you did not name. There is no default endpoint and no phone-home. The core never tells a probe to export, and a probe never sends its telemetry through the core.
- It is never in the way. A collector that is down, slow or refusing cannot slow polling, alerting or the API, cannot make memory grow, and cannot delay shutdown by more than a few seconds. See when the collector is not there.
The protocol is OTLP over HTTP with protobuf bodies (http/protobuf), the one every collector and every backend that takes OpenTelemetry accepts. gRPC is not supported; see what it is not.
Turning it on
Set the standard OpenTelemetry variable, and restart.
In the reference installation, add the overlay that runs a collector next to Probeward, and the endpoint:
# deploy/.env
COMPOSE_FILE=compose.yml:compose.telemetry.ymldocker compose up -d
docker compose logs -f otel-collector # what the collector receivesdeploy/compose.telemetry.yml adds an OpenTelemetry Collector that prints what it receives and sets OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318 for Probeward. It is an example to try, not part of the default installation: for real use, point the endpoint at your own collector or at your observability service, and delete the overlay. If you combine it with compose.probes.yml, list both files in COMPOSE_FILE, separated by :.
For the deb package, uncomment the endpoint in /etc/probeward/probeward.env and restart:
sudo sed -i 's|^#OTEL_EXPORTER_OTLP_ENDPOINT=.*|OTEL_EXPORTER_OTLP_ENDPOINT=http://collector.example.org:4318|' /etc/probeward/probeward.env
sudo systemctl restart probeward
journalctl -u probeward | grep 'telemetry export'For a remote probe, set the same variables in the probe's own environment: the unit's environment file (/etc/probeward/probeward-probe.env) on Linux, and probe.conf on Windows, which accepts OTEL_* names beside the PROBEWARD_* ones (a variable in the environment wins over the file). The probe's resource attributes carry service.name=probeward-probe, a per-process service.instance.id, the host name and, once it has paired, probeward.probe.id, so its telemetry is told apart from the core's. See probes.
The log shows one line when export starts (telemetry export is on: traces, metrics, logs to collector:4318 as service probeward). The system status page shows the same, and whether the collector is accepting what is sent: Settings, System, "Telemetry export".
Settings
The variables are the OpenTelemetry ones, so existing collectors, Compose files and habits work. A value that cannot be used stops the process at start with configuration error: ... and the variable's name; the message never repeats the value, because endpoints and headers can carry secrets.
| Variable | Default | Meaning |
|---|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | unset | Base URL of the collector, for example http://collector:4318. /v1/traces, /v1/metrics and /v1/logs are added. Setting this (or one of the three below) is what turns export on. An http or https URL; user names and passwords in the URL are refused, use the headers. |
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, ..._METRICS_ENDPOINT, ..._LOGS_ENDPOINT | unset | A full URL for one signal, used as it is. Set alone, it turns on that signal only. |
PROBEWARD_OTEL_SIGNALS | all three | Which signals are sent: a comma-separated list of traces, metrics, logs. Naming a signal that has no endpoint is an error. Many installations will want metrics only. |
OTEL_EXPORTER_OTLP_PROTOCOL | http/protobuf | Only http/protobuf is accepted (also per signal: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL and so on). grpc and http/json are refused with a message. |
OTEL_EXPORTER_OTLP_HEADERS | unset | Headers sent with every request, name=value,name=value, values percent-encoded: authorization=Bearer%20TOKEN. A secret: never logged, never shown, redacted in every dump. Per signal: OTEL_EXPORTER_OTLP_TRACES_HEADERS and so on. |
OTEL_EXPORTER_OTLP_CERTIFICATE | system roots | A PEM file with the certificate authority that signed the collector's certificate, for a private authority. TLS is rustls; there is no OpenSSL. |
OTEL_EXPORTER_OTLP_TIMEOUT | 10000 | Milliseconds one request may take. |
OTEL_SERVICE_NAME | probeward (core), probeward-probe (probe) | The service.name resource attribute. |
OTEL_RESOURCE_ATTRIBUTES | unset | More resource attributes, key=value,key=value, for example deployment.environment=prod,site=hq. |
OTEL_TRACES_SAMPLER, OTEL_TRACES_SAMPLER_ARG | parentbased_traceidratio, 0.01 | The head sampler: always_on, always_off, traceidratio and the parentbased_ forms of each. The argument is the ratio, 0 to 1. See sampling. |
OTEL_SDK_DISABLED | false | true turns export off even though an endpoint is set. A quick way to stop it without editing the rest. |
OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER, OTEL_LOGS_EXPORTER | otlp | none turns that signal off. |
OTEL_METRIC_EXPORT_INTERVAL | 60000 | Milliseconds between metric exports. |
OTEL_BSP_SCHEDULE_DELAY | 5000 | Milliseconds between batches of spans and of logs. A full batch is sent at once. |
OTEL_BSP_MAX_EXPORT_BATCH_SIZE | 512 | Spans or log records per request. |
OTEL_BSP_MAX_QUEUE_SIZE, OTEL_BLRP_MAX_QUEUE_SIZE | 2048 | Spans and log records held while they wait to be sent. See when the collector is not there. |
Not supported, and refused when set so that nothing is silently ignored: compression (OTEL_EXPORTER_OTLP_COMPRESSION other than none) and client certificates (OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE, ..._CLIENT_KEY).
The administrative commands (probeward admin ...) never export, whatever the environment says: only probeward serve and probeward probe do.
What is exported
Metrics
Names, units and attributes are stable. The OpenTelemetry semantic conventions are used where one exists (http.server.*, process.*, db.client.*); everything else is under probeward.. Counters are cumulative sums. No sensor id, device name or address is ever a metric attribute, so the number of series does not grow with the size of the estate: attributes are sensor kinds, outcomes, route templates, channel kinds and, for the few remote probes, the probe's id.
| Metric | Type, unit | Attributes | What |
|---|---|---|---|
probeward.polls.started | sum, {poll} | Polls started. | |
probeward.polls.in_flight | gauge, {poll} | Polls running now. | |
probeward.polls.finished | sum, {poll} | probeward.sensor.kind, probeward.poll.outcome (ok, timeout, unreachable, auth_failed, protocol, config, internal) | Polls finished. |
probeward.poll.duration | histogram, s | probeward.sensor.kind | How long a poll took. |
probeward.engine.loop.lag | gauge, s | How late the engine loop handled its last due timer. | |
probeward.engine.loop.iteration.duration | histogram, s | Time the loop spent handling one wake-up, not counting the wait. | |
probeward.samples.written | sum, {sample} | Samples written to the database. | |
probeward.samples.dropped | sum, {sample} | Samples dropped because the writer could not keep up. | |
probeward.samples.pending | gauge, {sample} | Samples queued or buffered, waiting to be written. | |
probeward.journal.pending | gauge, {item} | Incident, notification and timeline writes waiting. | |
probeward.journal.skipped | sum, {item} | Journal writes that failed for good and were skipped. | |
probeward.timeline.dropped | sum, {item} | Timeline entries dropped because the journal was saturated. | |
probeward.status.pending | gauge, {row} | Sensor status rows waiting to be written. | |
probeward.snapshot.duration | gauge, s | How long the last engine snapshot took to save. | |
probeward.snapshot.size | gauge, By | Size of the last engine snapshot. | |
probeward.notifications.attempts | sum, {attempt} | probeward.channel.kind (email, webhook, discord, telegram), probeward.delivery.outcome (delivered, retry, failed) | Delivery attempts. |
probeward.notification.attempt.duration | histogram, s | probeward.channel.kind | How long an attempt took. This is the time to send, not the time since the incident opened. |
probeward.notifications.in_flight | gauge, {delivery} | Deliveries being attempted now. | |
probeward.notifications.overdue | gauge, {delivery} | Deliveries due for a while that no worker has taken. | |
probeward.notifications.exhausted | sum, {delivery} | Deliveries given up on. | |
probeward.incidents.open | gauge, {incident} | Open incidents. | |
probeward.sensors | gauge, {sensor} | probeward.sensor.state (up, warning, down, unknown, paused) | Sensors by state. |
db.client.connection.count | gauge, {connection} | db.client.connection.state (idle, used) | Database pool use. |
db.client.connection.max | gauge, {connection} | Size limit of the pool. | |
probeward.probes.connected | gauge, {probe} | Remote probes with a session. | |
probeward.probe.buffered_samples | gauge, {sample} | probeward.probe.id | Samples a remote probe holds that the core has not acknowledged. |
probeward.probe.replayed_samples | sum, {sample} | probeward.probe.id | Samples a remote probe replayed after an outage. |
probeward.probe.lost_samples | sum, {sample} | probeward.probe.id | Samples a remote probe lost because its buffer was full. |
probeward.probe.duplicate_samples | sum, {sample} | probeward.probe.id | Replayed samples the core already had. |
http.server.request.duration | histogram, s | http.request.method, http.route (the template, absent when none matched), http.response.status_code | HTTP requests. Time to the response headers. |
process.cpu.time | sum, s | cpu.mode (user, system) | CPU time of the process. Linux. |
process.memory.usage | gauge, By | Resident memory. Linux. | |
process.memory.virtual | gauge, By | Virtual memory. Linux. | |
process.thread.count | gauge, {thread} | Threads. Linux. | |
probeward.build.info | gauge, 1 | probeward.version | Always 1. |
probeward.telemetry.dropped | sum, {item} | probeward.telemetry.signal (traces, logs) | Spans and log records discarded. |
probeward.telemetry.export.failures | sum, {request} | probeward.telemetry.signal | Export requests that failed. |
A remote probe sends probeward.polls.finished, probeward.poll.duration, the process.* metrics, probeward.build.info, the two probeward.telemetry.* metrics and its own:
| Metric | Type, unit | What |
|---|---|---|
probeward.probe.session.connected | gauge, 1 | 1 while the probe has a session with the core. |
probeward.probe.sensors | gauge, {sensor} | Sensors assigned to this probe. |
probeward.probe.buffer.samples | gauge, {sample} | Samples buffered on disk that the core has not acknowledged. |
probeward.probe.buffer.size | gauge, By | Size of the on-disk buffer. |
probeward.probe.buffer.lost_samples | sum, {sample} | Samples lost because the buffer was full. |
probeward.probe.replayed_samples | sum, {sample} | Samples sent in replay batches. |
probeward.probe.skipped_polls | sum, {poll} | Polls skipped because a credential was missing while the core was away. |
There is no metric for database query time: the store does not measure it, and this feature does not add instrumentation to every query.
Traces
A span is made for the paths an administrator debugs. Spans carry ids and words, never a message that can quote a target, a body, a query string or a name the administrator typed.
| Span | Made for | Attributes |
|---|---|---|
METHOD /route/{template} (kind server) | Each HTTP request that matched a route | http.request.method, http.route, http.response.status_code; status error for 5xx |
poll | Each poll, on the core and on a probe | probeward.sensor.id, probeward.device.id (core), probeward.sensor.kind, probeward.poll.outcome; status error when the poll failed (the kind of failure, not its message) |
notification.deliver | Each delivery attempt | probeward.event.id, probeward.event.type, probeward.incident.id, probeward.destination.id, probeward.delivery.attempt, probeward.channel.kind, probeward.delivery.outcome |
engine.snapshot.save | Each save of the engine snapshot | probeward.snapshot.bytes, probeward.config.revision |
discovery.job | Each discovery job | probeward.discovery.job.id, probeward.discovery.status |
config.import.plan, config.import.apply | Showing and applying a configuration import | probeward.import.result (applied, invalid, stale, blocked) |
Relations between spans:
- An incoming W3C
traceparentheader on a request continues the caller's trace: the request span has the caller's trace id and takes the caller's span as its parent, and whether it is sampled follows the caller's flag (with the default parent-based sampler).tracestateis not used. - A log record written while a span is active carries that span's trace id and span id.
- A delivery is not a child of the incident event that caused it. The incident is opened by the engine, which is pure and takes no trace context, and the delivery worker claims the delivery from the database later, so there is no context to continue. The two are linked by
probeward.event.idandprobeward.incident.idinstead. A poll is a trace of its own for the same reason.
Logs
Every tracing event the log filter (PROBEWARD_LOG) lets through becomes an OTLP log record, in addition to the normal output on standard error: the message as the body, the level as the severity, the event's fields as attributes, the module as code.namespace, and the trace and span ids when it happened inside a span. Only the filter decides: raise it (PROBEWARD_LOG=debug) and more records go out. The exporter's own messages and those of the HTTP stack it uses are never exported, so it cannot produce telemetry about itself.
Sampling
Traces are sampled where they start, by default one in a hundred (parentbased_traceidratio with 0.01): a request or poll with no parent is kept with probability 1%, and anything with a parent follows it. This is so that turning tracing on does not flood a collector.
At 10,000 sensors polled every minute the core starts about 167 polls a second, each a trace of its own, so the default keeps about 1.7 a second: roughly 100 a minute, 144,000 a day, or about 37 MB a day of span data at about 255 bytes a span, plus the requests that people and dashboards make. With always_on it would be all 167 a second, about 14 million a day; use that for a short investigation, not as a setting to leave. A sampler is chosen for the whole process, not per kind of span. Sampling does not favour failures: a failed poll is kept with the same probability as any other. For the failures, the poll metrics (probeward.polls.finished by outcome) count every one.
A caller that sends traceparent with the sampled flag set makes its request sampled whatever the ratio. Anyone who can reach the API can therefore cause spans, up to the limit of the queue below. If that matters, put the API behind a proxy that removes the header, or use OTEL_TRACES_SAMPLER=traceidratio (without parentbased_), which ignores the caller's decision.
What is never exported
- Credential values, tokens, pairing material, SNMP communities, passwords, webhook URLs, the heartbeat URL, session cookies and API tokens. They are not in the figures the metrics are read from, not in span attributes (which are ids and fixed words), and not in the log records unless the
tracingevent that carries them is itself a leak, which the project's tests treat as a bug. - Paths and query strings. A request is recorded under its route template. A push report to
/api/v1/push/pwp_...isPOST /api/v1/push/{token}; the token is never recorded. A request that matched no route (static files, a mistyped address) has no span. - Request and response bodies, the message of a failed poll, the name or address of a device as a metric attribute. Sensor and device ids appear as attributes of the poll spans, where one trace is one poll.
- The OTLP headers. They are held as a secret, shown as
name=<redacted>in any debug output, and kept out of every error message and of the status page, which shows the collector's host and port and nothing else of the URL.
The automated tests plant a marker in every secret-bearing field (all credential kinds, a webhook URL with a key in its query, a push token in a path, a login password, an API token, a heartbeat URL, a pairing token and the OTLP headers themselves), run those paths with the log level at trace and export pointed at a capturing collector, and fail if the marker is in anything the collector received. A second test shows the scan can fail by exporting a marker on purpose.
What you send is still your own site's data: device names and addresses can be in log records at verbose levels, as they are in the ordinary logs. Treat the collector like the log store.
When the collector is not there
Exporting happens on its own tasks, never on the engine loop, the poller or a request handler. The code that produces telemetry only appends to a bounded queue or updates a counter under a mutex held for nanoseconds.
- Slow or silent collector. Each request has a timeout (
OTEL_EXPORTER_OTLP_TIMEOUT, ten seconds by default). Nothing else waits for it. - Refusing or failing collector. A batch that gets
429,502,503or504, or no answer, goes back to the front of its queue and is tried again after a wait that doubles from one second to thirty. Any other answer (a400or500, say) drops the batch, which is counted. - Memory is bounded. The queues hold 2,048 spans and 2,048 log records by default (
OTEL_BSP_MAX_QUEUE_SIZE,OTEL_BLRP_MAX_QUEUE_SIZE). When one is full, the oldest item is dropped and counted inprobeward.telemetry.droppedand on the status page. Metrics are cumulative, so a metrics export that is missed loses nothing: the next carries the totals. - The log is not spammed. One line when a signal starts failing, with the host and the reason (
cannot connect,no answer within 10 s,HTTP 500), and one when it recovers, with how long it was down and how many items were lost. Nothing in between. - Shutdown sends what is queued, within three seconds, then abandons the rest.
The status page and GET /api/v1/system/status (the telemetry object) say off, or where it goes and which signals, when something was last delivered, since when it has been failing and why, and how many items were dropped. The reason is one of a few fixed phrases; the collector's answer is never kept.
A collector that accepts the connection and never answers, or answers 500, does not slow polling: with 240 sensors, polls stay within 10% of their interval and the loop lag stays flat, as without export. Shutdown stays quick.
The cost
Measured with the capacity harness at 10,000 sensors for five minutes.
- Binary and image. The release binary as
deploy/Dockerfilebuilds it (musl, static) grows from 41,491,040 to 41,782,144 bytes, 291,104 bytes or 0.7%; the image from 75.7 MB to 76.1 MB. The build gains one library,prost(Apache-2.0), and three that only run at build time (prost-derive, and itsanyhowanditertools, MIT or Apache-2.0);cargo denyaccepts all of them, and nothing new is linked for TLS or HTTP, which are thereqwestandrustlsthe product already used. - CPU and schedule. With export compiled in and no endpoint set, the run matched the runs before the feature existed: every interval on time, loop lag at most 1 ms, 7.3 s of CPU (2.4% of one core). At the defaults with a local collector it used 7.6 s, with every trace sampled 8.1 s (all 55,088 polls sampled, no span dropped, lag 3 ms), and with the collector unreachable 8.9 s, with polls still on schedule (the worst start 0.3 s from its slot against a 60 s interval), nothing dropped and shutdown in 0.18 s.
These are single runs on one host, with simulated polls; capacity has the table, the method and what it does not say. Memory differs between runs of the same build by more than any difference these runs show.
What it is not
- Not an observability platform. Probeward sends what it already knows to something that is one. It does not store, graph or alert on its own telemetry; the heartbeat and the status page are for that.
- Not gRPC. OTLP/gRPC needs an HTTP/2 stack with trailers and the gRPC framing, in addition to the HTTP client Probeward already has, and the generated protobuf definitions that go with them: a second HTTP stack and a protobuf compiler in the build, for something every collector also accepts as OTLP/HTTP. The OTLP messages are written out by hand in
telemetry/proto.rs, and the tests check them against a real collector. - Not a Cargo feature. There is no way to compile it out, because it costs one dependency (
prost, Apache-2.0) and about 290 kB of code (0.7%) in the binary, and a second build to test would cost more than that. - Not a replacement for the log. Standard error and the journal stay as they are.