Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reported_by tag to error backend errors #967

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading