From dfb01a39ae6bc0053cd2d88971737a26c99c3056 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Wed, 3 Jul 2024 13:13:27 +0200 Subject: [PATCH] Set error on a span with an unhandled :erlang.exit() --- lib/open_telemetry_decorator.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/open_telemetry_decorator.ex b/lib/open_telemetry_decorator.ex index 09438c6..6ccc1a4 100644 --- a/lib/open_telemetry_decorator.ex +++ b/lib/open_telemetry_decorator.ex @@ -82,6 +82,10 @@ defmodule OpenTelemetryDecorator do e -> O11y.record_exception(e) reraise e, __STACKTRACE__ + catch + class, reason -> + O11y.set_error("#{class}:#{reason}") + :erlang.raise(class, reason, __STACKTRACE__) after O11y.end_span(parent_span) end