Skip to content

feat(tracing): TraceSink network sink (file + HTTP collector) — v0.2.0#3

Merged
Svaag merged 1 commit into
mainfrom
feat/tracing-network-sink
Jun 29, 2026
Merged

feat(tracing): TraceSink network sink (file + HTTP collector) — v0.2.0#3
Svaag merged 1 commit into
mainfrom
feat/tracing-network-sink

Conversation

@Svaag

@Svaag Svaag commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Adds agent_core/tracing/sink.py so producers can ship TraceEvents to a central
collector, not just write dead-end local JSONL.

  • NullSink, JsonlFileSink, HttpSink (stdlib urllib POST), MultiSink.
  • sink_from_env(flag_env): builds file and/or HTTP sinks from env — adds
    {flag}_COLLECTOR_URL (+ optional {flag}_COLLECTOR_TOKEN) alongside the existing
    {flag}_PATH. Backward-compatible with the current file-only emitters.
  • Best-effort: emit() never raises. stdlib-only — core stays dependency-light.

This is the foundation for the trace collector (C2). The HTTP sink is the right fit for the
read-only knowledge-mcp container (no writable-volume hack). Bumped to 0.2.0.

ruff + mypy clean; 32 tests pass.

🤖 Generated with Claude Code

agent_core/tracing/sink.py: NullSink, JsonlFileSink, HttpSink (stdlib urllib POST), MultiSink, and sink_from_env(flag_env) building file and/or HTTP sinks from env ({flag}_COLLECTOR_URL alongside the existing {flag}_PATH; backward-compatible). Best-effort: emit() never raises. Lets producers ship TraceEvents to a central collector (the right fit for the read-only knowledge-mcp container) instead of dead-end local files. Contracts stay dependency-light (stdlib only).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Svaag Svaag merged commit a4c9c34 into main Jun 29, 2026
1 check passed
@Svaag Svaag deleted the feat/tracing-network-sink branch June 29, 2026 11:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b98852b667

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

def emit(self, event: TraceEvent) -> bool:
delivered = False
for sink in self.sinks:
if sink.emit(event):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Catch per-sink failures in MultiSink

When MultiSink is used with a custom sink (or a built-in sink with an unexpected bug), an exception from sink.emit(event) propagates and prevents later sinks from receiving the event. That breaks the documented best-effort contract that emit() never raises; for example, MultiSink([raising_sink, JsonlFileSink(...)]) would lose the file delivery instead of returning whether any sink succeeded. Wrap each per-sink emit in try/except and continue fanout.

Useful? React with 👍 / 👎.

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.

1 participant