| 35 | } |
| 36 | |
| 37 | func newRulerClientPool(clientCfg grpcclient.Config, logger log.Logger, reg prometheus.Registerer) ClientsPool { |
| 38 | // We prefer sane defaults instead of exposing further config options. |
| 39 | poolCfg := client.PoolConfig{ |
| 40 | CheckInterval: time.Minute, |
| 41 | HealthCheckEnabled: true, |
| 42 | HealthCheckTimeout: 10 * time.Second, |
| 43 | } |
| 44 | |
| 45 | clientsCount := promauto.With(reg).NewGauge(prometheus.GaugeOpts{ |
| 46 | Name: "cortex_ruler_clients", |
| 47 | Help: "The current number of ruler clients in the pool.", |
| 48 | }) |
| 49 | |
| 50 | return &rulerClientsPool{ |
| 51 | client.NewPool("ruler", poolCfg, nil, newRulerClientFactory(clientCfg, reg), clientsCount, logger), |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | func newRulerClientFactory(clientCfg grpcclient.Config, reg prometheus.Registerer) client.PoolFactory { |
| 56 | requestDuration := promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{ |