Skip to content

Commit

Permalink
Merge pull request #967 from appsignal/add-reported-by-tag-error-backend
Browse files Browse the repository at this point in the history
Add `reported_by` tag to error backend errors
  • Loading branch information
unflxw authored Nov 4, 2024
2 parents 6a62ea1 + 440e53d commit 99b32b1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: patch
type: add
---

Add `reported_by` tag to errors reported by the legacy error backend. This makes it easier to understand whether an error is being reported by the error backend.
1 change: 1 addition & 0 deletions lib/appsignal/error/backend.ex
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ defmodule Appsignal.Error.Backend do
defp set_error_data(span, reason, stacktrace) do
span
|> @span.add_error(:error, reason, stacktrace)
|> @span.set_sample_data("tags", %{"reported_by" => "error_backend"})
|> @tracer.close_span()
end
end
5 changes: 5 additions & 0 deletions test/appsignal/error/backend_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ defmodule Appsignal.Error.BackendTest do
assert is_list(stack)
end

test "adds a `reported_by` tag to the created span", %{pid: pid} do
assert {:ok, [{%Span{pid: ^pid}, "tags", %{"reported_by" => "error_backend"}} | _]} =
Test.Span.get(:set_sample_data)
end

test "closes the created span", %{pid: pid} do
assert {:ok, [{%Span{pid: ^pid}} | _]} = Test.Tracer.get(:close_span)
end
Expand Down

0 comments on commit 99b32b1

Please sign in to comment.