Skip to content

Cookbook: Appsignal instrumentation

Tymon Tobolski edited this page Mar 26, 2018 · 1 revision
defmodule Tesla.Middleware.Appsignal do
  import Appsignal.Instrumentation.Helpers, only: [instrument: 3]

  def call(env, next, _opts) do
    verb = env.method |> to_string |> String.upcase
    instrument "net.http", "#{verb} #{env.url}", fn ->
      Tesla.run(env, next)
    end
  end
end