-
Notifications
You must be signed in to change notification settings - Fork 0
/
newrelic.go
32 lines (27 loc) · 824 Bytes
/
newrelic.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 core
import (
"log"
"github.com/gofiber/contrib/fibernewrelic"
"github.com/granitebps/puasa-sunnah-api/pkg/constants"
"github.com/newrelic/go-agent/v3/newrelic"
"github.com/spf13/viper"
)
func SetupNewrelicApp() *newrelic.Application {
app, err := newrelic.NewApplication(
newrelic.ConfigEnabled(viper.GetBool(constants.NEWRELIC_ENABLED)),
newrelic.ConfigAppName(viper.GetString(constants.NEWRELIC_APP_NAME)),
newrelic.ConfigLicense(viper.GetString(constants.NEWRELIC_LICENSE)),
// newrelic.ConfigDebugLogger(os.Stdout),
newrelic.ConfigAppLogForwardingEnabled(true),
newrelic.ConfigDistributedTracerEnabled(true),
)
if err != nil {
log.Panic(err)
}
return app
}
func SetupNewrelicFiber(a *newrelic.Application) fibernewrelic.Config {
return fibernewrelic.Config{
Application: a,
}
}