add log for apm
This commit is contained in:
parent
75e000f385
commit
5a5cba6254
|
@ -33,14 +33,15 @@ func Connect(uri, password string) (*Server, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add apm
|
// add apm
|
||||||
if os.Getenv("ELASTIC_APM_SERVER_URL") != "" {
|
useElasticAPM := os.Getenv("ELASTIC_APM_SERVER_URL") != ""
|
||||||
|
if useElasticAPM {
|
||||||
rdb.AddHook(apmgoredis.NewHook())
|
rdb.AddHook(apmgoredis.NewHook())
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign data
|
// assign data
|
||||||
r = &Server{rdb: rdb}
|
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
|
return r, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue