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: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderLabel is a label for the provider name.
	ProviderLabel = "provider"
	// IDLabel is a label for the ID of a provider response.
	IDLabel = "id"
	// ProviderTypeLabel is a label for the type of provider (WS, API, etc.)
	ProviderTypeLabel = "type"
	// StatusLabel is a label for the status of a provider response.
	StatusLabel = "status"
	// ErrorLabel is a label for an error of a failed provider response.
	ErrorLabel = "error"
	// ErrorCodeLabel is a label for and an error code of a failed provider response.
	ErrorCodeLabel = "code"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ProviderMetrics

type ProviderMetrics interface {
	// AddProviderResponseByID increments the number of ticks with a fully successful provider update
	// for a given provider and ID (i.e. currency pair).
	AddProviderResponseByID(providerName, id string, status Status, ec providertypes.ErrorCode, providerType providertypes.ProviderType)

	// AddProviderResponse increments the number of ticks with a fully successful provider update.
	AddProviderResponse(providerName string, status Status, ec providertypes.ErrorCode, providerType providertypes.ProviderType)

	// LastUpdated updates the last time a given ID (i.e. currency pair) was updated.
	LastUpdated(providerName, id string, providerType providertypes.ProviderType)
}

ProviderMetrics is an interface that defines the API for metrics collection for providers. The base provider utilizes this interface to collect metrics, whether the underlying implementation is API or websocket based.

func NewNopProviderMetrics

func NewNopProviderMetrics() ProviderMetrics

NewNopProviderMetrics returns a Provider Metrics implementation that does not collect metrics.

func NewProviderMetrics

func NewProviderMetrics() ProviderMetrics

NewProviderMetrics returns a Provider Metrics implementation that uses Prometheus.

func NewProviderMetricsFromConfig

func NewProviderMetricsFromConfig(config config.MetricsConfig) ProviderMetrics

NewProviderMetricsFromConfig returns a new Metrics struct given the main oracle metrics config.

type ProviderMetricsImpl

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

ProviderMetricsImpl contains metrics exposed by this package.

func (*ProviderMetricsImpl) AddProviderResponse

func (m *ProviderMetricsImpl) AddProviderResponse(providerName string, status Status, ec providertypes.ErrorCode, providerType providertypes.ProviderType)

AddProviderResponse increments the number of ticks with a fully successful provider update.

func (*ProviderMetricsImpl) AddProviderResponseByID

func (m *ProviderMetricsImpl) AddProviderResponseByID(providerName, id string, status Status, ec providertypes.ErrorCode, providerType providertypes.ProviderType)

AddProviderResponseByID increments the number of ticks with a fully successful provider update for a given provider and ID (i.e. currency pair).

func (*ProviderMetricsImpl) LastUpdated

func (m *ProviderMetricsImpl) LastUpdated(providerName, id string, providerType providertypes.ProviderType)

LastUpdated updates the last time a given ID (i.e. currency pair) was updated.

type Status

type Status string
const (
	Success Status = "success"
	Failure Status = "failure"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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