You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm in process of writing a library to support switchover from legacy deployments which do not use sentinel, and I noticed the server.address is missing from the sentinel spans:
Initialization of the tracer looks as follows:
failoverOptions:=&redis.FailoverOptions{
SentinelAddrs: []string{cfg.SentinelAddr},
ClientName: app.Info().PodID,
DB: cfg.DBNumber,
Password: string(cfg.Password),
SentinelPassword: string(cfg.Password),
// Base number of socket connections.// Default is 10 connections per every available CPU as reported by runtime.GOMAXPROCS.// If there is not enough connections in the pool, new connections will be allocated in excess of PoolSize,// you can limit it through MaxActiveConnsPoolSize: cfg.PoolSize,
// Minimum number of idle connections which is useful when establishing// new connection is slow.// Default is 0. the idle connections are not closed by default.MinIdleConns: cfg.MinIdleConns,
// Maximum number of idle connections.// Default is 0. the idle connections are not closed by default.MaxIdleConns: cfg.MaxIdleConns,
// Maximum number of connections allocated by the pool at a given time.// When zero, there is no limit on the number of connections in the pool.MaxActiveConns: cfg.MaxActiveConns,
// there are additional idleReplicaOnly: role==RedisReplicaRoleReader,
MasterName: cfg.LeaderName,
ContextTimeoutEnabled: true,
// <<Stencil::Block(failoverOptions)>>// <</Stencil::Block>>
}
redis.SetLogger(&redisLogger{})
varclient redis.UniversalClientswitchrole {
caseRedisReplicaRoleReader:
failoverOptions.RouteByLatency=cfg.RouteReadsByLatencyclient=redis.NewFailoverClusterClient(failoverOptions)
caseRedisReplicaRoleWriter:
client=redis.NewFailoverClient(failoverOptions)
default:
returnnil, fmt.Errorf("unknown RedisReplicaRole: %v", role)
}
ping:=client.Ping(ctx)
ifping.Err() !=nil {
returnnil, errors.Wrapf(ping.Err(), "failed to contact Redis Sentinel at %q", cfg.SentinelAddr)
}
iferr:=redisotel.InstrumentTracing(client); err!=nil {
returnnil, errors.Wrap(err, "failed to instrument Redis tracing")
}
iferr:=redisotel.InstrumentMetrics(client); err!=nil {
returnnil, errors.Wrap(err, "failed to instrument Redis tracing")
}
returnclient, nil
We are using sentinel for high availability.
I'm in process of writing a library to support switchover from legacy deployments which do not use sentinel, and I noticed the server.address is missing from the sentinel spans:
Initialization of the tracer looks as follows:
Related:
Cause is because of this line here:
https://github.com/redis/go-redis/blob/master/sentinel.go#L90
It uses "FailoverClient" instead of any real address.
The text was updated successfully, but these errors were encountered: