Documentation ¶
Index ¶
- type Metric
- type MetricType
- type Monitor
- func (m *Monitor) AddMetric(metric *Metric) error
- func (m *Monitor) Expose(r gin.IRoutes)
- func (m *Monitor) GetMetric(name string) *Metric
- func (m *Monitor) SetDuration(duration []float64)
- func (m *Monitor) SetMetricPath(path string)
- func (m *Monitor) SetMetricSuffix(suffix string)
- func (m *Monitor) SetSlowTime(slowTime int32)
- func (m *Monitor) Use(r gin.IRoutes)
- func (m *Monitor) UseWithoutExposingEndpoint(r gin.IRoutes)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metric ¶
type Metric struct { Type MetricType Name string Description 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 (*Metric) Add ¶
Add adds the given value to the Metric object. Only for Counter/Gauge type metric.
type MetricType ¶
type MetricType int
const ( None MetricType = iota Counter Gauge Histogram Summary )
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor is an object that uses to set gin server monitor.
func GetMonitor ¶
func GetMonitor() *Monitor
GetMonitor used to get global Monitor object, this function returns a singleton object.
func (*Monitor) SetDuration ¶
SetDuration set reqDuration property. reqDuration is used to ginRequestDuration metric buckets.
func (*Monitor) SetMetricPath ¶
SetMetricPath set metricPath property. metricPath is used for Prometheus to get gin server monitoring data.
func (*Monitor) SetMetricSuffix ¶
func (*Monitor) SetSlowTime ¶
SetSlowTime set slowTime property. slowTime is used to determine whether the request is slow. For "gin_slow_request_total" metric.
func (*Monitor) UseWithoutExposingEndpoint ¶ added in v0.1.8
Pass endpoints to monitor