Crate mysten_metrics

Source

Re-exports§

pub use scopeguard;

Modules§

histogram
metered_channel
monitored_mpsc
Provides wrappers to tokio mpsc channels, with metrics on total items sent, received and inflight.
thread_stall_monitor

Macros§

forward_server_timing_and_spawn
monitored_future
spawn_logged_monitored_task
spawn_monitored_task

Structs§

CancelMonitor
GaugeGuard
Increments gauge when acquired, decrements when guard drops
InflightGuard
Difference vs GaugeGuard: Stores the gauge by value to avoid borrowing issues.
InflightGuardFuture
Metrics
MonitoredScopeFuture
MonitoredScopeGuard
RegistryService
A service to manage the prometheus registries. This service allow us to create a new Registry on demand and keep it accessible for processing/polling. The service can be freely cloned/shared across threads.

Constants§

BYTES_BUCKETS
COARSE_LATENCY_SEC_BUCKETS
Used when we don’t care about fine-grained values.
COUNT_BUCKETS
LATENCY_SEC_BUCKETS
Used when latency is usually < 10s. Expensive because of the number of buckets.
METRICS_ROUTE
SUBSECOND_LATENCY_SEC_BUCKETS
Used when latency is most definitely sub-second.
TX_TYPE_SHARED_OBJ_TX
TX_TYPE_SINGLE_WRITER_TX

Traits§

InflightGuardFutureExt
MonitorCancellation
MonitorCancellation records a cancelled = true span attribute if the future it is decorating is dropped before completion. The cancelled attribute must be added at span creation, as you cannot add new attributes after the span is created.
MonitoredFutureExt

Functions§

add_server_timing
Add a new entry to the ServerTiming header. If the caller is not currently in a ServerTiming context (created with with_new_server_timing), an error is logged.
bridge_uptime_metric
Similar to uptime_metric, but for the bridge node with different labels. Create a metric that measures the uptime from when this metric was constructed. The metric is labeled with:
get_metrics
get_server_timing
Get the currently active ServerTiming context. Only intended for use by macros within this module.
init_metrics
metrics
monitored_scope
This function creates a named scoped object, that keeps track of
start_prometheus_server
uptime_metric
Create a metric that measures the uptime from when this metric was constructed. The metric is labeled with:
with_new_server_timing
Create a new task-local ServerTiming context and run the provided future within it. Should be used at the top-most level of a request handler. Can be added to an axum router as a layer by using mysten_service::server_timing_middleware.
with_server_timing
Create a new task-local ServerTiming context and run the provided future within it. Only intended for use by macros within this module.

Type Aliases§

RegistryID