Repository navigation
fix(milvus): capture span attributes for positionally-passed arguments - #4707
Open
gauravkr2209 wants to merge 3 commits into
Open
gauravkr2209 wants to merge 3 commits into
gauravkr2209 wants to merge 3 commits into
Conversation
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.
Problem
The Milvus instrumentation reads request data only from
kwargs.MilvusClient.insert(collection_name, data),search(collection_name, data)anddelete(collection_name, ids)are valid positional calls. With positional arguments the span loses its data attributes (e.g.client.insert(COLLECTION, ROWS)produced a span missing the collection name and data count).Fix
Bind the call's args and kwargs to the wrapped method's signature (
inspect.signature(...).bind_partial), flatten any**kwargs, skip*args, and fall back tokwargsif binding fails, so behaviour never gets worse. Only the attribute-reading path changes; the wrapped call itself is untouched.Tests
Added
tests/test_positional_args.py(3 tests, real local Milvus Lite in a tmp dir, no network). They fail on main and pass with this change. Full Milvus suite with the fix: 15 passed.ruff checkpasses on all three files.Before / after
Before:
client.insert(COLLECTION, ROWS)positionally produced a span without the collection name and data count. After: the span carries the collection name and data count (MILVUS_INSERT_DATA_COUNT2 for 2 rows), identical to the keyword call.Summary by CodeRabbit