Component
Python SDK
Infrahub SDK version
1.23.1 (verified on develop @ 9b39ab4)
Current Behavior
get_diff_summary() sends its request under the wrong GraphQL operation name. It builds the summary query but reports the operation as GetDiffTree.
infrahub_sdk/client.py, sync at :3386 (async at :1794):
def get_diff_summary(self, branch, name=None, from_time=None, to_time=None, ...):
query = get_diff_summary_query()
...
response = self.execute_graphql(
query=query,
branch_name=branch,
timeout=timeout,
tracker=tracker,
variables=input_data,
operation_name="GetDiffTree", # <- hardcoded, and belongs to the other method
priority=priority,
)
get_diff_tree() gets this right — it passes operation_name=query.name (:3462 sync, :1870 async). Only the summary path hardcodes a literal, and the literal it hardcodes is the other method's operation.
Effect: get_diff_summary and get_diff_tree are indistinguishable in server-side query logs, traces and any observability tooling keyed on operationName. Two different queries with different cost profiles are attributed to one name.
This works against two changes made deliberately in 1.22.0 — adding query_name "to be used as meaningful GraphQL operation name for observability" (#923), and sending "the GraphQL operation name as operationName in the request payload so tracing and observability tools can identify each query".
Expected Behavior
get_diff_summary() reports its own operation name, most simply by using the query's own name the way get_diff_tree() already does:
operation_name=query.name,
Both async and sync clients need the change. If get_diff_summary_query() does not expose a distinct .name, giving it one (e.g. GetDiffSummary) is part of the fix.
Steps to Reproduce
- Enable GraphQL query logging on the Infrahub server (or point the client at any HTTP proxy that records request bodies).
- Call
client.get_diff_summary(branch="some-branch").
- Inspect the request payload:
operationName is GetDiffTree, not a summary-specific name.
- Call
client.get_diff_tree(branch="some-branch") — the same operationName is reported for a different query.
Additional Information
Small fix, filed for completeness after an audit of the diff methods.
While looking at this: #529 ("task: Implement functions to perform the DiffUpdate mutation") appears to be already done — create_diff() performs DiffUpdate, and the 1.15.0 changelog credits #529. It may be closeable.
Found while auditing which SDK capabilities the opsmill.infrahub Ansible collection does not yet expose. Related collection issue: opsmill/infrahub-ansible#396.
Component
Python SDK
Infrahub SDK version
1.23.1 (verified on
develop@ 9b39ab4)Current Behavior
get_diff_summary()sends its request under the wrong GraphQL operation name. It builds the summary query but reports the operation asGetDiffTree.infrahub_sdk/client.py, sync at:3386(async at:1794):get_diff_tree()gets this right — it passesoperation_name=query.name(:3462sync,:1870async). Only the summary path hardcodes a literal, and the literal it hardcodes is the other method's operation.Effect:
get_diff_summaryandget_diff_treeare indistinguishable in server-side query logs, traces and any observability tooling keyed onoperationName. Two different queries with different cost profiles are attributed to one name.This works against two changes made deliberately in 1.22.0 — adding
query_name"to be used as meaningful GraphQL operation name for observability" (#923), and sending "the GraphQL operation name asoperationNamein the request payload so tracing and observability tools can identify each query".Expected Behavior
get_diff_summary()reports its own operation name, most simply by using the query's own name the wayget_diff_tree()already does:Both async and sync clients need the change. If
get_diff_summary_query()does not expose a distinct.name, giving it one (e.g.GetDiffSummary) is part of the fix.Steps to Reproduce
client.get_diff_summary(branch="some-branch").operationNameisGetDiffTree, not a summary-specific name.client.get_diff_tree(branch="some-branch")— the sameoperationNameis reported for a different query.Additional Information
Small fix, filed for completeness after an audit of the diff methods.
While looking at this: #529 ("task: Implement functions to perform the
DiffUpdatemutation") appears to be already done —create_diff()performsDiffUpdate, and the 1.15.0 changelog credits #529. It may be closeable.Found while auditing which SDK capabilities the
opsmill.infrahubAnsible collection does not yet expose. Related collection issue: opsmill/infrahub-ansible#396.