feat(dev): collect local OTEL traces in project dev - #1980
Open
tejaskash wants to merge 1 commit into
Open
Conversation
tejaskash
had a problem deploying
to
e2e-testing
August 12, 2026 14:44 — with
GitHub Actions
Failure
tejaskash
had a problem deploying
to
e2e-testing
August 12, 2026 14:47 — with
GitHub Actions
Failure
tejaskash
force-pushed
the
feat/dev-otel-collector
branch
from
August 14, 2026 20:38
b4d0349 to
e2e696c
Compare
tejaskash
had a problem deploying
to
e2e-testing
August 14, 2026 20:39 — with
GitHub Actions
Failure
tejaskash
had a problem deploying
to
e2e-testing
August 14, 2026 20:59 — with
GitHub Actions
Failure
tejaskash
force-pushed
the
feat/dev-otel-collector
branch
from
August 17, 2026 17:30
56c20f7 to
a59ebf1
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/dev-otel-storage #1980 +/- ##
=========================================================
+ Coverage 97.11% 97.13% +0.02%
=========================================================
Files 385 387 +2
Lines 22918 23117 +199
=========================================================
+ Hits 22256 22455 +199
Misses 662 662 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tejaskash
force-pushed
the
feat/dev-otel-collector
branch
2 times, most recently
from
August 17, 2026 17:53
cad8772 to
7e315b9
Compare
tejaskash
force-pushed
the
feat/dev-otel-collector
branch
2 times, most recently
from
August 19, 2026 16:02
aabb87f to
4548048
Compare
tejaskash
force-pushed
the
feat/dev-otel-collector
branch
from
August 19, 2026 18:47
4548048 to
a9eecdf
Compare
Contributor
|
based on description, it sounds like #2039 needs to land first so looking at that one now. |
notgitika
reviewed
Aug 19, 2026
tejaskash
force-pushed
the
feat/dev-otel-collector
branch
from
August 19, 2026 19:42
a9eecdf to
84429af
Compare
Contributor
Author
|
Review response, all four findings addressed in
|
tejaskash
added a commit
that referenced
this pull request
Aug 20, 2026
Pure OTLP wire handling (per-trace batch partitioning, id normalization, frontend shaping) and append-only per-trace JSONL storage. A batch routinely carries spans from several traces, so persistence partitions by trace id — writing whole batches under the first id corrupts trace identity. Consumed by the OTLP collector in #1980, which stacks on this.
tejaskash
force-pushed
the
feat/dev-otel-collector
branch
from
August 20, 2026 16:09
84429af to
d070faf
Compare
An in-process OTLP/HTTP receiver (protobuf via the pinned otlp-transformer decoders, or JSON) persists agent traces through the storage layer. project dev starts it unless --no-traces or the runtime disables instrumentation, points every spawned agent at it (signal-specific OTEL env), rewrites the endpoint to host.docker.internal for containers — with an explicit host-gateway mapping so Linux Docker Engine resolves it — and keeps uvicorn --reload workers instrumented via sitecustomize on PYTHONPATH. Oversized collector requests get a 413 before the connection closes so exporters do not retry them as transient failures. Rebuilt from explicit paths: the previous tree-snapshot commit accidentally reverted unrelated merged work (cdk target guard, config-bundle TUI, error classification).
tejaskash
added a commit
that referenced
this pull request
Aug 20, 2026
Pure OTLP wire handling (per-trace batch partitioning, id normalization, frontend shaping) and append-only per-trace JSONL storage. A batch routinely carries spans from several traces, so persistence partitions by trace id — writing whole batches under the first id corrupts trace identity. Consumed by the OTLP collector in #1980, which stacks on this.
tejaskash
force-pushed
the
feat/dev-otel-collector
branch
from
August 20, 2026 16:18
d070faf to
dd15e9e
Compare
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.
Review this after #2043
This PR now contains exactly two things: the commits of #2039 (the OTLP trace storage layer it builds on) plus one commit of its own (~1,004 lines) — the part to review here. GitHub's stack tooling wouldn't let the base retarget, so until #2039 merges the diff shows both; after #2039 merges this collapses to just the collector work.
What this does (the ~1,004-line commit)
When you run
agentcore project dev, your agent gets local tracing out of the box: an in-process OTLP/HTTP receiver starts on a loopback port, the agent's OpenTelemetry SDK is pointed at it via environment variables, and traces persist through #2039's TraceStore toagentcore/.cli/traces/. Nothing leaves the machine;--no-tracesorinstrumentation.enableOtel: falseopts out.io/httpServer.ts— loopback-onlynode:httpprimitive (body caps, abort-signal close).otel/collector.ts—POST /v1/traces+/v1/logs, protobuf (pinned@opentelemetry/otlp-transformer@0.213.0— the last version shipping request decoders; don't let dependabot bump it) or JSON.host.docker.internalrewrite for containers; sitecustomize-on-PYTHONPATH souvicorn --reloadworkers stay instrumented (a wrapper would only instrument the reloader parent).Verification
Per-layer tests (receiver over real ephemeral-port HTTP with protobuf+JSON fixtures; handler with fake runners/collector; runner probe fakes) plus the end-to-end proof: built bundle → real
project create(uv sync) →project dev→ real Bedrock invocation → traces on disk. Protobuf decode verified under bun source, the Node bundle, and a compiled binary.