Expand description
A lightweight metrics facade used in CKB.
The ckb-metrics
crate is a set of tools for metrics.
The crate ckb-metrics-service
is the runtime which handles the metrics data in CKB.
Modules§
- Core traits and types.
- Unsync local metrics, provides better performance.
- Protocol buffers format of metrics.
Macros§
- Create a
HistogramOpts
. - Create labels with specified name-value pairs.
- Create an
Opts
. - Create a
Counter
and registers to default registry. - Create a
CounterVec
and registers to default registry. - Create a
CounterVec
and registers to a custom registry. - Create a
Counter
and registers to a custom registry. - Create a
Gauge
and registers to default registry. - Create a
GaugeVec
and registers to default registry. - Create a
GaugeVec
and registers to a custom registry. - Create a
Gauge
and registers to a custom registry. - Create a
Histogram
and registers to default registry. - Create a
HistogramVec
and registers to default registry. - Create a
HistogramVec
and registers to default registry. - Create a
Histogram
and registers to a custom registry. - Create an
IntCounter
and registers to default registry. - Create an
IntCounterVec
and registers to default registry. - Create an
IntCounterVec
and registers to a custom registry. - Create an
IntCounter
and registers to a custom registry. - Create an
IntGauge
and registers to default registry. - Create an
IntGaugeVec
and registers to default registry. - Create an
IntGaugeVec
and registers to a custom registry. - Create an
IntGauge
and registers to a custom registry.
Structs§
- A struct that bundles the options for creating a
Histogram
metric. It is mandatory to set Name and Help to a non-empty string. All other fields are optional and can safely be left at their zero value. - Timer to measure and record the duration of an event.
- A struct that bundles the options for creating most
Metric
types. - An implementation of an
Encoder
that converts aMetricFamily
proto message into the binary wire format of protobuf. - A Gauge that returns the value from a provided function on every collect run.
- A struct for registering Prometheus collectors, collecting their metrics, and gathering them into
MetricFamilies
for exposition. - An implementation of an
Encoder
that converts aMetricFamily
proto message into text format.
Enums§
- The error types for prometheus.
Constants§
- The default
Histogram
buckets. The default buckets are tailored to broadly measure the response time (in seconds) of a network service. Most likely, however, you will be required to define buckets customized to your use case. - The protocol buffer format of metric family.
- The text format of metric family.
Statics§
- Indicate whether the metrics service is enabled. This value will set by ckb-metrics-service
Traits§
- An interface for encoding metric families into an underlying wire protocol.
Functions§
- Default registry (global static).
- Create
count
buckets, where the lowest bucket has an upper bound ofstart
and each following bucket’s upper bound isfactor
times the previous bucket’s upper bound. The final +Inf bucket is not counted and not included in the returned slice. The returned slice is meant to be used for the Buckets field ofHistogramOpts
. - if metrics service is enabled,
handle()
will returnSome(&'static METRICS)
else will returnNone
- Create
count
buckets, eachwidth
wide, where the lowest bucket has an upper bound ofstart
. The final +Inf bucket is not counted and not included in the returned slice. The returned slice is meant to be used for the Buckets field ofHistogramOpts
. - Registers a new
Collector
to be included in metrics collection. It returns an error if the descriptors provided by theCollector
are invalid or if they - in combination with descriptors of already registered Collectors - do not fulfill the consistency and uniqueness criteria described in theDesc
documentation.
Type Aliases§
- A
Metric
represents a single numerical value that only ever goes up. - A
Metric
represents a single numerical value that can arbitrarily go up and down. - The integer version of
Counter
. Provides better performance if metric values are all positive integers (natural numbers). - The integer version of
CounterVec
. Provides better performance if metric are all positive integers (natural numbers). - The integer version of
Gauge
. Provides better performance if metric values are all integers. - The integer version of
GaugeVec
. Provides better performance if metric values are all integers. - A specialized Result type for prometheus.