Skip to content

refactor(tracing)!: drop the Agentex span processor and own the Span model in lib - #517

Open
mohammadatallah-scale wants to merge 2 commits into
nextfrom
mohammad/remove-legacy-spans
Open

refactor(tracing)!: drop the Agentex span processor and own the Span model in lib#517
mohammadatallah-scale wants to merge 2 commits into
nextfrom
mohammad/remove-legacy-spans

Conversation

@mohammadatallah-scale

@mohammadatallah-scale mohammadatallah-scale commented Sep 11, 2026

Copy link
Copy Markdown

Important

Pending Mohammad's self-review. This note is removed by a human, not automation.

The problem. The Agentex server is retiring its Postgres spans API (scaleapi/scale-agentex#430). The SDK still ships the processor that writes to it and two trace helpers that read it back. The in-memory span handed to processors is that API's generated model, so it vanishes when the spec drops the routes.

The fix. This is a breaking change for the two removed surfaces.

  • Span model: now lives in the library's tracing types and stays exported from the core tracing package, import it from there.
  • Agentex processor: removed with its config type and the two read helpers. An unknown processor type now fails at registration naming the replacement.
  • Generated files: untouched, Stainless removes the spans resource once the server spec merges. Land this first so the next branch keeps importing.

Test plan

  • gap: not run against a generation without the generated span type, since that generation only exists after the server change merges. The compat suite still pins the current server spec.

RetriggerConfidence Score: 5/5

The changes since the previous review appear safe to merge, with no new actionable failures identified.

Summary

  • Exports the new library-owned Span throughout tracing, ADK, Temporal, examples, and tests.
  • Removes the Agentex tracing processor, its configuration type, and span retrieval helpers.
  • Rejects unsupported processor configurations with migration guidance toward SGP.
  • Makes processor configuration locking reentrant and adds compatibility and registration tests.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Caller[Tracing caller] --> Tracer[Tracer / AsyncTracer]
    Tracer --> Trace[Trace / AsyncTrace]
    Trace --> Span[Library-owned Span]
    Span --> Manager[TracingProcessorManager]
    Manager --> SGP[SGP tracing processor]
    SGP --> Backend[SGP backend]
Loading

Reviews (2) · Last reviewed commit: "fix(tracing): keep extra span keys, make..."

…he Span model in lib

The Agentex server is retiring its Postgres-backed /spans API, so the
processor that wrote to it goes, along with the Trace helpers that read
spans back through the client. The SGP processor is the only sink.

The in-memory Span handed to processors was the generated client type
for that API. It now lives in agentex.lib.types.tracing and is still
exported from agentex.lib.core.tracing, so it survives the generated
surface disappearing when the server spec drops the routes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Comment thread src/agentex/lib/types/tracing.py
Comment thread src/agentex/lib/core/tracing/tracing_processor_manager.py
@mohammadatallah-scale

Copy link
Copy Markdown
Author

P2 CHANGELOG.md - the hand-maintained Unreleased breaking-changes block has no entry for the removed processor, config type and read helpers, or for the span model moving.
P2 tests/lib/core/tracing/test_tracing_processor_manager.py - only the rejection branch is covered, nothing drives an SGP config through the new guard and checks one sync and one async processor register.
P3 src/agentex/lib/types/tracing.py:22 - to_dict() / to_json() now return the full JSON-mode dump and model_construct no longer coerces datetimes, unlike the generated base. No caller in this repo, so a changelog line rather than a shim.
P3 trace.py:221,358 and span_error.py:14, sgp_tracing_processor.py:75 - prose still says these wrap the Agentex API or serialize through the Agentex processor.
P3 trace.py:239 - client is stored and never read now, and adk/_modules/tracing.py:173 still builds an httpx client per event loop only to pass it in.
P3 trace.py:327,482 - three blank lines left where the methods were removed.

…, drop the tracer's dead client

Review follow-ups on the span-processor removal:
- Span keeps unknown keys like the generated model it replaces, so a
  custom processor's own attributes and older worker payloads survive.
- set_processor_configs re-enters add_processor_config under the manager
  lock, which deadlocked on a plain Lock. Reentrant now, with tests for the
  SGP happy path and the batch registration.
- Trace and Tracer no longer use the client they receive, so it is optional
  and the ADK tracing module stops building an httpx client per event loop.
- Changelog entry for the breaking removals, stale prose updated.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mohammadatallah-scale

Copy link
Copy Markdown
Author

Landed in 62b97be: changelog entry under the Unreleased breaking changes, SGP happy-path and batch-registration tests, the stale prose, the optional client (the ADK module no longer builds an httpx client per event loop) and the blank lines. Left as documented rather than shimmed: the generated base's to_dict / to_json defaults and model_construct coercion, named in the changelog entry.

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.

2 participants