scoutapp / scout_apm_elixir

ScoutAPM Elixir Agent. Supports Phoenix and other frameworks.
https://scoutapm.com
Other
36 stars 20 forks source link

Missing instrumentation for GenServers #49

Closed cschneid closed 6 years ago

cschneid commented 6 years ago

This was reported by a customer, writing it up here.

I'm not sure if this is happening on every GenServer, only handle_info, or if there's some ordering of macro imports.

Example non-working code:

use GenServer
use ScoutApm.Tracing

@transaction(type: "background", name: "MyJob")
def handle_info(:work, %{}) do
  # ...
end

I'd expect it to trace and report background worker data, but it doesn't.

cschneid commented 6 years ago

After a lot of great investigation from @mitchellhenke, it was found that the @transaction annotation did not play nice with functions that were previously marked as overridable. GenServer uses overridable, so we were never emitting the instrumentation needed.

The @transaction annotation style is being deprecated for this (and other edge-casey) reasons, as of agent version 0.4.1.

Prefer to use the new ScoutApm.Tracing.deftransaction macro.