I am trying to integrate go app with newrelic and with below code I am able to see my api transactions in new relic.
import (
"github.com/newrelic/go-agent/v3/integration/nrgin"
"github.com/newrelic/go-agent/v3/newrelic"
)
var router = gin.Default()
nr, _ := newrelic.NewApplication(
newrelic.ConfigAppName("TestApp"),
newrelic.ConfigLicense("NRKEY"),
)
router.Use(nrgin.Middleware(nr))
router.GET("/user", userHandler)
with above sample code, when get user request is initiated I am able to see the api details in newrelic transactions. But the problem is database query traces are empty in newrelic.
I found a way to get query details by adding newrelic.DatastoreSegment in individual models, but I don't want this approach because I have many models.
Is there anyway I can handle this situation in router?