-
Notifications
You must be signed in to change notification settings - Fork 37
fix(async): Correct async HTTP method handling in Datasource.smartquery() #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #224 +/- ##
==========================================
- Coverage 92.40% 89.94% -2.47%
==========================================
Files 27 27
Lines 1818 1810 -8
==========================================
- Hits 1680 1628 -52
- Misses 138 182 +44
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hi. Thanks for your patch. Maybe this is something to consider for the async code generator instead? /cc @Ousret |
Perhaps, but the current code is indeed not working properly. I'm using the smartquery interface, so fixing this issue would be really helpful for me. Otherwise, I'd have to use synchronous methods for this interface, which would be quite cumbersome. |
We hear you. The thing is that the async code is getting generated, so I think we need to fix the generator instead. Maybe you can also make a difference there? generate_async.py it is. |
I have to admit I am looking at the very ingredients of I think the culprit is around this spot at line 104. grafana-client/script/generate_async.py Lines 102 to 110 in 6aa9701
|
This fixes a TypeError that occurred when trying to await HTTP method references instead of properly calling them. The changes: 1. Remove incorrect `await` when assigning POST/GET method references 2. Add proper `await` when actually making the request The bug prevented successful POST requests in the async datasource query functionality.
Hi again. I've just added the fix for the code converter to complete the job. Thanks again! |
Great catch! I maybe available soon to implement unasync and mirror all the tests also. |
Description:
This PR fixes a TypeError in the async smartquery() method where HTTP method references (POST/GET) were incorrectly being awaited during assignment rather than during execution.
Changes:
Impact:
• Fixes broken POST request functionality in async datasource queries
• Maintains consistent async behavior throughout the method
• Follows proper async/await patterns for HTTP requests
Testing:
Manual verification was performed by:
Related Issues:
#223
Checklist:
Code follows the project's style guidelines
Tests pass (or N/A - this bug wasn't caught by existing tests)