From 5a5cba6254cb5d68fe69faf2418499a35af24cc0 Mon Sep 17 00:00:00 2001 From: namhq1989 Date: Sat, 25 Feb 2023 12:41:31 +0700 Subject: [PATCH] add log for apm --- redisdb.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 }