Skip to content

Commit

Permalink
module/apmgorm: fix premature Span.End()
Browse files Browse the repository at this point in the history
The Span.End() call should come after the calls
to CaptureError, which will refer to the span.

Fixes elastic#229
  • Loading branch information
axw committed Sep 20, 2018
1 parent 23c941f commit 47e183b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion module/apmgorm/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func newAfterCallback(dsnInfo apmsql.DSNInfo) func(*gorm.Scope) {
Type: "sql",
User: dsnInfo.User,
})
span.End()
defer span.End()

// Capture errors, except for "record not found", which may be expected.
for _, err := range scope.DB().GetErrors() {
Expand Down

0 comments on commit 47e183b

Please sign in to comment.