metrics

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ProviderLabel is a label for the provider name.
	ProviderLabel = "provider"
	// PairIDLabel is the currency pair for which the metric applies.
	PairIDLabel = "id"
	// DecimalsLabel is the number of decimal points associated with the price.
	DecimalsLabel = "decimals"
	// OracleSubsystem is a subsystem shared by all metrics exposed by this package.
	OracleSubsystem = "side_car"
	// SuccessLabel is a label for a successful operation.
	SuccessLabel = "success"
	// Version is a label for the Slinky version.
	Version = "version"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics interface {
	// AddTick increments the number of ticks, this can represent a liveness counter. This
	// is incremented once every interval (which is defined by the oracle config).
	AddTick()

	// AddTickerTick increments the number of ticks for a given ticker. Specifically, this
	// is used to track the number of times a ticker was updated.
	AddTickerTick(ticker string)

	// UpdatePrice price updates the price for the given pairID for the provider.
	UpdatePrice(name, pairID string, decimals uint64, price float64)

	// UpdateAggregatePrice updates the aggregated price for the given pairID.
	UpdateAggregatePrice(pairID string, decimals uint64, price float64)

	// AddProviderTick increments the number of ticks for a given provider. Specifically,
	// this is used to track the number of times a provider included a price update that
	// was used in the aggregation.
	AddProviderTick(providerName, pairID string, success bool)

	// AddProviderCountForMarket increments the number of providers that were utilized
	// to calculate the final price for a given market.
	AddProviderCountForMarket(market string, count int)

	// SetSlinkyBuildInfo sets the build information for the Slinky binary.
	SetSlinkyBuildInfo()
}

Metrics is an interface that defines the API for oracle metrics.

func NewMetrics

func NewMetrics() Metrics

NewMetrics returns a Metrics implementation that exposes metrics to Prometheus.

func NewMetricsFromConfig

func NewMetricsFromConfig(config config.MetricsConfig) Metrics

NewMetricsFromConfig returns an oracle Metrics implementation based on the provided config.

func NewNopMetrics

func NewNopMetrics() Metrics

NewNopMetrics returns a Metrics implementation that does nothing.

type OracleMetricsImpl

type OracleMetricsImpl struct {
	// contains filtered or unexported fields
}

OracleMetricsImpl is a Metrics implementation that does nothing.

func (*OracleMetricsImpl) AddProviderCountForMarket

func (m *OracleMetricsImpl) AddProviderCountForMarket(market string, count int)

AddProviderCountForMarket increments the number of providers that were utilized to calculate the final price for a given market.

func (*OracleMetricsImpl) AddProviderTick

func (m *OracleMetricsImpl) AddProviderTick(providerName, pairID string, success bool)

AddProviderTick increments the number of ticks for a given provider. Specifically, this is used to track the number of times a provider included a price update that was used in the aggregation.

func (*OracleMetricsImpl) AddTick

func (m *OracleMetricsImpl) AddTick()

AddTick increments the total number of ticks that have been processed by the oracle.

func (*OracleMetricsImpl) AddTickerTick

func (m *OracleMetricsImpl) AddTickerTick(ticker string)

AddTickerTick increments the number of ticks for a given ticker. Specifically, this is used to track the number of times a ticker was updated.

func (*OracleMetricsImpl) SetSlinkyBuildInfo

func (m *OracleMetricsImpl) SetSlinkyBuildInfo()

SetSlinkyBuildInfo sets the build information for the Slinky binary. The version exported is determined by the build time version in accordance with the build pkg.

func (*OracleMetricsImpl) UpdateAggregatePrice

func (m *OracleMetricsImpl) UpdateAggregatePrice(
	pairID string,
	decimals uint64,
	price float64,
)

UpdateAggregatePrice updates the aggregated price for the given pairID.

func (*OracleMetricsImpl) UpdatePrice

func (m *OracleMetricsImpl) UpdatePrice(
	providerName, pairID string,
	decimals uint64,
	price float64,
)

UpdatePrice price updates the price for the given pairID for the provider.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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