Ensure spans in requests with errors aren't double-closed#51
Merged
Conversation
01ae585 to
77019b1
Compare
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.
77019b1 to
15a56b3
Compare
tombruijn
approved these changes
Mar 19, 2025
Member
|
@jeffkreeftmeijer can we merge this? |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.