# ConduitAppsignal

A plug to add Appsignal instrumentation to your conduit pipelines.

## Installation

If [available in Hex](, the package can be installed
by adding `conduit_appsignal` to your list of dependencies in `mix.exs`:

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

## Usage

In your broker, early in an incoming pipeline, include the `ConduitAppsignal.Plug.Transaction`. Early
in an outgoing pipeline include `ConduitAppsignal.Plug.Publish`. If you are using `Conduit.Plug.Retry`,
add `ConduitAppsignal.Plug.Attempt` directly after it. If you want to capture errors, add
`ConduitAppsignal.Plug.CaptureError` before anything that will handle exceptions, like `Conduit.Plug.AckException`.

``` elixir
# broker.ex
pipeline :in_tracking do
  plug ConduitAppsignal.Plug.Transaction

pipeline :out_tracking do
  plug ConduitAppsignal.Plug.Publish

pipeline :error_handling do
  plug Conduit.Plug.AckException
  plug Conduit.Plug.DeadLetter, broker: MiddleOut.Broker, publish_to: :error
  plug Conduit.Plug.Retry, attempts: 5
  plug ConduitAppsignal.Plug.Attempt
  plug ConduitAppsignal.Plug.CaptureError

incoming MyApp do
  pipe_through [:in_tracking, :error_handling, :deserialize] # Include tracking early

  # subscribes ...

outgoing do
  pipe_through [:out_tracking, :serialize] # Include tracking early

  # publishes ...

In each subscriber:

``` elixir
defmodule MySubscriber do
  use Conduit.Subscriber
  plug ConduitAppsignal.Plug.Subscriber, subscriber: __MODULE__

  # ...

Documentation can be generated with [ExDoc](
and published on [HexDocs]( Once published, the docs can
be found at [](