From 7119c4bd42091e1df888cf7c59835c185caa1190 Mon Sep 17 00:00:00 2001 From: Derek Kraan Date: Thu, 6 Jul 2023 21:44:16 +0200 Subject: [PATCH] Record an exception as an error only when Plug.Exception.status/1 (#165) 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. Co-authored-by: Tristan Sloughter --- .../opentelemetry_phoenix/lib/opentelemetry_phoenix.ex | 1 - 1 file changed, 1 deletion(-) diff --git a/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix.ex b/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix.ex index e07bb6c..2138f51 100644 --- a/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix.ex +++ b/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix.ex @@ -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