Skip to content

feat(telemetry): optional OTLP exporter, OFF by default (ports-and-adapters) - #128

Merged
cdeust merged 1 commit into
mainfrom
feat/otel-exporter
Jul 14, 2026
Merged

feat(telemetry): optional OTLP exporter, OFF by default (ports-and-adapters)#128
cdeust merged 1 commit into
mainfrom
feat/otel-exporter

Conversation

@cdeust

@cdeust cdeust commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Fixes #122.

  • OFF par défaut, comportement inchangé octet-pour-octet sans OTEL_EXPORTER_OTLP_ENDPOINT — le défaut local-sans-egress (telemetry.jsonl) est préservé ; PRIVACY.md mis à jour en conséquence (la claim inconditionnelle devient « opt-in explicite », honnêteté de source plutôt que changement silencieux).
  • Architecture : Protocol TelemetryExporter déclaré dans core/telemetry.py (zéro import infra, vérifié par grep), implémentation OTel SDK isolée dans infrastructure/otel_exporter.py, câblage unique dans __main__.py (composition root) — même précédent que core/streaming/ports.py.
  • Métriques : exactement les 3 noms décidés dans l'issue (cortex.tool.duration, cortex.tool.calls{tool,status}, cortex.recall.results) — rien d'inventé au-delà.
  • Robustesse : la télémétrie ne casse JAMAIS l'outil (exceptions d'export avalées, contract-testé) ; SDK absent = un seul warning par process ; extra optionnel [otel] dans pyproject (+ uv.lock régénéré).
  • Tests : 14 nouveaux (port : défaut inchangé, invocation, exporter défaillant, CORTEX_TELEMETRY_DISABLED ; adaptateur : OFF par défaut, dégradation sans SDK, mapping des 3 instruments, skip zero-count, exception avalée) ; suite complète : 5136 passed, 0 failure.
  • Limite honnête (flaggée par l'agent) : pas de run e2e contre un vrai collector/SDK installé (frontière SDK mockée) — candidat à un test d'intégration CI futur.

🤖 Generated with Claude Code

Cortex telemetry stays local-only (~/.claude/methodology/telemetry.jsonl,
no network egress) unless an operator explicitly sets
OTEL_EXPORTER_OTLP_ENDPOINT. core/telemetry.py declares a TelemetryExporter
port (Protocol) and stays pure; infrastructure/otel_exporter.py implements
it and lazy-imports the optional opentelemetry-sdk extra ([otel] in
pyproject), degrading to a single logged warning if absent. The
composition root (mcp_server/__main__.py) wires the concrete exporter into
the core port at startup -- core never imports infrastructure.

Metric names mirror the cortex.* convention agreed in the issue thread
(cortex.tool.duration, cortex.tool.calls{tool,status},
cortex.recall.results), mapped directly from telemetry.record()'s existing
fields -- no new metrics invented.

Fixes #122

Co-Authored-By: Claude <noreply@anthropic.com>
@cdeust
cdeust merged commit d5c1cef into main Jul 14, 2026
14 checks passed
@cdeust
cdeust deleted the feat/otel-exporter branch July 14, 2026 22:16
pull Bot pushed a commit to asleekgeek/Cortex that referenced this pull request Jul 15, 2026
Cuts 13 commits ahead of v4.14.1: core→infrastructure layer-violation
cleanup via reverse-DI ports-and-adapters (cdeust#135), check_setup MCP tool +
/preflight command (cdeust#115, cdeust#119, cdeust#133), XDG-aware embedding cache_folder
(cdeust#132), project settings catalogue + headless CI regimes (cdeust#131), devcontainer
with prewarmed models (cdeust#129), optional OTLP telemetry (cdeust#128), stale docs/
module-count fixes (cdeust#130, cdeust#121), CLAUDE.md refactor (cdeust#125), Windows
postInstall dispatch fix (cdeust#117). No retrieval-path code touched.

Pre-tag guard on the exact release tree (git_sha 018c76d, isolated
ephemeral pgvector container via benchmarks/reproduce.sh --no-ablation):
LongMemEval MRR 0.9166/R@10 0.9820 (matches v4.14.1, no regression); LoCoMo
3-run mean MRR 0.8009/R@10 0.9146 (vs v4.14.1's 3-run mean 0.7984/0.9142,
an improvement within noise); BEAM MRR 0.5437/R@10 0.7139 (within v4.14.1's
established intra-day variance band). All 4 gated floors PASS (tolerance
0.005) — unlike v4.14.1 where LoCoMo MRR failed the absolute floor on its
3-run mean, 4.14.2's mean clears it by -0.0041. Evidence:
benchmarks/results/repro/20260715-v4.14.2-pretag/.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exporter OTel pour la télémétrie Cortex (émission OTLP — le dashboard vit hors de Cortex)

1 participant