mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-10-31 21:18:59 +00:00 
			
		
		
		
	 9a0aed7626
			
		
	
	
		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
		
			
				
	
	
	
		
			1.2 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			1.2 KiB
		
	
	
	
	
	
	
	
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 float64s. 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 float32s and so does not maintain accurate representations of ints larger than ~16.8M. With float64s, integers may be accurately represented up to ~9e15.
Metrics
The following metrics are defined:
- cometbft_blocksync_latest_block_height- this emulates the blocksync- latest_block_heightmetric in CometBFT v0.38+. The- cometbftnamespace comes from the- instrumentation.namespaceconfig.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"],
]