# `Honeybadger.Insights.Ash.AshOban`
[🔗](https://github.com/honeybadger-io/honeybadger-elixir/blob/v0.30.2/lib/honeybadger/insights/ash.ex#L216)

Helpers for integrating Honeybadger context with AshOban triggers.

## Usage with AshOban Triggers

Use `capture_event_context/1` with the `extra_args` option in your AshOban
trigger to automatically pass the current Honeybadger event context to the
Oban job:

    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 this context when
the job runs, ensuring request IDs and other context are preserved across
async boundaries.

# `capture_event_context`

Captures the current Honeybadger event context for use with AshOban triggers.

This function is designed to be used with the `extra_args` option in AshOban
triggers. It returns a map containing the current Honeybadger event context,
which will be merged into the Oban job's arguments.

## Parameters

- `_record_or_changeset` - The record or changeset (ignored, as we only need
  the current process's context)

## Returns

A map with the key `"hb_event_context"` containing the current event context.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
