Expand description
In-process OTel logs export plus a periodic Prometheus remote-write push for
metrics. Both pipelines share one six-month BLS-BN254 JWT minted from the
staking key. Tracing events go through an OTLP/HTTP batch exporter; an
externally supplied prometheus::Registry is scraped on a tokio interval and
POSTed to /api/v1/write as snappy-compressed protobuf.
Failure modes:
- Proxy down:
BatchLogProcessorqueue fills (~2k records) then drops; metrics pushwarn!s and retries next tick. Neither uses disk nor blocks consensus. - JWT misconfig:
initreturnsErr; the caller continues without telemetry. - Token TTL expiry mid-process is not handled; the six-month TTL outlasts typical restart cadence.
StructsΒ§
- Metrics
Push πHandle - Handle to the metrics push thread. The thread owns a dedicated single-threaded runtime so a slow proxy canβt starve a consensus worker.
- Telemetry
Handle - Owns the OTel logger provider and, optionally, the metrics push task, so
both flush on graceful shutdown. Stashes the JWT and endpoint so the push
task can be spawned later via
TelemetryHandle::attach_metrics_pushonce the API setup has built theRegistry. - Telemetry
Options - Operator-facing telemetry configuration.
ConstantsΒ§
- PUBKEY_
SLUG_ πLEN - SERVICE_
NAME π - SHUTDOWN_
TIMEOUT π
StaticsΒ§
- REGISTRY π
- Global handoff for the prometheus
Registrypopulated by HotShot.
FunctionsΒ§
- build_
logger_ πprovider - init
- Initialize the OTel logger pipeline and, when
registryisSome, spawn the metrics push immediately. Production passesNone(theRegistryisnβt built yet) and later callsTelemetryHandle::attach_metrics_push; tests pass it directly. - instance_
id π - join_
bounded π - Join
thread, detaching it afterSHUTDOWN_TIMEOUTso a wedged exporter canβt hang shutdown on the main thread. - pubkey_
slug π - registry
- Read the registry deposited by
set_registry.Noneif no API setup has run yet (tests, CLI tools without the HTTP module). - segment π
- set_
registry - Deposit the
Registry. Idempotent: subsequent calls are no-ops, sinceOnceLock::setreturnsErr.