Skip to content

Commit

Permalink
Record an exception as an error only when Plug.Exception.status/1
Browse files Browse the repository at this point in the history
returns 500..599.

It is encouraged in the Phoenix docs to use `Plug.Exception` with
custom exceptions to generate for example 404 responses at certain
places. These 404s should not be marked as error, since simple "route
not found" 404s are also not marked as error.
  • Loading branch information
derekkraan committed Apr 28, 2023
1 parent 1230271 commit e455594
Showing 1 changed file with 0 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ defmodule OpentelemetryPhoenix do

# record exception and mark the span as errored
Tracer.record_exception(exception, stacktrace, attrs)
Tracer.set_status(OpenTelemetry.status(:error, ""))

# do not close the span as endpoint stop will still be called with
# more info, including the status code, which is nil at this stage
Expand Down

0 comments on commit e455594

Please sign in to comment.