Skip to main content

Crate espresso_telemetry

Crate espresso_telemetry 

Source

Re-exportsΒ§

pub use token::Token;
pub use token::TokenParseError;
pub use token::TokenVerifyError;
pub use token::UnauthenticatedToken;
pub use token::load_bls_signing_key;
pub use token::parse_bls_signing_key;

ModulesΒ§

lifecycle πŸ”’
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.
push_task πŸ”’
Periodic push of prometheus::Registry snapshots to a remote-write endpoint. A final flush runs on shutdown. Errors are warn!-logged, never fatal; HTTP 429 triggers one shared ERROR via crate::rate_limit::log_rate_limit_once.
rate_limit πŸ”’
Single-shot ERROR on the first HTTP 429 from the telemetry proxy, which caps each node’s hourly byte budget. Only the metrics push observes 429 (logs retry via opentelemetry-otlp’s experimental-http-retry); compare_exchange on the shared latch keeps it to one ERROR per process.
remote_write
token

StructsΒ§

TelemetryHandle
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_push once the API setup has built the Registry.
TelemetryOptions
Operator-facing telemetry configuration.

ConstantsΒ§

NAME_LABEL πŸ”’

FunctionsΒ§

build_write_request
encode_to_snappy
format_float πŸ”’
init
Initialize the OTel logger pipeline and, when registry is Some, spawn the metrics push immediately. Production passes None (the Registry isn’t built yet) and later calls TelemetryHandle::attach_metrics_push; tests pass it directly.
label_pairs_to_labels πŸ”’
make_bucket_series πŸ”’
make_series πŸ”’
named_series πŸ”’
now_unix_millis πŸ”’
registry
Read the registry deposited by set_registry. None if no API setup has run yet (tests, CLI tools without the HTTP module).
set_registry
Deposit the Registry. Idempotent: subsequent calls are no-ops, since OnceLock::set returns Err.