marcdel / open_telemetry_decorator

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

Catch throws, stringify thrown values and exit reasons for reporting #149

Closed erszcz closed 3 months ago

erszcz commented 4 months ago

One more fix to also catch throws and stringify the thrown values or exit reasons. I think it's bulletproof now 🤞

marcdel commented 3 months ago

Whoops, I got distracted realizing I don't actually know how throw/catch work and then I saw something shiny and forgot about this.

Specifically I'm confused by the fact that these two print the same value (%{catch: :this}):

        :throw, thrown ->
          dbg(thrown)

        thrown ->
          dbg(thrown)

Obviously yours is more specific, which I think is what we want here. I was just thrown off by that.

erszcz commented 3 months ago

Yeah, throw is really seldom used in Elixir. Thanks again for taking the time to look at this!