fix(session/redis): skip setup if otel is not enabled

This commit is contained in:
Trong Huu Nguyen
2023-11-28 10:08:31 +01:00
parent 0c36a6b820
commit 35e4953557

View File

@@ -42,10 +42,12 @@ func NewStore(cfg *config.Config) (Store, error) {
log.Infof("Using Redis as session backing store")
}
if err := redisotel.InstrumentTracing(redisClient); err != nil {
return nil, fmt.Errorf("failed to instrument Redis Client: %w", err)
if cfg.OpenTelemetry.Enabled {
if err := redisotel.InstrumentTracing(redisClient); err != nil {
return nil, fmt.Errorf("failed to instrument Redis Client: %w", err)
}
log.Infof("Setup telemtry for Redis")
}
log.Infof("Setup telemtry for Redis")
return NewRedis(redisClient), nil
}