You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am using a combination of:
go.elastic.co/apm v1.15.0
go.elastic.co/apm/module/apmgin/v2 v2.6.0
go.elastic.co/apm/module/apmsql/v2 v2.6.0
I try to get TraceID in middleware.Logger(), Elastic Docs module/apmgin say [ For each request, a transaction is stored in the request context, which can be obtained via gin.Context.Request.Context() in your handler. ]
so in middleware.Logger()
var traceID string
tx := apm.TransactionFromContext(context.Request.Context())
if tx != nil {
traceID = tx.TraceContext().Trace.String()
}
logger.Info( "request",
zap.String("traceID", traceID),
.... other field
)
tx always nil, so traceID always ""
Expected behavior
get the traceID
The text was updated successfully, but these errors were encountered:
Describe the bug
I am using a combination of:
go.elastic.co/apm v1.15.0
go.elastic.co/apm/module/apmgin/v2 v2.6.0
go.elastic.co/apm/module/apmsql/v2 v2.6.0
apmgin and apmsql work
To Reproduce
Steps to reproduce the behavior:
gin middleware setting
I try to get TraceID in middleware.Logger(),
Elastic Docs module/apmgin say [ For each request, a transaction is stored in the request context, which can be obtained via gin.Context.Request.Context() in your handler. ]
so in middleware.Logger()
tx always nil, so traceID always ""
Expected behavior
get the traceID
The text was updated successfully, but these errors were encountered: