github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/pkg/querier/worker/metrics.go (about) 1 package worker 2 3 import ( 4 "github.com/prometheus/client_golang/prometheus" 5 "github.com/prometheus/client_golang/prometheus/promauto" 6 ) 7 8 type Metrics struct { 9 concurrentWorkers prometheus.Gauge 10 inflightRequests prometheus.Gauge 11 frontendClientRequestDuration *prometheus.HistogramVec 12 frontendClientsGauge prometheus.Gauge 13 } 14 15 func NewMetrics(conf Config, r prometheus.Registerer) *Metrics { 16 return &Metrics{ 17 concurrentWorkers: promauto.With(r).NewGauge(prometheus.GaugeOpts{ 18 Name: "loki_querier_worker_concurrency", 19 Help: "Number of concurrent querier workers", 20 }), 21 inflightRequests: promauto.With(r).NewGauge(prometheus.GaugeOpts{ 22 Name: "loki_querier_worker_inflight_queries", 23 Help: "Number of queries being processed by the querier workers", 24 }), 25 frontendClientRequestDuration: promauto.With(r).NewHistogramVec(prometheus.HistogramOpts{ 26 Name: "loki_querier_query_frontend_request_duration_seconds", 27 Help: "Time spend doing requests to frontend.", 28 Buckets: prometheus.ExponentialBuckets(0.001, 4, 6), 29 }, []string{"operation", "status_code"}), 30 frontendClientsGauge: promauto.With(r).NewGauge(prometheus.GaugeOpts{ 31 Name: "loki_querier_query_frontend_clients", 32 Help: "The current number of clients connected to query-frontend.", 33 }), 34 } 35 }