Skip to content

fix: retain standalone integration traces - #1

Draft
weivwang wants to merge 1 commit into
mainfrom
agent/retain-standalone-integration-traces
Draft

fix: retain standalone integration traces#1
weivwang wants to merge 1 commit into
mainfrom
agent/retain-standalone-integration-traces

Conversation

@weivwang

Copy link
Copy Markdown
Owner

What changed

  • retain start_span() calls made outside an explicit trace as queryable one-span traces
  • propagate a temporary trace context so nested spans attach to the standalone root
  • emit the same trace_start / trace_end lifecycle events used by explicit traces
  • add regression coverage for queryability, nesting, error status, and context cleanup

Why

The zero-config OpenAI and Anthropic integrations call start_span() directly. When an application used the documented instrument_all() flow without wrapping every SDK call in start_trace(), the span completed but was never added to _traces. Dashboards and exporters therefore saw no trace even though instrumentation ran successfully.

Impact

Auto-instrumented provider calls now remain visible without requiring an undocumented explicit trace wrapper. Existing spans inside an explicit trace keep their current parent-child behavior.

Validation

  • uv run --with pytest --with pytest-asyncio pytest -q — 41 passed
  • uv build — wheel and source distribution built successfully
  • git diff --check

The repository's existing ruff check agent_trace/ baseline is currently not clean (pre-existing import-order, unused-import, line-length, and Python-3.9-incompatible UP045 findings); this PR does not broaden scope into a repository-wide formatting migration.

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