Documentation ¶
Index ¶
- Constants
- func Add(name string, labelValues []string, value float64) error
- func AddWithLabel(name string, labelValues map[string]string, value float64) error
- func Inc(name string, labelValues []string) error
- func IncWithLabel(name string, labelValues map[string]string) error
- func Init(g *gin.Engine, namespace, systemName string) error
- func InitMetric(metricsValues []*MetricValue) error
- func MetricMiddleware(c *gin.Context)
- func NewCounterFunc(opts prometheus.CounterOpts, function func() []*LabelAndValue) prometheus.CounterFunc
- func NewGaugeFunc(opts prometheus.GaugeOpts, function func() []*LabelAndValue) prometheus.GaugeFunc
- func Observe(name string, labelValues []string, value float64) error
- func ObserveWithLabel(name string, labelValues map[string]string, value float64) error
- func SetGaugeValue(name string, labelValues []string, value float64) error
- func SetGaugeValueWithLabel(name string, labelValues map[string]string, value float64) error
- type Collector
- type LabelAndValue
- type Metric
- func GenerateCounter(metricValue *MetricValue) (*Metric, error)
- func GenerateGauge(metricValue *MetricValue) (*Metric, error)
- func GenerateHistogram(metricValue *MetricValue) (*Metric, error)
- func GenerateSummary(metricValue *MetricValue) (*Metric, error)
- func GetMetric(name string) (*Metric, error)
- func (m *Metric) Add(labelValues []string, value float64) error
- func (m *Metric) AddWithLabel(labelValues map[string]string, value float64) error
- func (m *Metric) GetVec() prometheus.Collector
- func (m *Metric) Inc(labelValues []string) error
- func (m *Metric) IncWithLabel(labelValues map[string]string) error
- func (m *Metric) Observe(labelValues []string, value float64) error
- func (m *Metric) ObserveWithLabel(labelValues map[string]string, value float64) error
- func (m *Metric) SetGaugeValue(labelValues []string, value float64) error
- func (m *Metric) SetGaugeValueWithLabel(labelValues map[string]string, value float64) error
- type MetricManager
- func (p *MetricManager) GenerateCounter(metricValue *MetricValue) (*Metric, error)
- func (p *MetricManager) GenerateGauge(metricValue *MetricValue) (*Metric, error)
- func (p *MetricManager) GenerateHistogram(metricValue *MetricValue) (*Metric, error)
- func (p *MetricManager) GenerateSummary(metricValue *MetricValue) (*Metric, error)
- func (p *MetricManager) GetMetric(name string) (*Metric, error)
- type MetricType
- type MetricValue
- type SelfCollector
Constants ¶
View Source
const ( ReqCount = "http_request_count" ReqDuration = "http_request_duration_seconds" ReqSizeBytes = "http_request_size_bytes" RespSizeBytes = "http_response_size_bytes" )
View Source
const ( Method = "method" Path = "path" Status = "status" )
View Source
const (
DefaultNamespace = "bml"
)
Variables ¶
This section is empty.
Functions ¶
func AddWithLabel ¶
func MetricMiddleware ¶
func NewCounterFunc ¶
func NewCounterFunc(opts prometheus.CounterOpts, function func() []*LabelAndValue) prometheus.CounterFunc
func NewGaugeFunc ¶
func NewGaugeFunc(opts prometheus.GaugeOpts, function func() []*LabelAndValue) prometheus.GaugeFunc
func ObserveWithLabel ¶
Types ¶
type Collector ¶
type Collector interface { Describe(chan<- *prometheus.Desc) Collect(chan<- prometheus.Metric) }
type LabelAndValue ¶
type Metric ¶
type Metric struct { Type MetricType Name string Help string Labels []string Buckets []float64 Objectives map[float64]float64 // contains filtered or unexported fields }
Metric defines a metric object. Users can use it to save metric data. Every metric should be globally unique by name.
func GenerateCounter ¶
func GenerateCounter(metricValue *MetricValue) (*Metric, error)
func GenerateGauge ¶
func GenerateGauge(metricValue *MetricValue) (*Metric, error)
func GenerateHistogram ¶
func GenerateHistogram(metricValue *MetricValue) (*Metric, error)
func GenerateSummary ¶
func GenerateSummary(metricValue *MetricValue) (*Metric, error)
func (*Metric) Add ¶
Add adds the given value to the Metric object. Only for Counter/Gauge type metric.
func (*Metric) AddWithLabel ¶
func (*Metric) GetVec ¶
func (m *Metric) GetVec() prometheus.Collector
func (*Metric) ObserveWithLabel ¶
func (*Metric) SetGaugeValue ¶
SetGaugeValue set data for Gauge type Metric with values.
type MetricManager ¶
type MetricManager struct {
// contains filtered or unexported fields
}
func (*MetricManager) GenerateCounter ¶
func (p *MetricManager) GenerateCounter(metricValue *MetricValue) (*Metric, error)
Generate Counter metrics
func (*MetricManager) GenerateGauge ¶
func (p *MetricManager) GenerateGauge(metricValue *MetricValue) (*Metric, error)
Generate Gauge metric
func (*MetricManager) GenerateHistogram ¶
func (p *MetricManager) GenerateHistogram(metricValue *MetricValue) (*Metric, error)
Generate Histogram metric
func (*MetricManager) GenerateSummary ¶
func (p *MetricManager) GenerateSummary(metricValue *MetricValue) (*Metric, error)
Generate Summary metric
type MetricType ¶
type MetricType string
const ( Counter MetricType = "counter" Gauge MetricType = "gauge" Histogram MetricType = "histogram" Summary MetricType = "summary" Untyped MetricType = "untyped" )
type MetricValue ¶
type MetricValue struct { ValueType MetricType Name string Help string Labels []string Buckets []float64 }
type SelfCollector ¶
type SelfCollector struct {
// contains filtered or unexported fields
}
func NewSelfCollector ¶
func NewSelfCollector(desc *prometheus.Desc, valueType prometheus.ValueType, function func() []*LabelAndValue) *SelfCollector
func (*SelfCollector) Collect ¶
func (c *SelfCollector) Collect(ch chan<- prometheus.Metric)
func (*SelfCollector) Desc ¶
func (v *SelfCollector) Desc() *prometheus.Desc
func (*SelfCollector) Describe ¶
func (c *SelfCollector) Describe(ch chan<- *prometheus.Desc)
Click to show internal directories.
Click to hide internal directories.