Uh oh!
There was an error while loading. Please reload this page.
Expose the operation name from juniper_rocket::GraphQLRequest - #353
Conversation
Measuring the runtime of queries will only tell if there are slow queries. To find out which queries are slow you need the operation name. Getting the operation name was previously not possible from a Rocket request handler. This fixes that.
Codecov Report
@@ Coverage Diff @@## master #353 +/- ##
==========================================
- Coverage 88.32% 86.37% -1.96%
==========================================
Files 103 105 +2 Lines 14922 15373 +451 ==========================================
+ Hits 13180 13278 +98 - Misses 1742 2095 +353
Continue to review full report at Codecov.
|
theduke
commented
May 11, 2019
Looks good. Two nits:
|
davidpdrsn
commented
May 11, 2019
@theduke Done |
LegNeato
left a comment
There was a problem hiding this comment.
Looks great! Please add an integration test for juniper and juniper_rocket to make sure we don't regress in the future.
| if reqs.len() == 1 { | ||
| reqs.get(0).and_then(|req| req.operation_name()) | ||
| } else { | ||
| None |
There was a problem hiding this comment.
Wouldn't we want a list of operations for batch requests for the same usecase?
davidpdrsn
commented
May 12, 2019
Exact toolchain is |
LegNeato
commented
May 14, 2019
The bug you are hitting is rust-lang/rust#59344. |
davidpdrsn
commented
May 14, 2019
It seems a solution was recently merged. I'll give it another shot on the latest nightly. |
davidpdrsn
commented
May 15, 2019
I have added an integration test now. I wasn't quite sure if it also made sense to test the path where there is no operation name provided. I decided to trust the typesystem 😊 Let me know if you would like that. |
LegNeato
commented
May 15, 2019
Thanks! |
I ran into this issue recently when implementing performance performance
monitoring for an app using juniper-rocket.