marcdel / open_telemetry_decorator

A function decorator for OpenTelemetry traces.
https://hex.pm/packages/open_telemetry_decorator
38 stars 22 forks source link

Set error on a span with an unhandled :erlang.exit() #148

Closed erszcz closed 4 months ago

erszcz commented 4 months ago

Hi,

Thanks for a great OTel decorator!

The decorator handles Elixir exceptions and errors well, but in the most general case it's possible that we might call some code (possibly in Erlang) that will just :erlang.exit/1,2. In such a case, with the current code, a span is not marked as an error and contains almost no tags, which makes it hard to pinpoint the problem:

Screenshot 2024-07-03 at 12 52 28

With this PR such a span is correctly marked as an error with otel.status_description being set to the Erlang exception class (one of throw, error, or exit) and a reason:

Screenshot 2024-07-03 at 12 53 00

marcdel commented 4 months ago

hell yeah thanks, @erszcz! this is much appreciated. 🫶

marcdel commented 4 months ago

heading to lunch, but i'll cut a new release in a bit

erszcz commented 4 months ago

Awesome 🎉 Thanks for such a prompt response!