ReqManagedAgents.OpenTelemetry (ReqManagedAgents v0.1.0)

Copy Markdown View Source

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 [:req_managed_agents, :agent_core, …] events were retired with the driver collapse.)

Summary

Functions

attach(handler_id \\ "req-managed-agents-otel")

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

attributes_for(list, meta)

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

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

available?()

@spec available?() :: boolean()

detach(handler_id \\ "req-managed-agents-otel")

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

events()

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