Fix stats endpoint missing tenant authentication (#134)
The /v1/default/banks/{bank_id}/stats endpoint was missing the
request_context parameter and tenant authentication call, causing
it to query the public schema instead of the tenant's schema.
This resulted in stats always returning zeros for multi-tenant
deployments since the data lives in tenant-specific schemas.
Added request_context dependency and _authenticate_tenant() call
to properly set the tenant schema before querying stats.
This commit is contained in:
parent
3bb6a38b5c
commit
d6ff191198
1 changed files with 6 additions and 1 deletions
|
|
@ -1360,9 +1360,14 @@ def _register_routes(app: FastAPI):
|
|||
operation_id="get_agent_stats",
|
||||
tags=["Banks"],
|
||||
)
|
||||
async def api_stats(bank_id: str):
|
||||
async def api_stats(
|
||||
bank_id: str,
|
||||
request_context: RequestContext = Depends(get_request_context),
|
||||
):
|
||||
"""Get statistics about memory nodes and links for a memory bank."""
|
||||
try:
|
||||
# Authenticate and set tenant schema
|
||||
await app.state.memory._authenticate_tenant(request_context)
|
||||
pool = await app.state.memory._get_pool()
|
||||
async with acquire_with_retry(pool) as conn:
|
||||
# Get node counts by fact_type
|
||||
|
|
|
|||
Loading…
Reference in a new issue