From 0cdf8ea46a4f088893d3e0b1f9d343d3f3127ba2 Mon Sep 17 00:00:00 2001 From: Chris Harding Date: Mon, 4 Nov 2019 14:38:59 +0000 Subject: [PATCH] only close NR transaction at the end of the request so error codes and external segments can be sent --- context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context.go b/context.go index d2ed254..bbbf00f 100644 --- a/context.go +++ b/context.go @@ -69,6 +69,7 @@ func ContextMiddleware( ) cc := NewContext(c, newRelicApp, logger, correlationID, isDebug, buildVersion) + defer cc.NewRelicTx.End() return h(cc) } @@ -88,7 +89,6 @@ func NewContext( echoCtx.Response().Writer, echoCtx.Request(), ) - defer func() { _ = newRelicTx.End() }() // new relic tx wraps response writer echoCtx.Response().Writer = newRelicTx