Documentation ¶
Index ¶
- type Metric
- type MetricType
- type Monitor
- func (m *Monitor) AddMetric(metric *Metric) error
- func (m *Monitor) AppendDisableRecordMetrics(path ...string)
- func (m *Monitor) Expose(r gin.IRoutes)
- func (m *Monitor) GetIdc() (idc string)
- func (m *Monitor) GetInstance() (ins string)
- func (m *Monitor) GetMetric(name string) *Metric
- func (m *Monitor) GetMetricFullName(metricName string) string
- func (m *Monitor) PathDisableRecordMetrics(p string) (res bool)
- func (m *Monitor) SetDuration(duration []float64)
- func (m *Monitor) SetIdc(idc string)
- func (m *Monitor) SetInstance(ins string)
- func (m *Monitor) SetMetricPath(path string)
- func (m *Monitor) SetMetricPrefix(prefix 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) AppendDisableRecordMetrics ¶
func (*Monitor) Expose ¶
Expose adds metric path to a given router. The router can be different with the one passed to UseWithoutExposingEndpoint. This allows to expose metrics on different port.
func (*Monitor) GetInstance ¶ added in v0.0.4
func (*Monitor) GetMetricFullName ¶ added in v0.0.4
func (*Monitor) PathDisableRecordMetrics ¶ added in v0.0.4
func (*Monitor) SetDuration ¶
SetDuration set reqDuration property. reqDuration is used to ginRequestDuration metric buckets.
func (*Monitor) SetInstance ¶ added in v0.0.4
func (*Monitor) SetMetricPath ¶
SetMetricPath set metricPath property. metricPath is used for Prometheus to get gin server monitoring data.
func (*Monitor) SetMetricPrefix ¶
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 ¶
UseWithoutExposingEndpoint is used to add monitor interceptor to gin router It can be called multiple times to intercept from multiple gin.IRoutes http path is not set, to do that use Expose function