Documentation ¶
Index ¶
- Variables
- func ClientMetricsUnaryInterceptor(from, to string) grpc.UnaryClientInterceptor
- func HTTPMiddleware(namespace string) func(http.Handler) http.Handler
- func Handler() http.Handler
- func MustRegister(cs ...prometheus.Collector)
- func MustRegisterCounter(name, namespace, help string) prometheus.Counter
- func MustRegisterCounterVec(name, namespace, help string, labelNames []string) *prometheus.CounterVec
- func MustRegisterGauge(name, namespace, help string) prometheus.Gauge
- func MustRegisterGaugeVec(name, namespace, help string, labelNames []string) *prometheus.GaugeVec
- func MustRegisterHistogram(name, namespace, help string, buckets []float64) prometheus.Histogram
- func MustRegisterHistogramVec(name, namespace, help string, buckets []float64, labelNames []string) *prometheus.HistogramVec
- func MustRegisterSummary(name, namespace, help string) prometheus.Summary
- func MustRegisterSummaryVec(name, namespace, help string, labelNames []string) *prometheus.SummaryVec
- func NewCounter(name, namespace, help string) prometheus.Counter
- func NewCounterVec(name, namespace, help string, labelNames []string) *prometheus.CounterVec
- func NewGauge(name, namespace, help string) prometheus.Gauge
- func NewGaugeVec(name, namespace, help string, labelNames []string) *prometheus.GaugeVec
- func NewHistogram(name, namespace, help string, buckets []float64) prometheus.Histogram
- func NewHistogramVec(name, namespace, help string, buckets []float64, labelNames []string) *prometheus.HistogramVec
- func NewSummary(name, namespace, help string) prometheus.Summary
- func NewSummaryVec(name, namespace, help string, labelNames []string) *prometheus.SummaryVec
- func ServerMetricsUnaryInterceptor(namespace string) ...
Constants ¶
This section is empty.
Variables ¶
var ( // TimeBucketsFast suits if expected response time is very high: 1ms..100ms // This buckets suits for cache storages (in-memory cache, Memcache) TimeBucketsFast = []float64{0.001, 0.003, 0.007, 0.015, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10} // TimeBucketsMedium suits for most of GO APIs, where response time is between 50ms..500ms. // Works for wide range of systems because provides near-logarithmic buckets distribution. TimeBucketsMedium = []float64{0.001, 0.005, 0.015, 0.05, 0.1, 0.25, 0.5, 0.75, 1, 1.5, 2, 3.5, 5, 10} // TimeBucketsSlow suits for relatively slow services, where expected response time is > 500ms. TimeBucketsSlow = []float64{0.05, 0.1, 0.2, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5, 10} // SummaryObjectives defines the quantile rank estimates with their respective absolute error. SummaryObjectives = map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001} )
Functions ¶
func ClientMetricsUnaryInterceptor ¶ added in v0.0.9
func ClientMetricsUnaryInterceptor(from, to string) grpc.UnaryClientInterceptor
ClientMetricsUnaryInterceptor returns a new unary client interceptor for metrics from what to namespace here is a prefix for metrics name
For every RPC it exports the following metrics: - client_grpc_request_count{method, code, from, to} - client_grpc_response_time{method, from, to} namespace here is a prefix for metrics name
func HTTPMiddleware ¶ added in v0.2.0
HTTPMiddleware is a middleware for the standard net/http package.
It collects metrics for HTTP requests. It returns a function that takes a handler and returns a handler. This is a pattern for net/http middleware.
For every request, it exports the following metrics: - server_http_request_count{method,path,code} - server_http_response_time{method,path}
func MustRegister ¶
func MustRegister(cs ...prometheus.Collector)
func MustRegisterCounter ¶
func MustRegisterCounter(name, namespace, help string) prometheus.Counter
MustRegisterCounter creates and registers a new Counter. Panics if any error occurs.
func MustRegisterCounterVec ¶
func MustRegisterCounterVec(name, namespace, help string, labelNames []string) *prometheus.CounterVec
MustRegisterCounterVec creates and registers a new CounterVec. Panics if any error occurs.
func MustRegisterGauge ¶
func MustRegisterGauge(name, namespace, help string) prometheus.Gauge
MustRegisterGauge creates and registers a new Gauge. Panics if any error occurs.
func MustRegisterGaugeVec ¶
func MustRegisterGaugeVec(name, namespace, help string, labelNames []string) *prometheus.GaugeVec
MustRegisterGaugeVec creates and registers a new GaugeVec. Panics if any error occurs.
func MustRegisterHistogram ¶
func MustRegisterHistogram(name, namespace, help string, buckets []float64) prometheus.Histogram
MustRegisterHistogram creates and registers a new Histogram. Panics if any error occurs.
func MustRegisterHistogramVec ¶
func MustRegisterHistogramVec(name, namespace, help string, buckets []float64, labelNames []string) *prometheus.HistogramVec
MustRegisterHistogramVec creates and registers a new HistogramVec. Panics if any error occurs.
func MustRegisterSummary ¶
func MustRegisterSummary(name, namespace, help string) prometheus.Summary
MustRegisterSummary creates and registers a new Summary. Panics if any error occurs.
func MustRegisterSummaryVec ¶
func MustRegisterSummaryVec(name, namespace, help string, labelNames []string) *prometheus.SummaryVec
MustRegisterSummaryVec creates and registers a new SummaryVec. Panics if any error occurs.
func NewCounter ¶
func NewCounter(name, namespace, help string) prometheus.Counter
NewCounter creates a new Counter.
func NewCounterVec ¶
func NewCounterVec(name, namespace, help string, labelNames []string) *prometheus.CounterVec
NewCounterVec creates a new CounterVec partitioned by the given label names.
func NewGauge ¶
func NewGauge(name, namespace, help string) prometheus.Gauge
NewGauge creates a new Gauge.
func NewGaugeVec ¶
func NewGaugeVec(name, namespace, help string, labelNames []string) *prometheus.GaugeVec
NewGaugeVec creates a new GaugeVec partitioned by the given label names.
func NewHistogram ¶
func NewHistogram(name, namespace, help string, buckets []float64) prometheus.Histogram
NewHistogram creates a new Histogram.
func NewHistogramVec ¶
func NewHistogramVec(name, namespace, help string, buckets []float64, labelNames []string) *prometheus.HistogramVec
NewHistogramVec creates a new HistogramVec partitioned by the given label names.
func NewSummary ¶
func NewSummary(name, namespace, help string) prometheus.Summary
NewSummary creates a new Summary.
func NewSummaryVec ¶
func NewSummaryVec(name, namespace, help string, labelNames []string) *prometheus.SummaryVec
NewSummaryVec creates a new SummaryVec partitioned by the given label names.
func ServerMetricsUnaryInterceptor ¶ added in v0.0.6
func ServerMetricsUnaryInterceptor(namespace string) func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
ServerMetricsUnaryInterceptor is a gRPC server-side interceptor that provides Prometheus monitoring for Unary RPCs.
For every RPC it exports the following metrics: - server_grpc_request_count{method, code} - server_grpc_response_time{method} namespace here is a prefix for metrics name
Types ¶
This section is empty.