Skip to main content

Module telemetry

Module telemetry 

Source
Available on crate feature telemetry only.
Expand description

What a reload says about itself, and the numbers a scrape reads.

Two halves, behind two features, because they answer to two different consumers and neither should drag in the other:

  • tracing — an install and a refusal each emit a structured record on the reload path, carrying the reload reason, the generation, and (on a refusal) the ErrorKind and key path; a fetch from a remote store runs in a dynamic_config.fetch span with an event inside it carrying the outcome. There is nothing on the read path: reads are an atomic load and stay one.
  • telemetryExposition, which renders a ConfigStatus and a RemoteStatus as Prometheus text. No dependency at all, which is the whole point.

§This crate does not pick a metrics ecosystem

A library that depends on prometheus picks a fight with every application that chose metrics, or OpenTelemetry, or nothing. So it depends on none of them. What it offers instead is the numbers — ConfigStatus is a handful of atomic loads and no I/O, so an exporter may call it per scrape — and one rendering of them, in a text format that is a wire encoding rather than a crate.

An application already running metrics or an OpenTelemetry SDK reads status() in its own recorder and never touches this module; an application that wants a /metrics handler and nothing else uses Exposition and pulls in no exporter at all. Spans reach OpenTelemetry the way every other crate’s do, through tracing-opentelemetry, which is the application’s dependency and not this crate’s.

§Nothing here can carry a value

A metric label is a diagnostic surface like a log line, and a scrape endpoint is usually the least guarded one a process has. So the same rule holds, one notch tighter: an event field may name a key path — that is what makes a failure actionable — and a metric label may not even do that. A path is unbounded cardinality as well as a disclosure, and a series named after a key is how one badly-labelled counter becomes a million of them.

Structs§

Exposition
One or more configurations’ ConfigStatus, as Prometheus text.

Constants§

CONSECUTIVE_FAILURES
Reloads that have installed nothing since one did.
INSTALLS_TOTAL
Snapshots installed since the process started.
LAST_FAILURE_INFO
Always 1; the ErrorKind is the label.
LAST_FAILURE_SECONDS
Seconds since the last reload that installed nothing.
LAST_RELOAD_INFO
Always 1; the reload reason is the label.
LAST_SUCCESS_SECONDS
Seconds since the serving snapshot was installed.
METRIC_NAMES
Every metric family this crate emits, in the order Exposition writes them.
REMOTE_CONSECUTIVE_FAILURES
Fetches that returned nothing since one returned a document.
REMOTE_FETCHES_TOTAL
Documents a remote source has handed over since the process started.
REMOTE_LAST_FAILURE_INFO
Always 1; the ErrorKind is the label.
REMOTE_LAST_FETCH_DURATION_SECONDS
How long the last pulled fetch took, in seconds.
REMOTE_LAST_FETCH_SECONDS
Seconds since a remote source last handed one over.
REMOTE_METRIC_NAMES
Every metric family a RemoteStatus renders as, in the order Exposition writes them.
REMOTE_UP
1 when the store answered the last time it was asked, 0 when it did not, and absent before it has been asked at all.