metrics

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildStatic

func BuildStatic(gauges []StaticGauge) []prometheus.Collector

BuildStatic returns static metrics

Types

type ClientMetrics

type ClientMetrics interface {
	IncAPIError(host url.URL, reason string)
}

type Cosmos

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

Cosmos records metrics for Cosmos chains

func NewCosmos

func NewCosmos() *Cosmos

func (*Cosmos) IncValSignedBlocks

func (c *Cosmos) IncValSignedBlocks(chain, consaddress string)

IncValSignedBlocks increments the number of blocks signed by validator at consaddress.

func (*Cosmos) Metrics

func (c *Cosmos) Metrics() []prometheus.Collector

Metrics returns all metrics for Cosmos chains to be added to a Prometheus registry.

func (*Cosmos) SetAccountBalance

func (c *Cosmos) SetAccountBalance(chain, alias, address, denom string, balance float64)

SetAccountBalance records the balance of an account for a given denom.

func (*Cosmos) SetNodeHeight

func (c *Cosmos) SetNodeHeight(chain string, height float64)

SetNodeHeight records the block height on the public_rpc_node_height gauge.

func (*Cosmos) SetValJailStatus

func (c *Cosmos) SetValJailStatus(chain, consaddress string, status cosmos.JailStatus)

SetValJailStatus records the jailed status of a validator. In this context, "active" does not mean part of the validator active set, only that the validator is not jailed.

func (*Cosmos) SetValMissedBlocks

func (c *Cosmos) SetValMissedBlocks(chain, consaddress string, missed float64)

SetValMissedBlocks sets the number of missed blocks within the slashing window for a validator.

func (*Cosmos) SetValSignedBlock

func (c *Cosmos) SetValSignedBlock(chain, consaddress string, height float64)

SetValSignedBlock sets latest signed block height for a validator.

func (*Cosmos) SetValSlashingParams

func (c *Cosmos) SetValSlashingParams(chain string, window float64)

SetValSlashingParams sets the slashing window for all validators on the chain. Extend this method to set other slashing parameters.

type FallbackClient

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

func NewFallbackClient

func NewFallbackClient(client *http.Client, metrics ClientMetrics, hosts []url.URL) *FallbackClient

func (FallbackClient) Get

func (c FallbackClient) Get(ctx context.Context, path url.URL) (*http.Response, error)

type Internal

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

Internal records metrics that represent the health of sl-exporter itself.

func NewInternal

func NewInternal() *Internal

func (Internal) IncAPIError

func (c Internal) IncAPIError(host url.URL, reason string)

IncAPIError increments the number of errors encountered while making external API calls.

func (Internal) IncFailedTask

func (c Internal) IncFailedTask(group string)

IncFailedTask increments the number of failed sl-exporter tasks.

func (Internal) Metrics

func (c Internal) Metrics() []prometheus.Collector

type StaticGauge

type StaticGauge struct {
	Name        string
	Description string
	Labels      []string
	Samples     []StaticSample
}

type StaticSample

type StaticSample struct {
	Labels []string
	Value  float64
}

type Task

type Task interface {
	// Group returns the group this task belongs to.
	Group() string
	// ID is a unique identifier for this task.
	ID() string
	// Interval is how often this task runs.
	Interval() time.Duration
	Run(ctx context.Context) error
}

type TaskErrorMetrics

type TaskErrorMetrics interface {
	IncFailedTask(group string)
}

type WorkerPool

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

WorkerPool runs tasks at intervals.

func NewWorkerPool

func NewWorkerPool(tasks []Task, numWorkers int, metrics TaskErrorMetrics) (*WorkerPool, error)

NewWorkerPool creates a new worker pool.

func (*WorkerPool) Start

func (w *WorkerPool) Start(ctx context.Context)

Start continuously runs tasks at intervals until the context is canceled.

Jump to

Keyboard shortcuts

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