Documentation
¶
Overview ¶
Package metrics defines the reporter's Prometheus collectors and serves them.
Index ¶
- func Serve(ctx context.Context, lis net.Listener, g prometheus.Gatherer) error
- type Metrics
- func (m *Metrics) AddTxFees(uakt float64)
- func (m *Metrics) AddTxInFlight(delta float64)
- func (m *Metrics) ObservePass(d time.Duration, transfers int)
- func (m *Metrics) RecordAlert(alert string)
- func (m *Metrics) RecordCache(cache string, hit bool)
- func (m *Metrics) RecordDeferred(reason string)
- func (m *Metrics) RecordRPC(chain, method string, d time.Duration, err error)
- func (m *Metrics) RecordReview(result string)
- func (m *Metrics) RecordTx(result string)
- func (m *Metrics) RecordTxMessage(msgType string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Metrics ¶
type Metrics struct {
PassDuration prometheus.Histogram
PassTransfers prometheus.Gauge
Reviews *prometheus.CounterVec
Alerts *prometheus.CounterVec
RPCDuration *prometheus.HistogramVec
RPCErrors *prometheus.CounterVec
CacheRequests *prometheus.CounterVec
Tx *prometheus.CounterVec
TxMessages *prometheus.CounterVec
TxFeesUakt prometheus.Counter
TxInFlight prometheus.Gauge
DeferredMessages *prometheus.CounterVec
}
Metrics holds the collectors of spec section 9.3. Every method is safe on a nil *Metrics and records nothing.
func New ¶
func New(reg prometheus.Registerer) *Metrics
New creates the collectors and registers them with reg.
func (*Metrics) AddTxInFlight ¶
AddTxInFlight changes the number of transactions awaiting confirmation by delta.
func (*Metrics) ObservePass ¶
ObservePass records a finished pass and the number of transfers it reviewed.
func (*Metrics) RecordAlert ¶
RecordAlert counts an alert of the given kind.
func (*Metrics) RecordCache ¶
RecordCache counts a lookup in the named cache as a hit or a miss.
func (*Metrics) RecordDeferred ¶
RecordDeferred counts a deferred message with reason slot_busy, slot_full, cutoff, simulation or cap.
func (*Metrics) RecordRPC ¶
RecordRPC records an RPC call on chain "akash" or "solana"; a non-nil err also counts as an error.
func (*Metrics) RecordReview ¶
RecordReview counts a review with result "ok" or "error".
func (*Metrics) RecordTx ¶
RecordTx counts a transaction with result included, failed, rejected, slot_taken, expired or unconfirmed.
func (*Metrics) RecordTxMessage ¶
RecordTxMessage counts a message sent in a transaction.