fix(observer): pass RequestContext through vikingdb observer for tenant-scoped vector count#807
Merged
MaojiaSheng merged 1 commit intomainfrom Mar 20, 2026
Conversation
…nt-scoped vector count VikingDBObserver.count() was called without RequestContext, falling back to account_id="default" and filtering out vectors from other tenants. Thread ctx from the HTTP router through ObserverService and VikingDBObserver so each tenant only sees their own vector count. Closes #786 Credit-To: jackjin1997
|
Failed to generate code suggestions for PR |
MaojiaSheng
approved these changes
Mar 20, 2026
zeattacker
pushed a commit
to zeattacker/OpenViking
that referenced
this pull request
Mar 20, 2026
…nt-scoped vector count (volcengine#807) VikingDBObserver.count() was called without RequestContext, falling back to account_id="default" and filtering out vectors from other tenants. Thread ctx from the HTTP router through ObserverService and VikingDBObserver so each tenant only sees their own vector count. Closes volcengine#786 Credit-To: jackjin1997
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The VikingDB observer and
/api/v1/observer/vikingdbendpoint always returnedvector_count: 0for non-default tenants. The root cause is thatVikingDBObserver.count()was called withoutRequestContext, falling back toaccount_id="default"which filters out vectors belonging to other tenants.This PR threads
RequestContextfrom the HTTP router all the way throughObserverService→VikingDBObserver→VikingVectorIndexBackend.count(ctx=ctx), so each tenant only sees their own vector count.Related Issue
Fixes #786
Type of Change
Changes Made
vikingdb_observer.py— Addctx: Optional[RequestContext]parameter toget_status_table_async(),get_status_table(), and_get_collection_statuses(). Passctxtovikingdb_manager.count(ctx=ctx).debug_service.py— Changevikingdbandsystemfrom@propertyto methods acceptingctxparameter. Updateis_healthy()to callsystem().observer.py— Passctxfrom router toObserverService.vikingdb(ctx=ctx)andObserverService.system(ctx=ctx)for/vikingdband/systemendpoints.local.py— Adaptget_status()to callsystem()as a method.tests/— Updatetest_debug_service.pyandtest_vikingdb_observer.pyto use method calls instead of property access.docs/— Update SDK examples indocs/zh/api/07-system.md,docs/en/api/07-system.md, andopenviking/storage/observers/README.mdto reflect the property-to-method change.Testing
Checklist
Additional Notes
Breaking change for local SDK users:
client.observer.vikingdbandclient.observer.systemare now methods instead of properties. Users need to add parentheses:client.observer.vikingdb(),client.observer.system(). The HTTP SDK client (_HTTPObserver) is not affected as it has its own independent property-based interface.This is an alternative approach to PR #802, which used
include_all_accounts=Trueto bypass tenant isolation. That approach has two issues:_SingleAccountBackend.get_collection_info()callsself.count(include_all_accounts=True)but_SingleAccountBackend.count()doesn't accept that parameter, causing aTypeErrorCredit-To: jackjin1997
🤖 Generated with Claude Code