-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support graphql-ruby's new tracing API (backwards compatible) #66
Conversation
(I signed the CLA, but I don't see an option to re-run the job myself.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with the test duplication for now but I think it would be nice to re-use the module for both classes.
re: analyzer changes. We have multiple test gemfiles for different versions of graphql-ruby so these order assertions won't be consistent across those 🤔
👍 I updated it to sort those arrays before comparing them, so it should pass on all versions. And I added a new gemfile to run tests on my WIP branch. |
🎉 looks good to me. The method based tracer is a much better interface |
Thanks for taking a look. I added a benchmark result above. I'll sleep on it and merge that graphql-ruby PR soon, then update this accordingly 👍 |
I merged the new API upstream. As far as |
I'm good with putting it off 👍 The implementation isn't bad anyway and this gem's tracer is basically internal only the way it's designed. If anyone was overriding these tracer methods, they'd be calling |
@rmosolgo this is good to go after a rebase right? |
yep 👀 |
.github/workflows/ruby.yml
Outdated
@@ -7,7 +7,7 @@ jobs: | |||
matrix: | |||
os: [ubuntu-latest] | |||
ruby: ['2.7', '3.0', '3.1', '3.2'] | |||
gemfile: ['graphql_1.13', 'graphql_2.0'] | |||
gemfile: ['graphql_1.13', 'graphql_2.0', 'graphql_experimental'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we repurpose this as graphql_head
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 done
😅 Alright, tests pass locally! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me.
This is to try out a new tracing API (rmosolgo/graphql-ruby#4344). It looks like it will work fine.
I used a lot of duplication as a quick way to test my changes, and then, if the new tracing API is adopted, it will be easy to remove the old code. But another option would be to:
-[x] Include
Trace
inTracer
(since it's a module anyway) and call thecapture_*
methods from there, to reduce duplicationTraceTest
andTest
, rather than duplicate them allLet me know what you think, I'd be happy to make those changes (or others).
Along the way, I found that some tests here fail onInstead, I added code to re-order these arrays before comparing themmaster
, presumably because my refactors to Language::Visitor and Analysis::AST::Visitor (rmosolgo/graphql-ruby#4338) changed the order of these arrays. Is that OK?I also wrote up a little benchmark to confirm the intended impact:
benchmark.rb
And it looks good to me, >10% reduction in both runtime and memory usage. (But this is a reduction in overhead only, so in real queries with application code running, the impact will be less.)