View Source OpentelemetryPhoenix (Opentelemetry Phoenix v2.0.0)
OpentelemetryPhoenix uses telemetry handlers to create OpenTelemetry
spans.
Current events which are supported include endpoint start/stop, router start/stop, and router exceptions.
Supported options
:endpoint_prefix
(list ofatom/0
) - The endpoint prefix in your endpoint. The default value is[:phoenix, :endpoint]
.:adapter
(:atom) - Required. The phoenix server adapter being used. The default value is:cowboy2
.:liveview
(boolean/0
) - Whether LiveView traces will be instrumented. The default value istrue
.
Adapters
cowboy2
- when using PlugCowboy as your adapter you must add:opentelemetry_cowboy
to your project and passadapter: :cowboy2
option when calling setup.bandit
- when usingBandit.PhoenixAdapter
as your adapter you must add:opentelemetry_bandit
to your project and passadapter: :bandit
option when calling setup
Usage
In your application start:
def start(_type, _args) do
:opentelemetry_cowboy.setup()
OpentelemetryPhoenix.setup(adapter: :cowboy2)
children = [
{Phoenix.PubSub, name: MyApp.PubSub},
MyAppWeb.Endpoint
]
opts = [strategy: :one_for_one, name: MyStore.Supervisor]
Supervisor.start_link(children, opts)
end
Summary
Types
The phoenix server adapter being used. Required
The endpoint prefix in your endpoint. Defaults to [:phoenix, :endpoint]
Setup options
Functions
Initializes and configures the telemetry handlers.
Types
@type adapter() :: {:adapter, :cowboy2 | :bandit}
The phoenix server adapter being used. Required
@type endpoint_prefix() :: {:endpoint_prefix, [atom()]}
The endpoint prefix in your endpoint. Defaults to [:phoenix, :endpoint]
@type opts() :: [endpoint_prefix() | adapter()]
Setup options