IHS-219: Add query_name parameter to all(), filters(), and get() for observability#965
Merged
solababs merged 6 commits intoinfrahub-developfrom Apr 23, 2026
Conversation
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## infrahub-develop #965 +/- ##
====================================================
+ Coverage 81.11% 81.40% +0.29%
====================================================
Files 134 134
Lines 11314 11347 +33
Branches 1693 1703 +10
====================================================
+ Hits 9177 9237 +60
+ Misses 1594 1567 -27
Partials 543 543
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Deploying infrahub-sdk-python with
|
| Latest commit: |
c2381d6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8ae4178d.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://sb-23042026-add-query-name-t.infrahub-sdk-python.pages.dev |
ajtmccarty
approved these changes
Apr 23, 2026
| parallel (bool, optional): Whether to use parallel processing for the query. | ||
| order (Order, optional): Ordering related options. Setting `disable=True` enhances performances. | ||
| include_metadata (bool, optional): If True, includes node_metadata and relationship_metadata in the query. | ||
| query_name (str, optional): If provided is used a the GraphQL operation name else All_<kind> is used. |
Contributor
There was a problem hiding this comment.
is used a -> is used as
| parallel (bool, optional): Whether to use parallel processing for the query. | ||
| order (Order, optional): Ordering related options. Setting `disable=True` enhances performances. | ||
| include_metadata (bool, optional): If True, includes node_metadata and relationship_metadata in the query. | ||
| query_name (str, optional): If provided is used a the GraphQL operation name else Filters_<kind> is used. |
| parallel (bool, optional): Whether to use parallel processing for the query. | ||
| order (Order, optional): Ordering related options. Setting `disable=True` enhances performances. | ||
| include_metadata (bool, optional): If True, includes node_metadata and relationship_metadata in the query. | ||
| query_name (str, optional): If provided is used a the GraphQL operation name else All_<kind> is used. |
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.
Why
When the SDK issues GraphQL queries internally, they are anonymous (
query { ... }), making it impossible to correlate a slow backend trace span back to a specific call site. Developers debugging performance issues have no way to tell whichall()orfilters()call produced a given trace.Goal: give every SDK-generated query a meaningful GraphQL operation name so trace spans are identifiable without custom instrumentation.
Closes #923
What changed
all(),filters(),get(), andcount()on bothInfrahubClientandInfrahubClientSyncnow accept an optionalquery_name: str | None = Noneparameter.query_nameis supplied it becomes the GraphQL operation name (e.g.query GetAllEdgeDevices { ... }).All_CoreRepository,Filters_CoreRepository,Get_CoreRepository,Count_CoreRepository. This means all queries now have an operation name — previously they were anonymous.How to test
uv run pytest tests/unit/sdk/test_client.py -k "query_name" -vImpact & rollout
query_namedefaults to an auto-generated value, so existing call sites need no changes.Checklist
uv run towncrier create ...)