-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When our `Appsignal.instrument` function encounters an error when the function argument raises an error, the span it created would not be closed. Wrap the function call in a `try` block, and move the close logic to an `after` block to ensure that the span is always closed. I don't know if `instrument_root` is actually used anywhere. We don't call it anywhere and we haven't documented it, but I'm updating it just in case to match the `instrument` helper function. Related internal thread: https://appsignal.slack.com/archives/C7XHXQ7N0/p1739893354569399?thread_ts=1739870246.417719&cid=C7XHXQ7N0
- Loading branch information
Showing
3 changed files
with
92 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
bump: patch | ||
type: fix | ||
--- | ||
|
||
Close instrumentation spans when an error occurs inside the `Appsignal.instrument` helper's function argument. This prevents spans and traces from not being closed properly. | ||
|
||
This will no longer fail to close spans: | ||
|
||
```elixir | ||
Appsignal.instrument("event name", fn -> do | ||
raise "Oh no!" | ||
end) | ||
``` |
This file contains 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
This file contains 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