# `ReqManagedAgents.OpenTelemetry`
[🔗](https://github.com/cash-mckeeman/req_managed_agents/blob/v0.12.0/req_managed_agents/lib/req_managed_agents/open_telemetry.ex#L1)

OTel GenAI bridge for req_managed_agents (mirrors `ReqLLM.OpenTelemetry`).

Two surfaces:
- **Pure mappers** (`attributes_for/2`, delegating to `Attributes`) — the load-bearing
  capture surface a host (mimir-gateway) calls to normalize RMA events to `gen_ai.*`.
- **Optional OTLP export** (`attach/1`) — emits spans only when the OTel SDK is loaded;
  no-ops otherwise. No `opentelemetry` dependency is taken.

## Scope

Both backends now run through the unified `ReqManagedAgents.Session`, which emits
`[:req_managed_agents, :session, :terminal | :tool_uses]` (plus the streaming
`[:req_managed_agents, :stream | :tool, …]` events) regardless of provider — so this bridge
covers AgentCore and Claude Managed Agents alike. (The old per-driver *turn-loop* events
were retired with the driver collapse. The `[:req_managed_agents, :agent_core, …]`
namespace is still live for provider-specific work outside the session loop — the
`:request` events and the `:provision` poll/stop/exception events — which this bridge
does not span.)

# `attach`

```elixir
@spec attach(term()) :: :ok | {:error, term()}
```

# `attributes_for`

```elixir
@spec attributes_for([atom()], map()) :: {String.t(), map()}
```

Map a telemetry event name + metadata to `{gen_ai_event_type, gen_ai_attrs}`.

# `available?`

```elixir
@spec available?() :: boolean()
```

# `detach`

```elixir
@spec detach(term()) :: :ok | {:error, :not_found}
```

# `events`

```elixir
@spec events() :: [[atom()]]
```

---

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