scoutapp / scout_apm_elixir

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

Using module attributes instead of macros #116

Open hez opened 3 years ago

hez commented 3 years ago

Instrumenting our code requires extensive destructive modifications.

From

defmodule OurApp.Unit do
  def some_job do
    # ....
  end
end

To

defmodule OurApp.Unit do
  deftransaction some_job do
    # ....
  end
end

In other APM tracers I have seen the use of module attributes to augment the function.

Would look something like

defmodule OurApp.Unit do
  @trace [some_option: true]
  def some_job do
    # ....
  end
end

Example: https://github.com/newrelic/elixir_agent/blob/master/lib/new_relic/tracer.ex