-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew.go
32 lines (26 loc) · 862 Bytes
/
new.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package apmkratos
import (
"github.com/go-xlan/elasticapm"
"github.com/yyle88/erero"
"github.com/yyle88/neatjson/neatjsons"
"github.com/yyle88/zaplog"
)
func Initialize(apmConfig *elasticapm.Config) error {
if err := InitializeWithOptions(apmConfig, elasticapm.NewEnvOption()); err != nil {
return erero.Wro(err)
}
zaplog.LOG.Debug("Initialize apm success")
return nil
}
func InitializeWithOptions(apmConfig *elasticapm.Config, envOption *elasticapm.EnvOption, setEnvs ...func()) error {
zaplog.SUG.Info("Initialize apm apm_config=" + neatjsons.S(apmConfig))
zaplog.SUG.Info("Initialize apm evo_option=" + neatjsons.S(envOption))
if err := elasticapm.InitializeWithOptions(apmConfig, envOption, setEnvs...); err != nil {
return erero.Wro(err)
}
zaplog.LOG.Debug("Initialize apm success")
return nil
}
func Close() {
elasticapm.Close()
}