Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CollectHub *collectorHub
Functions ¶
func InitCollectorHub ¶
Types ¶
type Collector ¶
type Collector interface { Update() // AutoTrigger auto trigger the update by Interval() when true // default is true // if you use middleware, AutoTrigger is usually false AutoTrigger() bool Metrics() []*Metric // Interval the interval of the Update() to collect metrics Interval() time.Duration Middleware(c *gin.Context) // contains filtered or unexported methods }
Collector can collect many metrics by one Update()
type DefaultCollector ¶
type DefaultCollector struct{}
func (*DefaultCollector) AutoTrigger ¶
func (x *DefaultCollector) AutoTrigger() bool
func (*DefaultCollector) Interval ¶
func (x *DefaultCollector) Interval() time.Duration
func (*DefaultCollector) Metrics ¶
func (x *DefaultCollector) Metrics() []*Metric
func (*DefaultCollector) Middleware ¶
func (x *DefaultCollector) Middleware(c *gin.Context)
func (*DefaultCollector) Update ¶
func (x *DefaultCollector) Update()
type Metric ¶
type Metric struct { Metric *prometheus.GaugeVec // every metric may have an alert rule //todo push alert to prometheus config AlertRule *v1.AlertingRule // contains filtered or unexported fields }
func NewMetrics ¶
func (*Metric) GenAlertRuleYaml ¶
func (*Metric) Register ¶
func (m *Metric) Register(registry *prometheus.Registry)
func (*Metric) Unregister ¶
func (m *Metric) Unregister(registry *prometheus.Registry)
Click to show internal directories.
Click to hide internal directories.