MCPcopy Create free account
hub / github.com/cortexproject/cortex / newStoreGatewayClientPool

Function newStoreGatewayClientPool

pkg/querier/store_gateway_client.go:70–100  ·  view source on GitHub ↗
(discovery client.PoolServiceDiscovery, clientConfig ClientConfig, logger log.Logger, reg prometheus.Registerer)

Source from the content-addressed store, hash-verified

68}
69
70func newStoreGatewayClientPool(discovery client.PoolServiceDiscovery, clientConfig ClientConfig, logger log.Logger, reg prometheus.Registerer) *client.Pool {
71 // We prefer sane defaults instead of exposing further config options.
72 clientCfg := grpcclient.ConfigWithHealthCheck{
73 Config: grpcclient.Config{
74 MaxRecvMsgSize: 100 << 20,
75 MaxSendMsgSize: 16 << 20,
76 GRPCCompression: clientConfig.GRPCCompression,
77 RateLimit: 0,
78 RateLimitBurst: 0,
79 BackoffOnRatelimits: false,
80 TLSEnabled: clientConfig.TLSEnabled,
81 TLS: clientConfig.TLS,
82 ConnectTimeout: clientConfig.ConnectTimeout,
83 },
84 HealthCheckConfig: clientConfig.HealthCheckConfig,
85 }
86 poolCfg := client.PoolConfig{
87 CheckInterval: time.Minute,
88 HealthCheckEnabled: true,
89 HealthCheckTimeout: 10 * time.Second,
90 }
91
92 clientsCount := promauto.With(reg).NewGauge(prometheus.GaugeOpts{
93 Namespace: "cortex",
94 Name: "storegateway_clients",
95 Help: "The current number of store-gateway clients in the pool.",
96 ConstLabels: map[string]string{"client": "querier"},
97 })
98
99 return client.NewPool("store-gateway", poolCfg, discovery, newStoreGatewayClientFactory(clientCfg, reg), clientsCount, logger)
100}
101
102type ClientConfig struct {
103 TLSEnabled bool `yaml:"tls_enabled"`

Callers 2

Calls 2

NewPoolFunction · 0.92

Tested by

no test coverage detected