Env-driven OTLP trace export built its resource from only service.name,
so OTEL_RESOURCE_ATTRIBUTES entries were silently dropped and backends
that attribute spans via resource attributes never received them.
Merge the vendored envDetector into the resource, which parses
OTEL_RESOURCE_ATTRIBUTES (percent-decoded, per spec) with OTEL_SERVICE_NAME
taking precedence for service.name.
Fixes#7134
Extended the OTLP export bootstrap beyond traces so omp emits the full
OpenTelemetry signal set from a single session.
- Registered a LoggerProvider + BatchLogRecordProcessor and a MeterProvider
+ PeriodicExportingMetricReader when their OTLP endpoints (or the shared
endpoint) are set, each gated independently by OTEL_*_EXPORTER=none,
OTEL_SDK_DISABLED, and http/protobuf protocol checks.
- Bridged the centralized logger through a new registerLogSink API so every
log event also becomes an OTLP log record with severity, attributes, and
active span context for log-trace correlation (min level via OTEL_LOG_LEVEL).
- Recorded gen_ai.client.token.usage and pi.omp.agent.* metrics from the
agent run summary and per-chat usage hooks, and emitted a structured run
summary log event.
- Added an out-of-process logs+metrics probe and gating tests covering the
per-signal kill switches.
Fixes#4604
- Lazy-loaded OTEL SDK, HTML export, TTSR, and autoresearch modules.
- Made resolveMemoryBackend async to import backends on demand.
- Replaced backend resolution with direct settings reads for rekey checks.
When OTEL_EXPORTER_OTLP_ENDPOINT (or _TRACES_ENDPOINT) is set, register a
global OTLP/proto TracerProvider and switch on the agent loop's telemetry
so its invoke_agent / chat / execute_tool spans reach a collector instead
of a no-op tracer. Honors the standard OTEL_* env contract
(OTEL_SERVICE_NAME, OTEL_SDK_DISABLED, OTEL_TRACES_EXPORTER=none) and the
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT capture toggle; no-op
when no endpoint is configured.
Uses the exporter-trace-otlp-proto 2.x line, which exports cleanly under
Bun (the 1.x line deadlocks). Adds a flushTelemetryExport() helper and a
periodic + signal-driven flush so long-lived processes surface spans.
This makes the existing telemetry usable from hosts that spawn omp as a
child process (e.g. an ACP harness), where an in-process provider
registered by the parent can't reach the child process.