metric

package
v2.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Errors errors count metric.
	Errors = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: namespaceError,
			Name:      "errors",
			Help:      "",
		}, []string{"error"})

	// WaitServerProof duration time to get the calculated
	// proof from the server.
	WaitServerProof = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: namespaceSync,
			Name:      "wait_server_proof",
			Help:      "",
		}, []string{"batch_number", "pipeline_number"})

	// Reorgs block reorg count
	Reorgs = prometheus.NewCounter(
		prometheus.CounterOpts{
			Namespace: namespaceSync,
			Name:      "reorgs",
			Help:      "",
		})

	// LastBlockNum last block synced
	LastBlockNum = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: namespaceSync,
			Name:      "synced_last_block_num",
			Help:      "",
		})

	// EthLastBlockNum last eth block synced
	EthLastBlockNum = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: namespaceSync,
			Name:      "eth_last_block_num",
			Help:      "",
		})

	// LastBatchNum last batch synced
	LastBatchNum = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: namespaceSync,
			Name:      "synced_last_batch_num",
			Help:      "",
		})

	// EthLastBatchNum last eth batch synced
	EthLastBatchNum = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: namespaceSync,
			Name:      "eth_last_batch_num",
			Help:      "",
		})

	// GetL2TxSelection L2 tx selection count
	GetL2TxSelection = prometheus.NewCounter(
		prometheus.CounterOpts{
			Namespace: namespaceTxSelector,
			Name:      "get_l2_txselection_total",
			Help:      "",
		})

	// GetL1L2TxSelection L1L2 tx selection count
	GetL1L2TxSelection = prometheus.NewCounter(
		prometheus.CounterOpts{
			Namespace: namespaceTxSelector,
			Name:      "get_l1_l2_txselection_total",
			Help:      "",
		})

	// SelectedL1CoordinatorTxs selected L1 coordinator tx count
	SelectedL1CoordinatorTxs = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: namespaceTxSelector,
			Name:      "selected_l1_coordinator_txs",
			Help:      "",
		})

	// SelectedL1UserTxs selected L1 user tx count
	SelectedL1UserTxs = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: namespaceTxSelector,
			Name:      "selected_l1_user_txs",
			Help:      "",
		})

	// SelectedL2Txs selected L2 tx count
	SelectedL2Txs = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: namespaceTxSelector,
			Name:      "selected_l2_txs",
			Help:      "",
		})

	// DiscardedL2Txs discarded L2 tx count
	DiscardedL2Txs = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: namespaceTxSelector,
			Name:      "discarded_l2_txs",
			Help:      "",
		})
)

Functions

func CollectError

func CollectError(err error)

CollectError collect the error message and increment the error count

func MeasureDuration

func MeasureDuration(histogram *prometheus.HistogramVec, start time.Time, lvs ...string)

MeasureDuration measure the method execution duration and save it into a histogram metric

func PrometheusMiddleware

func PrometheusMiddleware() (gin.HandlerFunc, error)

PrometheusMiddleware creates the prometheus collector and defines status handler function for the middleware

Types

type Metric

type Metric string

Metric represents the metric type

type Prometheus

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

Prometheus contains the metrics gathered by the instance and its path

func NewPrometheus

func NewPrometheus() (*Prometheus, error)

NewPrometheus generates a new set of metrics with a certain subsystem name

func (*Prometheus) Middleware

func (p *Prometheus) Middleware() gin.HandlerFunc

Middleware defines status handler function for middleware

Jump to

Keyboard shortcuts

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