Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Gatherer prometheus.Gatherer // The gatherer is for fetching metrics from the registry.
)
registerer is the global metrics center for collecting the telemetry data in core modules or plugins.
Functions ¶
func Register ¶
func Register(meta ...SelfTelemetryMetaFunc)
Register registers the metric meta to the registerer.
Types ¶
type Config ¶
type Config struct { Cluster string `mapstructure:"cluster"` // The cluster name. Service string `mapstructure:"service"` // The service name. Instance string `mapstructure:"instance"` // The instance name. }
Config defines the common telemetry labels.
type Counter ¶
type Counter struct { Collector // contains filtered or unexported fields }
The counter metric.
func NewCounter ¶
NewCounter create a new counter if no metric with the same name exists.
type DynamicGauge ¶ added in v0.4.0
type DynamicGauge struct { Collector // contains filtered or unexported fields }
func NewDynamicGauge ¶ added in v0.4.0
func NewDynamicGauge(name, help string, labels ...string) *DynamicGauge
func (*DynamicGauge) Dec ¶ added in v0.4.0
func (i *DynamicGauge) Dec(labels ...string)
func (*DynamicGauge) Inc ¶ added in v0.4.0
func (i *DynamicGauge) Inc(labels ...string)
type Gauge ¶ added in v0.4.0
type Gauge struct { Collector // contains filtered or unexported fields }
type SelfTelemetryMetaFunc ¶
type SelfTelemetryMetaFunc func() (string, prometheus.Collector)
SelfTelemetryMetaFunc returns the metric name and the metric instance.
func WithMeta ¶
func WithMeta(name string, collector prometheus.Collector) SelfTelemetryMetaFunc
WithMeta is used as the param of the Register function.
type TimeRecorder ¶ added in v0.4.0
type TimeRecorder struct {
// contains filtered or unexported fields
}
func (*TimeRecorder) Stop ¶ added in v0.4.0
func (c *TimeRecorder) Stop()
Stop the time and record the time
type Timer ¶ added in v0.4.0
type Timer struct { Collector // contains filtered or unexported fields }
func NewTimer ¶ added in v0.4.0
NewCounter create a new counter if no metric with the same name exists.
func (*Timer) Start ¶ added in v0.4.0
func (c *Timer) Start(labelValues ...string) *TimeRecorder
Start a new time recorder
Click to show internal directories.
Click to hide internal directories.