collector

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package collector provides the core functionality of this exporter.

It implements the Prometheus collector interface, providing `monero` metrics whenever a request hits this exporter, allowing us to not have to rely on a particular interval defined in this exporter (instead, rely on prometheus' scrape interval).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(client *daemon.Client, opts ...Option) error

Register registers this collector with the global prometheus collectors registry making it available for an exporter to collect our metrics.

func WithCountryMapper

func WithCountryMapper(v CountryMapper) func(c *Collector)

WithCountryMapper is a functional argument that overrides the default no-op country mapper.

Types

type CollectFunc

type CollectFunc func(ctx context.Context, ch chan<- prometheus.Metric) error

CollectFunc defines a standardized signature for functions that want to expose metrics for collection.

type Collector

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

Collector implements the prometheus Collector interface, providing monero metrics whenever a prometheus scrape is received.

func (*Collector) Collect

func (c *Collector) Collect(ch chan<- prometheus.Metric)

Collect implements the Collect function of the Collector interface.

Here is where all of the calls to a monero rpc endpoint is made, each being wrapped in its own function, all being called concurrently.

func (*Collector) Describe

func (c *Collector) Describe(ch chan<- *prometheus.Desc)

Describe implements the Describe function of the Collector interface.

type ConnectionsCollector

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

func NewConnectionsCollector

func NewConnectionsCollector(
	client *daemon.Client, metricsC chan<- prometheus.Metric,
) *ConnectionsCollector

func (*ConnectionsCollector) Collect

func (c *ConnectionsCollector) Collect(ctx context.Context) error

func (*ConnectionsCollector) Name

func (c *ConnectionsCollector) Name() string

type CountryMapper

type CountryMapper func(net.IP) (string, error)

CountryMapper defines the signature of a function that given an IP, translates it into a country name.

f(ip) -> CN

type CustomCollector

type CustomCollector interface {
	Name() string
	Collect(ctx context.Context) error
}

type LastBlockStatsCollector

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

func NewLastBlockStatsCollector

func NewLastBlockStatsCollector(
	client *daemon.Client, metricsC chan<- prometheus.Metric,
) *LastBlockStatsCollector

func (*LastBlockStatsCollector) Collect

func (c *LastBlockStatsCollector) Collect(ctx context.Context) error

func (*LastBlockStatsCollector) Name

func (c *LastBlockStatsCollector) Name() string

type NetStatsCollector

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

func NewNetStatsCollector

func NewNetStatsCollector(
	client *daemon.Client, metricsC chan<- prometheus.Metric,
) *NetStatsCollector

func (*NetStatsCollector) Collect

func (c *NetStatsCollector) Collect(ctx context.Context) error

func (*NetStatsCollector) Name

func (c *NetStatsCollector) Name() string

type Option

type Option func(c *Collector)

Option is a type used by functional arguments to mutate the collector to override default behavior.

type OverallCollector

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

func NewOverallCollector

func NewOverallCollector(
	client *daemon.Client, metricsC chan<- prometheus.Metric,
) *OverallCollector

func (*OverallCollector) Collect

func (c *OverallCollector) Collect(ctx context.Context) error

func (*OverallCollector) Name

func (c *OverallCollector) Name() string

type PeersCollector

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

func NewPeersCollector

func NewPeersCollector(
	client *daemon.Client, metricsC chan<- prometheus.Metric,
) *PeersCollector

func (*PeersCollector) Collect

func (c *PeersCollector) Collect(ctx context.Context) error

func (*PeersCollector) Name

func (c *PeersCollector) Name() string

type RPCCollector

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

func NewRPCCollector

func NewRPCCollector(
	client *daemon.Client, metricsC chan<- prometheus.Metric,
) *RPCCollector

func (*RPCCollector) Collect

func (c *RPCCollector) Collect(ctx context.Context) error

func (*RPCCollector) Name

func (c *RPCCollector) Name() string

type Summary

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

func NewSummary

func NewSummary(opts ...SummaryOption) *Summary

func (*Summary) Count

func (s *Summary) Count() uint64

func (*Summary) Insert

func (s *Summary) Insert(v float64)

func (*Summary) Quantiles

func (s *Summary) Quantiles() map[float64]float64

func (*Summary) Sum

func (s *Summary) Sum() float64

type SummaryOption

type SummaryOption func(s *Summary)

func WithQuantiles

func WithQuantiles(v map[float64]float64) SummaryOption

type TransactionPoolCollector

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

func NewTransactionPoolCollector

func NewTransactionPoolCollector(
	client *daemon.Client, metricsC chan<- prometheus.Metric,
) *TransactionPoolCollector

func (*TransactionPoolCollector) Collect

func (*TransactionPoolCollector) Name

func (c *TransactionPoolCollector) Name() string

Jump to

Keyboard shortcuts

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