types

package
v0.1.4-202309124022-mf... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name of the module
	ModuleName = "metrics"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	// The height of the latest block.
	// This gauges exactly emulates the default blocksync metric in CometBFT v0.38+
	// It should be removed when fury has been updated to CometBFT v0.38+.
	// see https://github.com/cometbft/cometbft/blob/v0.38.0-rc3/blocksync/metrics.gen.go
	LatestBlockHeight metrics.Gauge
}

Metrics contains metrics exposed by this module. They use go-kit metrics like CometBFT as opposed to using cosmos-sdk telemetry because the sdk's telemetry only supports float32s, whereas go-kit prometheus metrics correctly handle float64s (and thus a larger number of int64s)

func NewMetrics

func NewMetrics(opts TelemetryOptions) *Metrics

NewMetrics creates a new Metrics object based on whether or not prometheus instrumentation is enabled.

func NoopMetrics

func NoopMetrics() *Metrics

NoopMetrics are a do-nothing placeholder used when prometheus instrumentation is not enabled.

func PrometheusMetrics

func PrometheusMetrics(opts TelemetryOptions) *Metrics

PrometheusMetrics returns the gauges for when prometheus instrumentation is enabled.

type TelemetryOptions

type TelemetryOptions struct {
	// CometBFT config value for instrumentation.prometheus (config.toml)
	PrometheusEnabled bool
	// Namespace for CometBFT metrics. Used to emulate CometBFT metrics.
	CometBFTMetricsNamespace string
	// A list of keys and values used as labels on all metrics
	GlobalLabelsAndValues []string
}

TelemetryOptions defines the app configurations for the x/metrics module

func TelemetryOptionsFromAppOpts

func TelemetryOptionsFromAppOpts(appOpts servertypes.AppOptions) TelemetryOptions

TelemetryOptionsFromAppOpts creates the TelemetryOptions from server AppOptions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL