glanotte / spandex_phoenix

Phoenix Instrumentation tracer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SpandexPhoenix

Phoenix integration for the Spandex tracing library.

By configuring SpandexPhoenix.Instrumenter in your Phoenix instrumenters list, you will automatically get spans created for Phoenix.Controller and Phoenix.View timing, with the resource set to the name of the controller action or view name.

Note that this should be used in addition to the Spandex.Plug plugs to start the trace and top-level span, as this instrumenter only creates child spans, assuming that the trace will already have been created.

Usage

Add spandex_phoenix to your dendencies in mix.exs:

def deps do
  [
    {:spandex_phoenix, "~> 0.1.0"}
  ]
end

Configure it to use your desired Spandex.Tracer module in config.exs:

config :spandex_phoenix, tracer: MyApp.Tracer

Configure your Phoenix Endpoint to use this library as an instrumenter:

config :my_app, MyAppWeb.Endpoint,
  # ... existing config ...
  instrumenters: [SpandexPhoenix.Instrumenter]

The docs can be found at https://hexdocs.pm/spandex_phoenix.

About

Phoenix Instrumentation tracer

License:MIT License


Languages

Language:Elixir 100.0%