Documentation ¶
Index ¶
- Constants
- func NewMetric(m *Metric, subsystem string) prometheus.Collector
- func PrometheusHttpHandler() http.Handler
- type Metric
- type PromeMiddleware
- type Prometheus
- func (p *Prometheus) IncGinServiceErr(ctx *gin.Context, serviceName string)
- func (p *Prometheus) IncOrangeServiceErr(ctx *app.Context, serviceName string)
- func (p *Prometheus) MiddlewareGinHandlerFunc() gin.HandlerFunc
- func (p *Prometheus) PromeMetrics(name string) prometheus.Collector
- func (p *Prometheus) RegisterCustomerMetrics(name string, Desc string, MetrixType string, Args []string) *Prometheus
- func (p *Prometheus) Use(e *gin.Engine)
Constants ¶
View Source
const ( CounterVec = "counter_vec" Counter = "counter" GaugeVec = "gauge_vec" Gauge = "gauge" HistogramVec = "histogram_vec" Histogram = "histogram" SummaryVec = "summary_vec" Summary = "summary" )
Variables ¶
This section is empty.
Functions ¶
func NewMetric ¶
func NewMetric(m *Metric, subsystem string) prometheus.Collector
NewMetric associates prometheus.Collector based on Metric.Type
func PrometheusHttpHandler ¶
PrometheusHandler metrics指标httpHandler
Types ¶
type Metric ¶
type Metric struct { MetricCollector prometheus.Collector ID string Name string Description string Type string Args []string }
Metric is a definition for the name, description, type, ID, and prometheus.Collector type (i.e. CounterVec, Summary, etc) of each metric
type PromeMiddleware ¶
type PromeMiddleware struct {
PromeHandler *Prometheus
}
func NewPromeMiddleware ¶
func NewPromeMiddleware(p *Prometheus) *PromeMiddleware
func (PromeMiddleware) Func ¶
func (p PromeMiddleware) Func() app.MiddlewareFunc
Func implements Middleware interface.
type Prometheus ¶
type Prometheus struct { MetricsList []*Metric MetricsPath string // contains filtered or unexported fields }
Prometheus contains the metrics gathered by the instance and its path
func NewPrometheus ¶
func NewPrometheus(subsystem string) *Prometheus
NewPrometheus generates a new set of metrics with a certain subsystem name
func PromeHandler ¶
func PromeHandler() *Prometheus
func (*Prometheus) IncGinServiceErr ¶
func (p *Prometheus) IncGinServiceErr(ctx *gin.Context, serviceName string)
服务异常报错 Gin 框架
[]string{"method", "srv_name", "handler"}}
func (*Prometheus) IncOrangeServiceErr ¶
func (p *Prometheus) IncOrangeServiceErr(ctx *app.Context, serviceName string)
服务异常报错 orange框架
[]string{"method", "srv_name", "handler"}}
func (*Prometheus) MiddlewareGinHandlerFunc ¶
func (p *Prometheus) MiddlewareGinHandlerFunc() gin.HandlerFunc
MiddlewareGinHandlerFunc HandlerFunc defines handler function for middleware
func (*Prometheus) PromeMetrics ¶
func (p *Prometheus) PromeMetrics(name string) prometheus.Collector
func (*Prometheus) RegisterCustomerMetrics ¶
func (p *Prometheus) RegisterCustomerMetrics(name string, Desc string, MetrixType string, Args []string) *Prometheus
func (*Prometheus) Use ¶
func (p *Prometheus) Use(e *gin.Engine)
Click to show internal directories.
Click to hide internal directories.