Documentation ¶
Index ¶
Constants ¶
View Source
const ( Namespace = "push" InstanceName = "instance" JobName = "job" TypeGauge = "G" TypeCounter = "C" )
Variables ¶
This section is empty.
Functions ¶
func NewExporterHandler ¶
func NewExporterHandler(mgr *MetricMgr) http.HandlerFunc
///////////////////////////////////////////////////////////
func NewPushHandler ¶
func NewPushHandler(mgr *MetricMgr) http.HandlerFunc
Types ¶
type BuiltinMetrics ¶
type BuiltinMetrics struct {
Up prometheus.Gauge
}
func NewBuiltinMetrics ¶
func NewBuiltinMetrics(hostName string) *BuiltinMetrics
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func (Counter) Desc ¶
func (this Counter) Desc() *prometheus.Desc
type CounterVec ¶
type CounterVec struct {
*prometheus.MetricVec
}
func NewCounterVec ¶
func NewCounterVec(name, help string, labelNames []string) *CounterVec
func (*CounterVec) GetMetricWithLabelValues ¶
func (v *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error)
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
func (*Exporter) Collect ¶
func (this *Exporter) Collect(ch chan<- prometheus.Metric)
func (*Exporter) Describe ¶
func (this *Exporter) Describe(ch chan<- *prometheus.Desc)
type MetricMgr ¶
type MetricMgr struct { Builtin *BuiltinMetrics // contains filtered or unexported fields }
func NewMetricMgr ¶
func NewMetricMgr() *MetricMgr
func (*MetricMgr) AddMetric ¶
func (this *MetricMgr) AddMetric(m *MetricValue, now int64)
func (*MetricMgr) CreateCounter ¶
func (this *MetricMgr) CreateCounter(m *MetricValue) (Counter, error)
func (*MetricMgr) CreateGauge ¶
func (this *MetricMgr) CreateGauge(m *MetricValue) (prometheus.Gauge, error)
func (*MetricMgr) GetMetrics ¶
func (this *MetricMgr) GetMetrics() map[string]*MetricValue
type MetricValue ¶
type MetricValue struct { Metric string `json:"metric"` Instance string `json:"endpoint"` Job string `json:"job"` Tags string `json:"tags"` Value float64 `json:"value"` Type string `json:"type"` Step int64 `json:"step"` ExpireTime int64 `json:"-"` }
func (*MetricValue) GetLabels ¶
func (this *MetricValue) GetLabels() ([]string, []string)
func (*MetricValue) IsCounter ¶
func (this *MetricValue) IsCounter() bool
func (*MetricValue) IsValid ¶
func (this *MetricValue) IsValid(now int64) bool
func (*MetricValue) Key ¶
func (this *MetricValue) Key() string
func (*MetricValue) MetricKey ¶
func (this *MetricValue) MetricKey(labelNames []string) string
func (*MetricValue) String ¶
func (this *MetricValue) String() string
Click to show internal directories.
Click to hide internal directories.