Skip to content

Add segment aggregation and static FastAPI attributes#4

Merged
anth-volk merged 1 commit into
mainfrom
codex/segment-aggregation-static-attrs
Jun 23, 2026
Merged

Add segment aggregation and static FastAPI attributes#4
anth-volk merged 1 commit into
mainfrom
codex/segment-aggregation-static-attrs

Conversation

@anth-volk

Copy link
Copy Markdown
Contributor

Summary

Adds the package-level observability primitives needed by downstream services to avoid custom app-owned observability plumbing:

  • accumulates repeated segment timings in request/operation logs instead of overwriting the previous value
  • adds timing_counts to request and operation log records
  • makes set_attribute() update explicit operations nested inside request contexts
  • adds public mark_ttft_attribute() for TTFT-as-log-attribute use cases
  • adds FastAPI static_attributes support so apps can attach platform/runtime metadata without custom middleware
  • clears stale ContextVar state when swapping the configured global runtime

Tests

  • uv run pytest tests/test_runtime.py tests/test_fastapi_adapter.py tests/test_public_api.py
  • uv run --extra dev ruff format --check .
  • uv run --extra dev ruff check .
  • uv run --extra dev --extra all coverage run -m pytest
  • uv run --extra dev --extra all coverage report — 91% coverage

@anth-volk anth-volk marked this pull request as ready for review June 23, 2026 18:39
@anth-volk anth-volk merged commit 7629201 into main Jun 23, 2026
3 checks passed
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