mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-27 00:35:18 +00:00
9a0aed7626
* initialize x/metrics with metrics collection * include global labels in x/metrics metrics * add x/metrics spec * add x/metrics test coverage * update changelog |
||
---|---|---|
.. | ||
README.md |
metrics
Abstract
x/metrics
is a stateless module that does not affect consensus. It captures chain metrics and emits them when the instrumentation.prometheus
option is enabled in config.toml
.
Precision
The metrics emitted by x/metrics
are float64
s. They use github.com/go-kit/kit/metrics
Prometheus gauges. Cosmos-sdk's telemetry
package was not used because, at the time of writing, it only supports float32
s and so does not maintain accurate representations of ints larger than ~16.8M. With float64
s, integers may be accurately represented up to ~9e15.
Metrics
The following metrics are defined:
cometbft_blocksync_latest_block_height
- this emulates the blocksynclatest_block_height
metric in CometBFT v0.38+. Thecometbft
namespace comes from theinstrumentation.namespace
config.toml value.
Metric Labels
All metrics emitted have the labels defined in app.toml's telemetry.global-labels
field. This is the same field used by cosmos-sdk's telemetry
package.
example:
# app.toml
[telemetry]
global-labels = [
["chain_id", "kava_2222-10"],
["my_label", "my_value"],
]