From 07cf9b8577de9b5ce808d88b8c5835432ab29d29 Mon Sep 17 00:00:00 2001 From: phernandez Date: Sun, 1 Nov 2026 09:40:02 -0600 Subject: [PATCH] fix(api): serve read-cache hits without raising through the app fastapi-redis-sdk signals a cache hit by raising CacheHitException from its dependency. Raised while FastAPI solves dependencies, Logfire's FastAPI instrumentation records it on the request span, so every cache hit showed up as an exception (about 76k spans a day in Cloud). ReadCacheRoute now runs the SDK lookup in the route handler, before dependency solving, catches the hit there and returns the cached response. cached_read stays the route-level marker and fails fast if its router does not use ReadCacheRoute. Keys, ETag/304, hit headers, capture, invalidation and the read_cache.read_through span are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016N9c6ouiT4Wid3arGR41Dv Signed-off-by: phernandez --- pyproject.toml | 6 +- src/basic_memory/api/app.py | 8 +- .../api/v2/routers/directory_router.py | 9 +- .../api/v2/routers/knowledge_router.py | 3 +- .../api/v2/routers/memory_router.py | 4 +- .../api/v2/routers/search_router.py | 4 +- src/basic_memory/read_cache/routes.py | 176 ++++++++++++------ test-int/read_cache/test_cache_rules.py | 45 +++++ tests/test_read_cache_route_class.py | 56 ++++++ uv.lock | 68 ++++++- 10 files changed, 305 insertions(+), 74 deletions(-) create mode 100644 tests/test_read_cache_route_class.py diff --git a/pyproject.toml b/pyproject.toml index cf1356cff..65ca15232 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,8 @@ dependencies = [ "fastembed>=0.7.4", "sqlite-vec>=0.1.6", "openai>=1.100.2", - "logfire>=4.19.0", + # The fastapi extra lets read-cache tests instrument the app as production does. + "logfire[fastapi]>=4.19.0", "psutil>=5.9.0", # uvloop's C event loop has no self._ready.popleft() codepath, so the # asyncpg engine-dispose race ("IndexError: pop from an empty deque") that @@ -136,7 +137,8 @@ select = ["E4", "E7", "E9", "F"] [dependency-groups] dev = [ - "logfire>=4.19.0", + # The fastapi extra lets read-cache tests instrument the app as production does. + "logfire[fastapi]>=4.19.0", "gevent>=24.11.1", "icecream>=2.1.3", "pytest>=8.3.4", diff --git a/src/basic_memory/api/app.py b/src/basic_memory/api/app.py index 24ac3f6b3..44d47185e 100644 --- a/src/basic_memory/api/app.py +++ b/src/basic_memory/api/app.py @@ -104,9 +104,11 @@ async def lifespan(app: FastAPI): # pragma: no cover ) -# fastapi-redis-sdk's hit handler and response capture. Registered before the -# workspace middleware so capture runs inside it; cached routes opt in with -# ``cached_read`` dependencies, and every other response passes straight through. +# fastapi-redis-sdk's response capture. Registered before the workspace middleware +# so capture runs inside it; cached routes opt in with ``cached_read`` dependencies, +# and every other response passes straight through. The SDK's hit handler is +# registered too but never reached: ``ReadCacheRoute`` returns hits instead of +# raising them through the app. add_redis_caching(app) # fastapi-redis-sdk reads this module constant on every capture and defaults it # to 10 MiB. The package re-exports a function named ``cache``, which shadows the diff --git a/src/basic_memory/api/v2/routers/directory_router.py b/src/basic_memory/api/v2/routers/directory_router.py index 5794faf2a..c6456ce2a 100644 --- a/src/basic_memory/api/v2/routers/directory_router.py +++ b/src/basic_memory/api/v2/routers/directory_router.py @@ -13,7 +13,12 @@ from basic_memory.read_cache import ReadCacheOperation from basic_memory.read_cache.policy import READ_CACHE_TTL_SECONDS -from basic_memory.read_cache.routes import cached_read, content_group, project_group +from basic_memory.read_cache.routes import ( + ReadCacheRoute, + cached_read, + content_group, + project_group, +) from basic_memory.deps import DirectoryServiceV2ExternalDep from basic_memory.schemas.directory import ( DEFAULT_DIRECTORY_PAGE_SIZE, @@ -23,7 +28,7 @@ DirectorySortOrder, ) -router = APIRouter(prefix="/directory", tags=["directory-v2"]) +router = APIRouter(prefix="/directory", tags=["directory-v2"], route_class=ReadCacheRoute) @router.get( diff --git a/src/basic_memory/api/v2/routers/knowledge_router.py b/src/basic_memory/api/v2/routers/knowledge_router.py index 19d22e4c8..3e5022ac2 100644 --- a/src/basic_memory/api/v2/routers/knowledge_router.py +++ b/src/basic_memory/api/v2/routers/knowledge_router.py @@ -66,6 +66,7 @@ from basic_memory.read_cache import ReadCacheOperation, invalidate_cache from basic_memory.read_cache.policy import READ_CACHE_TTL_SECONDS from basic_memory.read_cache.routes import ( + ReadCacheRoute, cached_read, note_group, project_group, @@ -117,7 +118,7 @@ validate_project_path, ) -router = APIRouter(prefix="/knowledge", tags=["knowledge-v2"]) +router = APIRouter(prefix="/knowledge", tags=["knowledge-v2"], route_class=ReadCacheRoute) def _schedule_post_write_followups( diff --git a/src/basic_memory/api/v2/routers/memory_router.py b/src/basic_memory/api/v2/routers/memory_router.py index ca8bae5bb..7a40fe7e1 100644 --- a/src/basic_memory/api/v2/routers/memory_router.py +++ b/src/basic_memory/api/v2/routers/memory_router.py @@ -13,7 +13,7 @@ from basic_memory import db from basic_memory.read_cache import ReadCacheOperation from basic_memory.read_cache.policy import RECENT_ACTIVITY_READ_CACHE_TTL_SECONDS -from basic_memory.read_cache.routes import cached_read, content_group +from basic_memory.read_cache.routes import ReadCacheRoute, cached_read, content_group from basic_memory.deps import ( ContextServiceV2ExternalDep, EntityRepositoryV2ExternalDep, @@ -35,7 +35,7 @@ from basic_memory.api.v2.utils import to_graph_context # Note: No prefix here - it's added during registration as /v2/{project_id}/memory -router = APIRouter(tags=["memory"]) +router = APIRouter(tags=["memory"], route_class=ReadCacheRoute) @router.get( diff --git a/src/basic_memory/api/v2/routers/search_router.py b/src/basic_memory/api/v2/routers/search_router.py index 89c1afb84..120c0a86a 100644 --- a/src/basic_memory/api/v2/routers/search_router.py +++ b/src/basic_memory/api/v2/routers/search_router.py @@ -17,7 +17,7 @@ ) from basic_memory.read_cache import ReadCacheOperation from basic_memory.read_cache.policy import SEARCH_READ_CACHE_TTL_SECONDS -from basic_memory.read_cache.routes import cached_read, content_group +from basic_memory.read_cache.routes import ReadCacheRoute, cached_read, content_group from basic_memory.deps import ( EntityServiceV2ExternalDep, MemoryTimeIndexRepositoryV2ExternalDep, @@ -33,7 +33,7 @@ from basic_memory.services.search_guidance import unspaced_script_query_hint # App registration mounts this router at /v2/projects/{project_id}. -router = APIRouter(tags=["search"]) +router = APIRouter(tags=["search"], route_class=ReadCacheRoute) async def _search_with_exact_count( diff --git a/src/basic_memory/read_cache/routes.py b/src/basic_memory/read_cache/routes.py index c3d426f47..b0252e751 100644 --- a/src/basic_memory/read_cache/routes.py +++ b/src/basic_memory/read_cache/routes.py @@ -9,19 +9,25 @@ - QUERY support, which the SDK's ``cache()`` bypasses (it caches GET only) - a no-op when the host has no cache configured -Attach with ``dependencies=[cached_read(...)]``. Route-level dependencies resolve -before the endpoint's own parameters, so a hit returns before any dependency that -opens a database connection. +Attach with ``dependencies=[cached_read(...)]`` on a router built with +``route_class=ReadCacheRoute``. The route class serves the read before FastAPI solves +any dependency, so a hit returns before anything opens a database connection. + +The SDK signals a hit by raising ``CacheHitException`` from its dependency. Raised +inside FastAPI's dependency solving, FastAPI instrumentation records it on the +request span as an exception, once per hit. ``ReadCacheRoute`` runs the SDK step +itself and catches the hit before the instrumented route code runs, so a hit is +returned as a response and never raised through the app. """ import json -from collections.abc import AsyncIterator, Awaitable, Callable, Iterator, Mapping +from collections.abc import AsyncGenerator, Awaitable, Callable, Coroutine, Iterator, Mapping from dataclasses import dataclass from functools import lru_cache from typing import Any, override import logfire -from fastapi import Depends, Request +from fastapi import Depends, Request, Response from fastapi.dependencies.models import Dependant from fastapi.routing import APIRoute from pydantic import TypeAdapter @@ -42,6 +48,7 @@ from basic_memory.workspace_context import current_workspace_permalink_context _PENDING_STATE = "redis_cache_pending" +_SERVED_STATE = "basic_memory_read_cache_served" @dataclass(frozen=True, slots=True) @@ -58,6 +65,8 @@ class ReadCacheScope: type ReadCacheScopeResolver = Callable[[Request], Awaitable[ReadCacheScope | None]] type GroupForRequest = Callable[[Request], ReadCacheGroup] +type RouteHandler = Callable[[Request], Coroutine[Any, Any, Response]] +type SdkCacheDependency = Callable[..., AsyncGenerator[None]] async def _resolve_scope(request: Request) -> ReadCacheScope | None: @@ -110,90 +119,140 @@ def method(self) -> str: return "GET" -def cached_read( - operation: ReadCacheOperation, - *, - group: GroupForRequest, - ttl_seconds: int, - hit_headers: Mapping[str, str] | None = None, -) -> Any: - """A route dependency that serves and fills the read cache for ``operation``. +@dataclass(frozen=True, slots=True, eq=False) +class _ReadThrough: + """One route's read cache, served by ``ReadCacheRoute`` around the endpoint. - ``hit_headers`` are response headers the route always sets. A hit returns before - the route runs, and fastapi-redis-sdk 0.8.1 does not replay stored headers, so - they are added to every cached response here. + ``eq=False`` keeps identity hashing: FastAPI caches dependencies by their + callable, and ``hit_headers`` is a dict. """ - async def key_builder(request: Request, eviction_group: str = "", prefix: str = "") -> str: - target: _CachedTarget = request.state.basic_memory_read_cache_target - versions = await target.scope.cache.versions(target.project_id, target.group) - key = entry_key( - prefix=target.scope.cache.prefix, - namespace=target.scope.cache.namespace, - project_id=target.project_id, - operation=operation.value, - versions=versions.token, - request_digest=read_cache_request_digest(target.scope.user_key, target.identity), - ) - # A miss stores under this key, and invalidation can delete it only if it - # was recorded under the versions it embeds. - request.state.basic_memory_read_cache_entry = _LookedUpEntry(versions=versions, key=key) - return key - - sdk_dependency = cache(ttl=ttl_seconds, key_builder=key_builder, cache_prefix="") - - async def dependency(request: Request) -> AsyncIterator[None]: - target = await _cached_target(request, group) + operation: ReadCacheOperation + group: GroupForRequest + ttl_seconds: int + hit_headers: Mapping[str, str] + sdk_dependency: SdkCacheDependency + + async def __call__(self, request: Request) -> None: + """Fail fast when the route was built without ``ReadCacheRoute``. + + Without the route class nothing would serve or fill the cache, and the + route would silently run uncached. + """ + if not getattr(request.state, _SERVED_STATE, False): + raise TypeError("cached_read routes need a router with route_class=ReadCacheRoute") + + async def serve(self, request: Request, endpoint: RouteHandler) -> Response: + """Answer from the cache, or run the endpoint and let the SDK store its response.""" + setattr(request.state, _SERVED_STATE, True) + target = await _cached_target(request, self.group) if target is None: - yield - return + return await endpoint(request) request.state.basic_memory_read_cache_target = target sdk_request = ( _AsGet(request.scope, request.receive) if request.method == "QUERY" else request ) - steps = sdk_dependency(sdk_request, target.scope.cache.client) - cache_hit: CacheHitException | None = None + steps = self.sdk_dependency(sdk_request, target.scope.cache.client) with logfire.span( "read_cache.read_through", - operation=operation.value, + operation=self.operation.value, ) as span: span.set_attributes( { - "cache.operation": operation.value, + "cache.operation": self.operation.value, "cache.group": group_kind(target.group), - "cache.configured_ttl_seconds": ttl_seconds, + "cache.configured_ttl_seconds": self.ttl_seconds, } ) try: - # Raises the SDK's CacheHitException on a hit; its handler turns - # it into the cached response before the endpoint runs. await anext(steps) except CacheHitException as hit: + # The SDK raises on a hit. It is caught here, before FastAPI solves + # dependencies, so instrumentation never records a hit as an error. span.set_attribute("cache.lookup.outcome", "hit") - hit.response.headers.update(hit_headers or {}) - cache_hit = hit + hit.response.headers.update(self.hit_headers) + return hit.response except ReadCacheUnavailable: # Version lookup failed: Redis is down, so the database answers # and nothing is stored under a version we could not read. span.set_attribute("cache.lookup.outcome", "unavailable") skip_read_cache_store(request) - target = None else: - await _track_pending_entry(request, target, ttl_seconds, span) - # The hit is control flow, not a failure. Raise it after the span has - # closed so Logfire does not record every cache hit as an error. - if cache_hit is not None: - raise cache_hit - if target is None: - yield - return + await _track_pending_entry(request, target, ttl_seconds=self.ttl_seconds, span=span) try: - yield + return await endpoint(request) finally: await steps.aclose() - return Depends(dependency) + +class ReadCacheRoute(APIRoute): + """An API route that serves its ``cached_read`` before solving dependencies. + + Routes without a ``cached_read`` dependency get FastAPI's handler unchanged. + """ + + @override + def get_route_handler(self) -> RouteHandler: + endpoint = super().get_route_handler() + read_through = next( + ( + depends.dependency + for depends in self.dependencies + if isinstance(depends.dependency, _ReadThrough) + ), + None, + ) + if read_through is None: + return endpoint + + async def handler(request: Request) -> Response: + return await read_through.serve(request, endpoint) + + return handler + + +def cached_read( + operation: ReadCacheOperation, + *, + group: GroupForRequest, + ttl_seconds: int, + hit_headers: Mapping[str, str] | None = None, +) -> Any: + """A route dependency that marks the route's reads as cached under ``operation``. + + The router must use ``route_class=ReadCacheRoute``, which does the serving. + + ``hit_headers`` are response headers the route always sets. A hit returns before + the route runs, and fastapi-redis-sdk 0.8.1 does not replay stored headers, so + they are added to every cached response here. + """ + + async def key_builder(request: Request, eviction_group: str = "", prefix: str = "") -> str: + target: _CachedTarget = request.state.basic_memory_read_cache_target + versions = await target.scope.cache.versions(target.project_id, target.group) + key = entry_key( + prefix=target.scope.cache.prefix, + namespace=target.scope.cache.namespace, + project_id=target.project_id, + operation=operation.value, + versions=versions.token, + request_digest=read_cache_request_digest(target.scope.user_key, target.identity), + ) + # A miss stores under this key, and invalidation can delete it only if it + # was recorded under the versions it embeds. + request.state.basic_memory_read_cache_entry = _LookedUpEntry(versions=versions, key=key) + return key + + return Depends( + _ReadThrough( + operation=operation, + group=group, + ttl_seconds=ttl_seconds, + hit_headers=dict(hit_headers or {}), + sdk_dependency=cache(ttl=ttl_seconds, key_builder=key_builder, cache_prefix=""), + ) + ) async def _track_pending_entry( @@ -362,6 +421,7 @@ def project_group(request: Request) -> ReadCacheGroup: __all__ = [ + "ReadCacheRoute", "ReadCacheScope", "ReadCacheScopeResolver", "cached_read", diff --git a/test-int/read_cache/test_cache_rules.py b/test-int/read_cache/test_cache_rules.py index bf3136d47..a3f80d160 100644 --- a/test-int/read_cache/test_cache_rules.py +++ b/test-int/read_cache/test_cache_rules.py @@ -12,6 +12,7 @@ import pytest from fastapi import FastAPI +import logfire from httpx import AsyncClient, Response from logfire.testing import CaptureLogfire, capfire as capfire @@ -419,6 +420,50 @@ async def test_each_cached_read_reports_one_span_with_its_outcome( assert span["attributes"].get("logfire.level_num", 9) < 17 +@pytest.mark.asyncio +async def test_a_cache_hit_is_not_recorded_as_an_exception_on_the_request_span( + cached_app: CachedApp, client: AsyncClient, project_url: str, capfire: CaptureLogfire +) -> None: + """Rule: a hit is a response, not an error, on the route span production records. + + fastapi-redis-sdk signals a hit by raising CacheHitException. Raised while FastAPI + solves dependencies, the FastAPI instrumentation records it on the request span, + which in production meant one exception per cache hit. + """ + note = await _create(client, project_url, "Hit Without Exception") + url = f"{project_url}/knowledge/entities/{note['external_id']}" + + # The shared app has already served requests, so Starlette has built its + # middleware stack. Drop it so the next request rebuilds it with (and, after + # the block, without) the OpenTelemetry middleware. + cached_app.app.middleware_stack = None + try: + with logfire.instrument_fastapi(cached_app.app): + first = await client.get(url) + capfire.exporter.clear() + hit = await client.get(url) + finally: + cached_app.app.middleware_stack = None + + assert (_status(first), _status(hit)) == ("MISS", "HIT") + assert hit.json() == first.json() + spans = capfire.exporter.exported_spans_as_dict() + request_spans = [ + span + for span in spans + if span["attributes"].get("http.route") + == "/v2/projects/{project_id}/knowledge/entities/{entity_id}" + ] + assert request_spans, [span["name"] for span in spans] + recorded = [ + event["attributes"].get("exception.type") + for span in spans + for event in span.get("events", []) + if event["name"] == "exception" + ] + assert recorded == [] + + @pytest.mark.asyncio async def test_deleting_a_project_retires_its_cached_reads( cached_app: CachedApp, client: AsyncClient, tmp_path_factory: pytest.TempPathFactory diff --git a/tests/test_read_cache_route_class.py b/tests/test_read_cache_route_class.py new file mode 100644 index 000000000..f4ffa5543 --- /dev/null +++ b/tests/test_read_cache_route_class.py @@ -0,0 +1,56 @@ +"""A cached_read route only serves the cache when its router uses ReadCacheRoute.""" + +import pytest +from fastapi import APIRouter, FastAPI, Request +from httpx import ASGITransport, AsyncClient + +from basic_memory.read_cache import ReadCacheOperation +from basic_memory.read_cache.routes import ( + ReadCacheRoute, + ReadCacheScope, + cached_read, + content_group, +) + + +async def no_cache(request: Request) -> ReadCacheScope | None: + """A host with no cache configured: every read goes to the endpoint.""" + del request + return None + + +def _app(router: APIRouter) -> FastAPI: + @router.get( + "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/projects/{project_id}/tree", + dependencies=[ + cached_read(ReadCacheOperation.directory_tree, group=content_group, ttl_seconds=60) + ], + ) + async def tree(project_id: str) -> dict[str, str]: + return {"project_id": project_id} + + app = FastAPI() + app.state.read_cache_scope_resolver = no_cache + app.include_router(router) + return app + + +@pytest.mark.asyncio +async def test_cached_read_runs_the_endpoint_through_read_cache_route() -> None: + app = _app(APIRouter(route_class=ReadCacheRoute)) + + async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client: + response = await client.get("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/projects/p1/tree") + + assert response.status_code == 200 + assert response.json() == {"project_id": "p1"} + + +@pytest.mark.asyncio +async def test_cached_read_without_read_cache_route_fails_fast() -> None: + """Without the route class nothing serves the cache, so the route refuses to run.""" + app = _app(APIRouter()) + + async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client: + with pytest.raises(TypeError, match="route_class=ReadCacheRoute"): + await client.get("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/projects/p1/tree") diff --git a/uv.lock b/uv.lock index 046011175..3517d60c2 100644 --- a/uv.lock +++ b/uv.lock @@ -251,6 +251,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/da/35/f2287558c17e29fafc8ef3daf819bb9834061cfa43bff8014f7df7f63bdc/anyio-4.14.2-py3-none-any.whl", hash = "sha256:9f505dda5ac9f0c8309b5e8bd445a8c2bf7246f3ce950121e45ea15bc41d1494", size = 125813, upload-time = "2026-07-12T20:29:05.763Z" }, ] +[[package]] +name = "asgiref" +version = "3.13.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/6b/90/f5fce14e95fccf53b58e8e2c47cd84d40d105d64073ae1ac75166db150e0/asgiref-3.13.0.tar.gz", hash = "sha256:034cc8cbf72d00553b4be256703ac545120b4e50af13b49dec99da899aeeecb4", size = 52941, upload-time = "2026-10-23T08:13:14.715Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2e/b0/ec211e1f7966247cb6469158d856bac9aa4c2fe13621bd6a352e4f850453/asgiref-3.13.0-py3-none-any.whl", hash = "sha256:f9596a2434512686473d50f96ff6207fbba49ae1a785dfac614df4aeb085674d", size = 27593, upload-time = "2026-10-23T08:13:13.394Z" }, +] + [[package]] name = "asttokens" version = "3.0.2" @@ -339,7 +348,7 @@ dependencies = [ { name = "filelock" }, { name = "greenlet" }, { name = "httpx" }, - { name = "logfire" }, + { name = "logfire", extra = ["fastapi"] }, { name = "loguru" }, { name = "markdown-it-py" }, { name = "mcp" }, @@ -396,7 +405,7 @@ dev = [ { name = "gevent" }, { name = "icecream" }, { name = "libcst" }, - { name = "logfire" }, + { name = "logfire", extra = ["fastapi"] }, { name = "markitdown", extra = ["docx", "pptx"] }, { name = "pdf-inspector" }, { name = "psycopg" }, @@ -431,7 +440,7 @@ requires-dist = [ { name = "greenlet", specifier = ">=3.1.1" }, { name = "httpx", specifier = ">=0.28.0" }, { name = "litellm", marker = "extra == 'litellm'", specifier = ">=1.91.5,<1.92.0" }, - { name = "logfire", specifier = ">=4.19.0" }, + { name = "logfire", extras = ["fastapi"], specifier = ">=4.19.0" }, { name = "loguru", specifier = ">=0.7.3" }, { name = "markdown-it-py", specifier = ">=3.0.0" }, { name = "markitdown", extras = ["docx", "pptx"], marker = "extra == 'documents'", specifier = ">=0.1.7,<0.2" }, @@ -476,7 +485,7 @@ dev = [ { name = "gevent", specifier = ">=24.11.1" }, { name = "icecream", specifier = ">=2.1.3" }, { name = "libcst", specifier = ">=1.8.6" }, - { name = "logfire", specifier = ">=4.19.0" }, + { name = "logfire", extras = ["fastapi"], specifier = ">=4.19.0" }, { name = "markitdown", extras = ["docx", "pptx"], specifier = ">=0.1.7,<0.2" }, { name = "pdf-inspector", specifier = ">=0.2.6,<2" }, { name = "psycopg", specifier = ">=3.2.0" }, @@ -2154,6 +2163,11 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/44/a8/200e8f24fa205c045a0622e6d2c032c51b7b335b3b54f987106ed832db7b/logfire-5.3.0-py3-none-any.whl", hash = "sha256:8949827f0e92c8eec373310feadd92fe9f87605d6a212e82a7a5491068d56b84", size = 3066, upload-time = "2026-10-23T15:10:56.791Z" }, ] +[package.optional-dependencies] +fastapi = [ + { name = "logfire-sdk", extra = ["fastapi"] }, +] + [[package]] name = "logfire-sdk" version = "5.3.0" @@ -2176,6 +2190,11 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d4/7f/315b7895de489b6c7b8c8bd1a6089d573d8c24ca247b38c43f4d720e7472/logfire_sdk-5.3.0-py3-none-any.whl", hash = "sha256:160a8e280a949001caf4563d2836bd29cdb61b209774cb9634893c0cc5d60e0b", size = 992445, upload-time = "2026-10-23T15:10:59.952Z" }, ] +[package.optional-dependencies] +fastapi = [ + { name = "opentelemetry-instrumentation-fastapi" }, +] + [[package]] name = "loguru" version = "0.7.3" @@ -3023,6 +3042,38 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/da/b2/d1413681ff43e13ac9860df27e1226d3199ab0b97b352ceea41abcc660a5/opentelemetry_instrumentation-0.66b1-py3-none-any.whl", hash = "sha256:4c4aa14dc9a24a02325a9d4c42c4d0208dbb1374c2b1b8fe6c9392d59f3e1008", size = 36904, upload-time = "2026-10-06T17:35:11.663Z" }, ] +[[package]] +name = "opentelemetry-instrumentation-asgi" +version = "0.66b1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "asgiref" }, + { name = "opentelemetry-api" }, + { name = "opentelemetry-instrumentation" }, + { name = "opentelemetry-semantic-conventions" }, + { name = "opentelemetry-util-http" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/5a/d9/ff522f5c3e340e9007554923b1a4d2ac451676f8757bafb3d0057f68b5c3/opentelemetry_instrumentation_asgi-0.66b1.tar.gz", hash = "sha256:78cdc5e45e897e16a8dac9d282e8d5bdf9af2d58e1313fa0bdd4a134c6f9dafc", size = 25992, upload-time = "2026-10-06T17:36:14.593Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/67/ea/10ba99110bf3c9fb736af39c96ca8f3668b988cabb6b59309e058c44461c/opentelemetry_instrumentation_asgi-0.66b1-py3-none-any.whl", hash = "sha256:78b3f9bdf0fa38c65935a2ab46d59e0f9de873a51e0c95b0329f106e2ccb5274", size = 15812, upload-time = "2026-10-06T17:35:17.638Z" }, +] + +[[package]] +name = "opentelemetry-instrumentation-fastapi" +version = "0.66b1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "opentelemetry-api" }, + { name = "opentelemetry-instrumentation" }, + { name = "opentelemetry-instrumentation-asgi" }, + { name = "opentelemetry-semantic-conventions" }, + { name = "opentelemetry-util-http" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/5d/2a/cd4125b7acbea2ed17f1d31b58c184cb0a79fcb5541ceb4de90ffc6d8c01/opentelemetry_instrumentation_fastapi-0.66b1.tar.gz", hash = "sha256:584cf9d2c4417ff8b2d6ff2bc606bfe13c8b3456018bf94f50f2cf658492505b", size = 26634, upload-time = "2026-10-06T17:36:25.157Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/75/70/676928d537978acc7bff2ac8657bd0836ba608ffc8f65455238f1fa2bd0f/opentelemetry_instrumentation_fastapi-0.66b1-py3-none-any.whl", hash = "sha256:97f8ac8fd7537517f9e6988bd0aca04bfa5aad564bcd46c245530739e2be72d1", size = 14216, upload-time = "2026-10-06T17:35:32.827Z" }, +] + [[package]] name = "opentelemetry-proto" version = "1.45.1" @@ -3062,6 +3113,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/bc/14/67f8aa798857f8cf686f515bf93d9bb877ce952ddc8efae0fa25b45ce0d6/opentelemetry_semantic_conventions-0.66b1-py3-none-any.whl", hash = "sha256:d4cddeb4315490b35213f55e2bdc9ac54bb1e4d318927475bed62b35545e581b", size = 206279, upload-time = "2026-10-06T17:32:56.103Z" }, ] +[[package]] +name = "opentelemetry-util-http" +version = "0.66b1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7c/b5/df4b61da899f6ebdffdbdf0c8b0f3189ee57151694ccd5b7d50ee2906241/opentelemetry_util_http-0.66b1.tar.gz", hash = "sha256:047dea1a628031f857a5a32261dc0e955bc162d39993ed1cffb8f2cff5ba8a62", size = 11586, upload-time = "2026-10-06T17:36:46.572Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/eb/9b/c77ecaea79ba0de1a11e7f06a7f5eea7043ec23f1860dcf5f03536698e4c/opentelemetry_util_http-0.66b1-py3-none-any.whl", hash = "sha256:8f443d7abcaf29c4a07b373bbd31b5b39132c0ed3c27d015a59dc0323d5b1c58", size = 8387, upload-time = "2026-10-06T17:36:06.984Z" }, +] + [[package]] name = "orjson" version = "3.11.9"