Documentation ¶
Index ¶
- Constants
- Variables
- func APIRequestAndTimeGraphQL(request string, time float64)
- func APIRequestAndTimeREST(request string, time float64)
- func AddBlockHandlingTime(duration time.Duration)
- func BlockCounterInc(labelValues ...string)
- func EventBusPublishedEventsAdd(event string, eventCount float64)
- func EventCounterInc(labelValues ...string)
- func PublishedEventsAdd(event string, eventCount float64)
- func SetBlockHeight(height float64)
- func SetLastSnapshotCurrentStateBytes(bytes float64)
- func SetLastSnapshotHistoryBytes(bytes float64)
- func SetLastSnapshotRowcount(count float64)
- func SetLastSnapshotSeconds(seconds float64)
- func Start(conf Config)
- func StartAPIRequestAndTimeGRPC(request string) func()
- func StartActiveEventBusConnection() func()
- func StartActiveSubscriptionCountGRPC(subscribedToType string) func()
- func StartEventBusActiveSubscriptionCount(eventTypes []events.Type)
- func StartSQLQuery(store string, query string) func()
- func StopEventBusActiveSubscriptionCount(eventTypes []events.Type)
- 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 APIRequestAndTimeGraphQL ¶
APIRequestAndTimeGraphQL updates the metrics for GraphQL API calls.
func APIRequestAndTimeREST ¶
APIRequestAndTimeREST updates the metrics for REST API calls.
func AddBlockHandlingTime ¶
func BlockCounterInc ¶
func BlockCounterInc(labelValues ...string)
func EventCounterInc ¶
func EventCounterInc(labelValues ...string)
func PublishedEventsAdd ¶
func SetBlockHeight ¶
func SetBlockHeight(height float64)
func SetLastSnapshotCurrentStateBytes ¶ added in v0.57.0
func SetLastSnapshotCurrentStateBytes(bytes float64)
func SetLastSnapshotHistoryBytes ¶ added in v0.57.0
func SetLastSnapshotHistoryBytes(bytes float64)
func SetLastSnapshotRowcount ¶ added in v0.57.0
func SetLastSnapshotRowcount(count float64)
func SetLastSnapshotSeconds ¶ added in v0.57.0
func SetLastSnapshotSeconds(seconds float64)
func StartAPIRequestAndTimeGRPC ¶
func StartAPIRequestAndTimeGRPC(request string) func()
StartAPIRequestAndTimeGRPC updates the metrics for GRPC API calls.
func StartActiveEventBusConnection ¶
func StartActiveEventBusConnection() func()
func StartActiveSubscriptionCountGRPC ¶
func StartActiveSubscriptionCountGRPC(subscribedToType string) func()
func StartSQLQuery ¶
Types ¶
type Config ¶
type Config struct { Level encoding.LogLevel `long:"log-level" description:" "` Timeout encoding.Duration `long:"timeout" description:" "` Port int `long:"port" description:" "` Path string `long:"path" description:" "` Enabled encoding.Bool `long:"enabled" description:" "` }
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() }
func (*TimeCounter) EventTimeCounterAdd ¶
func (tc *TimeCounter) EventTimeCounterAdd()
func (*TimeCounter) FlushTimeCounterAdd ¶
func (tc *TimeCounter) FlushTimeCounterAdd()
func (*TimeCounter) SQLQueryTimeCounterAdd ¶
func (tc *TimeCounter) SQLQueryTimeCounterAdd()