(cfg Config, log log.Logger, reg prometheus.Registerer)
| 24 | } |
| 25 | |
| 26 | func newFrontendPool(cfg Config, log log.Logger, reg prometheus.Registerer) *client.Pool { |
| 27 | p := &frontendPool{ |
| 28 | timeout: cfg.FrontendTimeout, |
| 29 | queryResponseFormat: cfg.QueryResponseFormat, |
| 30 | prometheusHTTPPrefix: cfg.PrometheusHTTPPrefix, |
| 31 | grpcConfig: cfg.GRPCClientConfig, |
| 32 | frontendClientRequestDuration: promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{ |
| 33 | Name: "cortex_ruler_query_frontend_request_duration_seconds", |
| 34 | Help: "Time spend doing requests to frontend.", |
| 35 | Buckets: prometheus.ExponentialBuckets(0.001, 4, 6), |
| 36 | }, []string{"operation", "status_code"}), |
| 37 | } |
| 38 | |
| 39 | frontendClientsGauge := promauto.With(reg).NewGauge(prometheus.GaugeOpts{ |
| 40 | Name: "cortex_ruler_query_frontend_clients", |
| 41 | Help: "The current number of clients connected to query-frontend.", |
| 42 | }) |
| 43 | |
| 44 | poolConfig := client.PoolConfig{ |
| 45 | CheckInterval: time.Minute, |
| 46 | HealthCheckEnabled: true, |
| 47 | HealthCheckTimeout: 10 * time.Second, |
| 48 | } |
| 49 | |
| 50 | return client.NewPool("frontend", poolConfig, nil, p.createFrontendClient, frontendClientsGauge, log) |
| 51 | } |
| 52 | |
| 53 | func (f *frontendPool) createFrontendClient(addr string) (client.PoolClient, error) { |
| 54 | opts, err := f.grpcConfig.DialOption(grpcclient.Instrument(f.frontendClientRequestDuration)) |
no test coverage detected