Skip to content

test: add unit tests for agent_debugger_sdk/telemetry (zero coverage) #304

Description

@acailic

Problem

`agent_debugger_sdk/telemetry/init.py` (40 statements) has 0% test coverage, confirmed via:

```
.venv-ci/bin/python -m pytest -q --cov=agent_debugger_sdk --cov-report=term-missing
```

Scope

Cover the OTel-optional telemetry shim:

  • `init_telemetry()` — ImportError fallback path (opentelemetry not installed → no-op, logs info)
  • `init_telemetry()` — otlp exporter branch with/without endpoint, and its own nested ImportError fallback to console exporter (requires opentelemetry installed to exercise fully; otherwise assert the no-op path only)
  • `get_tracer()` — ImportError fallback returns `_NoOpTracer`
  • `_NoOpTracer.start_as_current_span()` / `_NoOpContextManager.enter` / `exit` — no-op contract
  • `is_telemetry_enabled()` — reflects `_initialized` state before/after `init_telemetry()`

No external OTel dependency required for the primary no-op paths (which is what this env actually exercises).

Acceptance

  • New `tests/test_telemetry.py` (or similar) covering the paths above
  • `ruff check .` clean
  • `pytest -q` green

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-workAI auto-worker queue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions