MCPcopy
hub / github.com/redis/go-redis / RegisterPools

Function RegisterPools

internal/otel/metrics.go:270–285  ·  view source on GitHub ↗

RegisterPools registers connection pools with the global recorder.

(connPool pool.Pooler, pubSubPool PubSubPooler, addr string)

Source from the content-addressed store, hash-verified

268
269// RegisterPools registers connection pools with the global recorder.
270func RegisterPools(connPool pool.Pooler, pubSubPool PubSubPooler, addr string) {
271 // Check if the global recorder implements PoolRegistrar
272 if registrar, ok := globalRecorder.(PoolRegistrar); ok {
273 // Generate a unique ID for this client's pools
274 uniqueID := generateUniqueID()
275
276 if connPool != nil {
277 poolName := addr + "_" + uniqueID
278 registrar.RegisterPool(poolName, connPool)
279 }
280 if pubSubPool != nil {
281 poolName := addr + "_" + uniqueID + "_pubsub"
282 registrar.RegisterPubSubPool(poolName, pubSubPool)
283 }
284 }
285}
286
287// UnregisterPools removes connection pools from the global recorder
288func UnregisterPools(connPool pool.Pooler, pubSubPool PubSubPooler) {

Callers 1

NewClientFunction · 0.92

Calls 3

generateUniqueIDFunction · 0.70
RegisterPoolMethod · 0.65
RegisterPubSubPoolMethod · 0.65

Tested by

no test coverage detected