Skip to content

Commit

Permalink
[CHORE] Add instrumentation to a slow Python call.
Browse files Browse the repository at this point in the history
  • Loading branch information
rescrv committed Dec 18, 2024
1 parent 9ed5b07 commit a15c780
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions chromadb/server/fastapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,17 +710,20 @@ async def get_collection(

add_attributes_to_current_span({"tenant": tenant})

api_collection_model = cast(
CollectionModel,
await to_thread.run_sync(
self._api.get_collection,
collection_name,
tenant,
database_name,
limiter=self._capacity_limiter,
),
)
return api_collection_model
@trace_method("Outside the pool", OpenTelemetryGranularity.OPERATION)
def inner():
api_collection_model = cast(
CollectionModel,
await to_thread.run_sync(
self._api.get_collection,
collection_name,
tenant,
database_name,
limiter=self._capacity_limiter,
),
)
return api_collection_model
return inner()

@trace_method("FastAPI.update_collection", OpenTelemetryGranularity.OPERATION)
async def update_collection(
Expand Down

0 comments on commit a15c780

Please sign in to comment.