---
title: Automatic instrumentation
description: Events the Honeybadger Elixir package captures automatically from Ecto, Phoenix, Oban, and more for Honeybadger Insights.
url: https://docs.honeybadger.io/lib/elixir/insights/automatic-instrumentation/
---

Honeybadger Insights allows you to automatically track various events in your application. To enable Insights automatic instrumentation, add the following to your configuration:

```elixir
config :honeybadger,
  insights_enabled: true
```

Honeybadger automatically instruments the following libraries when they are available:

* **Ecto**: Database queries
* **Plug/Phoenix**: HTTP requests
* **LiveView**: Phoenix LiveView lifecycle events
* **Oban**: Background job processing
* **Absinthe**: GraphQL query execution
* **Finch**: HTTP client requests, often used by other libraries like Req
* **Tesla**: HTTP client requests

The following libraries require additional setup (see [Instrumented libraries](https://docs.honeybadger.io/lib/elixir/insights/automatic-instrumentation/#instrumented-libraries)):

* **Ash**: Ash Framework actions and operations

See the [Elixir event reference](https://docs.honeybadger.io/insights/event-types/elixir/) for every event the package emits, with field schemas and types.

## Instrumented libraries

Each instrumented library has its own configuration options. You can customize the telemetry events that are captured, as well as the data that is sent to Honeybadger.

***

### Ecto

Captures database query telemetry events from Ecto repositories.

#### Default configuration

By default, this module listens for telemetry events from all configured Ecto repositories. It reads the `:ecto_repos` configuration to identify repositories and their telemetry prefixes:

```elixir
config :honeybadger,
  ecto_repos: [MyApp.Repo]
```

#### Custom configuration

You can customize this module’s behavior with the following configuration options:

```elixir
config :honeybadger, insights_config: %{
  ecto: %{
    # Disable Ecto telemetry events
    disabled: false,


    # A list of strings or regex patterns of queries to exclude
    excluded_queries: [
      ~r/^(begin|commit)( immediate)?( transaction)?$/i,
      ~r/SELECT pg_notify/,
      ~r/schema_migrations/
    ],


    # Format & include the stacktrace with each query. You must also
    # update your repo config to enable:
    #
    #   config :my_app, MyApp.Repo,
    #     stacktrace: true
    #
    # Can be a boolean to enable for all or a list of sources to enable.
    include_stacktrace: true


    # Alternative source whitelist example:
    # include_stacktrace: ["source_a", "source_b"],


    # Format & include the query parameters with each query. Can be a
    # boolean to enable for all or a list of sources to enable.
    include_params: true


    # Alternative source whitelist example:
    # include_params:["source_a", "source_b"],


    # A list of table/source names to exclude
    excluded_sources: [
      "schema_migrations",
      "oban_jobs",
      "oban_peers"
    ]
  }
}
```

By default, transaction bookkeeping queries and schema migration checks are excluded, as well as queries to common background job tables.

***

### Plug/Phoenix

Captures telemetry events from HTTP requests processed by Plug and Phoenix.

#### Default configuration

By default, this module listens for the standard Phoenix endpoint telemetry event:

phoenix.endpoint.stop

This is compatible with the default Phoenix configuration that adds telemetry via `Plug.Telemetry`:

plug Plug.Telemetry, event\_prefix: \[:my, :prefix]

#### Custom configuration

You can customize the telemetry events to listen for by updating the insights\_config:

```elixir
config :honeybadger, insights_config: %{
  plug: %{
    # Disable Plug/Phoenix telemetry events
    disabled: false,


    telemetry_events: [[:my, :prefix, :stop]]
  }
}
```

***

### LiveView

Captures telemetry events from Phoenix LiveView.

#### Default configuration

By default, this module listens for the following LiveView telemetry events:

phoenix.live\_view\.mount.stop phoenix.live\_view\.handle\_params.stop phoenix.live\_view\.handle\_event.stop

phoenix.live\_component.update.stop phoenix.live\_component.handle\_event.stop

#### Custom configuration

You can customize the telemetry events to listen for by updating the insights\_config:

```elixir
config :honeybadger, insights_config: %{
  live_view: %{
    # Disable LiveView telemetry events
    disabled: false,


    telemetry_events: [
      [:phoenix, :live_view, :mount, :stop],
      [:phoenix, :live_component, :handle_event, :stop],
      [:phoenix, :live_component, :update, :stop]
      [:phoenix, :live_view, :handle_event, :stop],
      [:phoenix, :live_view, :handle_params, :stop],
      [:phoenix, :live_view, :update, :stop]
    ]
  }
}
```

***

### Oban

Captures telemetry events from Oban job processing.

#### Default configuration

By default, this module listens for the following Oban telemetry events:

oban.job.stop oban.job.exception

#### Custom configuration

You can customize the telemetry events to listen for by updating the insights\_config:

```elixir
config :honeybadger, insights_config: %{
  oban: %{
    # Disable Oban telemetry events
    disabled: false,


    telemetry_events: [
      [:oban, :job, :stop],
      [:oban, :job, :exception],
      [:oban, :engine, :start]
    ]
  }
}
```

#### Job event context

We attempt to automatically inject `request_id` and any other event context into events emitted from a Job. The method for inheriting event context might not work in all cases, so you can explicitly add event context to a job by using the `add_event_context/1` function:

```elixir
MyApp.Worker.new()
|> Honeybadger.Insights.Oban.add_event_context()
|> Oban.insert()
```

Ensure that the event context is available in the caller’s process dictionary before inserting into the job.

***

### Absinthe

Captures telemetry events from GraphQL operations executed via Absinthe.

#### Default configuration

By default, this module listens for the following Absinthe telemetry events:

absinthe.execute.operation.stop absinthe.execute.operation.exception

#### Custom configuration

You can customize the telemetry events to listen for by updating the insights\_config:

```elixir
config :honeybadger, insights_config: %{
  absinthe: %{
    # Disable Absinthe telemetry events
    disabled: false,


    telemetry_events: [
      [:absinthe, :execute, :operation, :stop],
      [:absinthe, :execute, :operation, :exception],
      [:absinthe, :resolve, :field, :stop]
    ]
  }
}
```

Note that adding field-level events like “absinthe.resolve.field.stop” can significantly increase the number of telemetry events generated.

***

### Finch

Captures telemetry events from HTTP requests made using Finch.

#### Default configuration

By default, this module listens for the standard Finch request telemetry event:

finch.request.stop

#### Custom configuration

You can customize the telemetry events to listen for by updating the insights\_config:

```elixir
config :honeybadger, insights_config: %{
  finch: %{
    # Disable Finch telemetry events
    disabled: false,


    telemetry_events: ["finch.request.stop", "finch.request.exception"],


    # Include full URLs in telemetry events (default: false - only hostname is included)
    full_url: false
  }
}
```

By default, only the hostname from URLs is captured for security and privacy reasons. If you need to capture the full URL including paths (but not query parameters), you can enable the `full_url` option.

***

### Tesla

Captures telemetry events from HTTP requests made using Tesla.

#### Default configuration

By default, this module listens for the standard Tesla request telemetry events:

tesla.request.stop tesla.request.exception

#### Custom configuration

This module can be configured in the application config:

```elixir
config :honeybadger, insights_config: %{
  tesla: %{
    # Disable Tesla telemetry events
    disabled: false,


    # Include full URLs in telemetry events (default: false - only hostname is included)
    full_url: false,


    # Custom telemetry event patterns to listen for (optional)
    telemetry_events: [
      [:tesla, :request, :stop],
      [:tesla, :request, :exception]
    ]
  }
}
```

***

### Ash

Captures operations from the [Ash Framework](https://ash-hq.org/) using the `Ash.Tracer` behaviour.

Unlike the other integrations which use telemetry events, the Ash integration implements a tracer. You need to add `Honeybadger.Insights.Ash` as a tracer in your Ash domain or resources.

#### Setup

Add the tracer to your Ash domain:

```elixir
use Ash.Domain,
  tracers: [Honeybadger.Insights.Ash]
```

Or per-resource:

```elixir
use Ash.Resource,
  domain: YourDomain,
  tracers: [Honeybadger.Insights.Ash]
```

#### Default configuration

By default, this module traces `:custom` and `:action` span types.

#### Custom configuration

You can customize which span types are traced via insights\_config:

```elixir
config :honeybadger, insights_config: %{
  ash: %{
    trace_types: [:custom, :action, :query]
  }
}
```

#### AshOban event context

If you use [AshOban](https://hexdocs.pm/ash_oban) to run Ash actions as background jobs, you can pass the current Honeybadger event context to the job using the `extra_args` option in your trigger:

```elixir
oban do
  triggers do
    trigger :my_trigger do
      action :my_action
      extra_args(&Honeybadger.Insights.Ash.AshOban.capture_event_context/1)
    end
  end
end
```

The Honeybadger Oban integration will automatically restore the event context when the job runs, preserving request IDs and other context across async boundaries.

## Sending your own events

Automatic instrumentation covers the libraries the package knows about. To send your own application events, see [Sending custom events](https://docs.honeybadger.io/lib/elixir/insights/sending-custom-events/).

## Sending logs from your infrastructure

Honeybadger isn’t just for errors and application data! You can use our [syslog](https://docs.honeybadger.io/guides/insights/integrations/systemd/), [Vector](https://docs.honeybadger.io/guides/insights/integrations/log-files/), or [PaaS integrations](https://docs.honeybadger.io/guides/insights/#adding-data-from-other-sources) to send additional data from your infrastructure to [Honeybadger Insights](https://docs.honeybadger.io/guides/insights/), where you can query, visualize, and analyze all of your production data in one place.

---

## Try Honeybadger for FREE

Intelligent logging, error tracking, and Just Enough APM™ in one dev-friendly platform. Find and fix problems before users notice.

[Start free trial](https://app.honeybadger.io/users/sign_up)

[See plans and pricing](https://www.honeybadger.io/plans/)
