From 7746337964fd50b2eac170333efa05e7a5676a1c Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Thu, 24 Jul 2025 14:09:11 +0300 Subject: feat/backend: add newrelic integration (#274) --- backend/main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'backend/main.go') diff --git a/backend/main.go b/backend/main.go index a1a4a20..e422359 100644 --- a/backend/main.go +++ b/backend/main.go @@ -11,6 +11,8 @@ import ( "github.com/gin-gonic/gin" "github.com/joho/godotenv" + nrgin "github.com/newrelic/go-agent/v3/integrations/nrgin" + "github.com/newrelic/go-agent/v3/newrelic" ) // @title Least Portals Hub @@ -30,7 +32,16 @@ func main() { if os.Getenv("ENV") == "PROD" { gin.SetMode(gin.ReleaseMode) } + app, err := newrelic.NewApplication( + newrelic.ConfigAppName("lphub"), + newrelic.ConfigLicense(os.Getenv("NEWRELIC_LICENSE_KEY")), + newrelic.ConfigAppLogForwardingEnabled(true), + ) + if err != nil { + log.Fatal("Error instrumenting newrelic") + } router := gin.Default() + router.Use(nrgin.Middleware(app)) database.ConnectDB() api.InitRoutes(router) // for debugging -- cgit v1.2.3