Skip to content

Comments

Ensure spans in requests with errors aren't double-closed#51

Merged
tombruijn merged 1 commit intomainfrom
no-double-close
Mar 21, 2025
Merged

Ensure spans in requests with errors aren't double-closed#51
tombruijn merged 1 commit intomainfrom
no-double-close

Conversation

@jeffkreeftmeijer
Copy link
Member

Since
appsignal/appsignal-elixir@d218b40, the instrument/1 function automatically closes the created span. This caused issues with the Plug integration, which assumed spans weren't closed.

This patch moves off instrument/1 in the Plug integration by starting and closing the span itself. Because it now opens the span itself in the "http_request" namespace, it no longer has to set the namespace.

@jeffkreeftmeijer jeffkreeftmeijer added the bug Confirmed and unconfirmed bugs reported by us and customers. label Mar 19, 2025
@jeffkreeftmeijer jeffkreeftmeijer self-assigned this Mar 19, 2025
Since
appsignal/appsignal-elixir@d218b40,
the instrument/1 function automatically closes the created span. This
caused issues with the Plug integration, which assumed spans weren't
closed.

This patch moves off instrument/1 in the Plug integration by starting
and closing the span itself. Because it now opens the span itself in
the "http_request" namespace, it no longer has to set the namespace.
@tombruijn
Copy link
Member

@jeffkreeftmeijer can we merge this?

@tombruijn tombruijn merged commit 34b5181 into main Mar 21, 2025
16 checks passed
tombruijn added a commit to appsignal/appsignal-elixir-phoenix that referenced this pull request Mar 24, 2025
Update the dependency so all new packages use the fix linked below that
ensures that spans created by our plug package aren't trying to close
twice.

See also PR appsignal/appsignal-elixir-plug#51
and PR appsignal/appsignal-elixir#979
tombruijn added a commit to appsignal/appsignal-elixir-phoenix that referenced this pull request Mar 24, 2025
Update the dependency so all new packages use the fix linked below that
ensures that spans created by our plug package aren't trying to close
twice.

See also PR appsignal/appsignal-elixir-plug#51
and PR appsignal/appsignal-elixir#979
tombruijn added a commit to appsignal/appsignal-elixir-phoenix that referenced this pull request Mar 24, 2025
The tests failed because the spans were closed twice.
Remove the close span call in this package and rely on the
`Appsignal.instrument` helper's behavior to close a span if an error
occurred in the instrumented function.

See also PR appsignal/appsignal-elixir-plug#51
and PR appsignal/appsignal-elixir#979
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Confirmed and unconfirmed bugs reported by us and customers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants