feat: native OpenTelemetry instrumentation (optional, off by default)#352
Open
gloryfromca wants to merge 3 commits into
Open
feat: native OpenTelemetry instrumentation (optional, off by default)#352gloryfromca wants to merge 3 commits into
gloryfromca wants to merge 3 commits into
Conversation
Optional, off-by-default native OpenTelemetry export (the [otel] extra), wired as chassis so call sites never branch on config: - ObservabilitySettings ([observability]) — enabled / endpoint / headers / sample_rate / capture_content / langfuse_* / recall_hit_threshold; langfuse creds derive the OTLP endpoint + Basic-auth header. - core.observability.tracing: TracerProvider lifecycle (module-local, no-op when off/absent), memory_span helper stamping the langfuse.* contract, set_generation_usage, privacy-gated capture_input/output (redaction + truncation), non-blocking recall-score sink, W3C traceparent in/out helpers. - TracingLifespanProvider builds provider + score sink at startup. - RequestIdMiddleware: per-request id (state + contextvar + structlog + X-Request-Id) and continues an upstream traceparent when present; managers read the propagated id via resolve_request_id. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Surface gen_ai.* model + token attributes onto the active span so Langfuse can compute cost — without touching everalgo: - UsageRecordingClient wraps the LLM client and records response.usage after each chat(); get_llm_client composes it over the existing _LoggingLLMClient only when observability is enabled (disabled default stays overhead-free). - OpenAIEmbeddingProvider records its response.usage (input tokens) onto the active span too. Tokens land on the everos.extract / everos.reflect.consolidate generation spans and the search embedding recall; no-op when tracing is off. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Open spans at the memory hot paths (all no-op when tracing is off): - add / flush (service.memorize), extract + persist.markdown (user pipeline). - search: everos.memory.search retriever + a uniform recall / rank decomposition across keyword / vector / hybrid / agentic (manager, agentic modules, cross-encoder callbacks); query-embedding tokens land on recall. - recall quality: top_score / hit on the search span, plus recall_top_score / recall_hit pushed to Langfuse scores via the bounded-queue sink (method tagged; off the request path). - OME: everos.ome.<strategy> agent span + everos.reflect.consolidate generation; a W3C traceparent captured at enqueue is threaded through the APScheduler job and re-attached in the Runner, so strategies fanned out from a request nest under that request's trace. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
gloryfromca
force-pushed
the
feat/otel-instrumentation
branch
from
July 23, 2026 12:47
7ee23b1 to
357f619
Compare
cyfyifanchen
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Native, opt-in OpenTelemetry instrumentation for EverOS memory operations. Pure OTLP/HTTP — vendor-neutral (Langfuse, an OTel Collector, any OTLP backend); EverOS ships no vendor SDK. Off by default; enable via
[observability].Spans emitted
POST /memory/add·/flusheveros.memory.add/.flusheveros.extracteveros.persist.markdownPOST /memory/searcheveros.memory.searcheveros.search.recall/.rankeveros.ome.<strategy>everos.reflect.consolidatePlus recall-quality scores (
recall_top_score/recall_hit) pushed to Langfuse.Highlights
[otel]is an optional extra, guarded imports (no-op if absent).gen_ai.*usage onto the active span.capture_contentoff by default (metadata only); redaction hook + truncation when on.traceparent; OME strategies fanned out from a request nest under that request's trace (traceparent threaded across the APScheduler boundary).request_idkept independent oftrace_id.Structure
3 commits: (1) tracing chassis + request-id propagation, (2) LLM/embedding token capture, (3) memory-op instrumentation + OME trace linking.
Verification
make lintclean (ruff, import-linter, datetime, openapi).🤖 Generated with Claude Code