From e4555943808b70378f8d7452e27d5b534fb058c7 Mon Sep 17 00:00:00 2001 From: Derek Kraan Date: Wed, 19 Apr 2023 13:18:16 +0200 Subject: [PATCH] Record an exception as an error only when Plug.Exception.status/1 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. --- .../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 e07bb6c3..2138f510 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