Documentation ¶
Index ¶
- Constants
- Variables
- func APIRequestAndTimeGRPC(request string, startTime time.Time)
- func APIRequestAndTimeGraphQL(request string, time float64)
- func APIRequestAndTimeREST(method, request string, time float64)
- func DataSourceEthVerifierCallCounterInc(labelValues ...string)
- func DataSourceEthVerifierCallGaugeAdd(n int, labelValues ...string)
- func DataSourceEthVerifierCallGaugeReset(labelValues ...string)
- func EthCallInc(labelValues ...string)
- func EthereumRPCCallCounterInc(labelValues ...string)
- func EvtForwardInc(labelValues ...string)
- func OrderCounterInc(labelValues ...string)
- func OrderGaugeAdd(n int, labelValues ...string)
- func RegisterSnapshotBlockHeight(blockHeight uint64)
- func RegisterSnapshotNamespaces(namespace string, timeTaken time.Duration, size int)
- func Start(conf Config)
- func StartAPIRequestAndTimeGRPC(request string) func()
- func StartSnapshot(namespace string) func()
- func UnconfirmedTxGaugeSet(n int)
- type Config
- type InstrumentOption
- func AgeBuckets(ab uint32) InstrumentOption
- func Buckets(b []float64) InstrumentOption
- func BufCap(bc uint32) InstrumentOption
- func Help(help string) InstrumentOption
- func Labels(labels map[string]string) InstrumentOption
- func MaxAge(m time.Duration) InstrumentOption
- func Namespace(ns string) InstrumentOption
- func Objectives(obj map[float64]float64) InstrumentOption
- func Subsystem(s string) InstrumentOption
- func Vectors(labels ...string) InstrumentOption
- type MetricInstrument
- type TimeCounter
Constants ¶
const ( // Gauge ... Gauge instrument = iota // Counter ... Counter // Histogram ... Histogram // Summary ... Summary )
Variables ¶
var ( // ErrInstrumentNotSupported signals the specified instrument is not yet supported. ErrInstrumentNotSupported = errors.New("instrument type unsupported") // ErrInstrumentTypeMismatch signal the type of the instrument is not expected. ErrInstrumentTypeMismatch = errors.New("instrument is not of the expected type") )
Functions ¶
func APIRequestAndTimeGRPC ¶
APIRequestAndTimeGRPC updates the metrics for GRPC API calls.
func APIRequestAndTimeGraphQL ¶
APIRequestAndTimeGraphQL updates the metrics for GraphQL API calls.
func APIRequestAndTimeREST ¶
APIRequestAndTimeREST updates the metrics for REST API calls.
func DataSourceEthVerifierCallCounterInc ¶ added in v0.73.6
func DataSourceEthVerifierCallCounterInc(labelValues ...string)
DataSourceEthVerifierCallCounterInc increments the order counter.
func DataSourceEthVerifierCallGaugeAdd ¶ added in v0.73.6
DataSourceEthVerifierCallGaugeAdd increments the eth verified calls.
func DataSourceEthVerifierCallGaugeReset ¶ added in v0.73.6
func DataSourceEthVerifierCallGaugeReset(labelValues ...string)
func EthCallInc ¶
func EthCallInc(labelValues ...string)
EthCallInc increments the eth call counter.
func EthereumRPCCallCounterInc ¶ added in v0.74.0
func EthereumRPCCallCounterInc(labelValues ...string)
EthereumRPCCallCounterInc increments the order counter.
func EvtForwardInc ¶
func EvtForwardInc(labelValues ...string)
EvtForwardInc increments the evt forward counter.
func OrderCounterInc ¶
func OrderCounterInc(labelValues ...string)
OrderCounterInc increments the order counter.
func OrderGaugeAdd ¶
OrderGaugeAdd increment the order gauge.
func RegisterSnapshotBlockHeight ¶ added in v0.73.0
func RegisterSnapshotBlockHeight( blockHeight uint64, )
func RegisterSnapshotNamespaces ¶ added in v0.73.0
func StartAPIRequestAndTimeGRPC ¶
func StartAPIRequestAndTimeGRPC(request string) func()
StartAPIRequestAndTimeGRPC updates the metrics for GRPC API calls.
func StartSnapshot ¶
func StartSnapshot(namespace string) func()
func UnconfirmedTxGaugeSet ¶
func UnconfirmedTxGaugeSet(n int)
UnconfirmedTxGaugeSet update the number of unconfirmed transactions.
Types ¶
type Config ¶
type Config struct { Level encoding.LogLevel `description:" " long:"log-level"` Timeout encoding.Duration `description:" " long:"timeout"` Port int `description:" " long:"port"` Path string `description:" " long:"path"` Enabled encoding.Bool `description:" " long:"enabled"` }
Config represents the configuration of the metric package.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.
type InstrumentOption ¶
type InstrumentOption func(o *instrumentOpts)
InstrumentOption - vararg for instrument options setting.
func AgeBuckets ¶
func AgeBuckets(ab uint32) InstrumentOption
AgeBuckets - specific to summary type.
func Labels ¶
func Labels(labels map[string]string) InstrumentOption
Labels set labels for instrument (similar to vector, but with given values).
func Objectives ¶
func Objectives(obj map[float64]float64) InstrumentOption
Objectives - specific to summary type.
func Vectors ¶
func Vectors(labels ...string) InstrumentOption
Vectors - configuration used to create a vector of a given interface, slice of label names.
type MetricInstrument ¶
type MetricInstrument interface { Gauge() (prometheus.Gauge, error) GaugeVec() (*prometheus.GaugeVec, error) Counter() (prometheus.Counter, error) CounterVec() (*prometheus.CounterVec, error) Histogram() (prometheus.Histogram, error) HistogramVec() (*prometheus.HistogramVec, error) Summary() (prometheus.Summary, error) SummaryVec() (*prometheus.SummaryVec, error) }
MetricInstrument - template interface for mi type return value - only mock if needed, and only mock the funcs you use.
type TimeCounter ¶
type TimeCounter struct {
// contains filtered or unexported fields
}
TimeCounter holds a time.Time and a list of label values, hiding the start time from being accidentally overwritten, and removing the need to duplicate the label values.
func NewTimeCounter ¶
func NewTimeCounter(labelValues ...string) *TimeCounter
NewTimeCounter returns a new TimeCounter, with the start time already recorded.
func (*TimeCounter) EngineTimeCounterAdd ¶
func (tc *TimeCounter) EngineTimeCounterAdd()
EngineTimeCounterAdd is used to time a function. e.g.
func DoSomething() { timer := metrics.NewTimeCounter("x", "y", "z") // do something timer.EngineTimeCounterAdd() }