diff --git a/redisdb.go b/redisdb.go index e246ddd..706e0fd 100644 --- a/redisdb.go +++ b/redisdb.go @@ -33,14 +33,15 @@ func Connect(uri, password string) (*Server, error) { } // add apm - if os.Getenv("ELASTIC_APM_SERVER_URL") != "" { + useElasticAPM := os.Getenv("ELASTIC_APM_SERVER_URL") != "" + if useElasticAPM { rdb.AddHook(apmgoredis.NewHook()) } // assign data r = &Server{rdb: rdb} - fmt.Printf("⚡️[redis]: connected to %s \n", uri) + fmt.Printf("⚡️[redis]: connected to %s, use elastic apm: %t \n", uri, useElasticAPM) return r, nil }