Skip to content
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

Add Tracing::Trace for method-based tracing #4344

Merged
merged 20 commits into from
Feb 22, 2023
Merged

Add Tracing::Trace for method-based tracing #4344

merged 20 commits into from
Feb 22, 2023

Conversation

rmosolgo
Copy link
Owner

@rmosolgo rmosolgo commented Feb 14, 2023

Implements #4313

When tracing only Hashes:

- Total allocated: 5732040 bytes (28113 objects)
+ Total allocated: 3882696 bytes (17105 objects)
Remaining Hash allocations after this change, just FYI

      4010  /Users/rmosolgo/code/graphql-ruby/lib/graphql/schema/member/has_arguments.rb:114
      4001  /Users/rmosolgo/code/graphql-ruby/lib/graphql/schema/member/has_arguments.rb:265
      4001  /Users/rmosolgo/code/graphql-ruby/lib/graphql/schema/member/has_arguments.rb:286
      3001  /Users/rmosolgo/code/graphql-ruby/lib/graphql/schema/field.rb:808
      1001  /Users/rmosolgo/code/graphql-ruby/lib/graphql/execution/interpreter/runtime.rb:41
      1001  /Users/rmosolgo/code/graphql-ruby/lib/graphql/execution/interpreter/runtime.rb:65

TODO:

  • Make each schema class have its own tracer class that inherits from its superclass's tracer class
    • Add behaviors via modules ... dsl? tracer_module(...)?
    • How to keep options separate between modules? punt
  • update tests to use this new API
  • build a compatibility layer that calls old-style tracing (strings) from a new-style tracing object
  • Update the built-in tracers
  • Decide if/how to handle backtrace: true punt
  • Make sure it works with shopify/graphql-metrics
  • Update the docs

@rmosolgo rmosolgo added this to the 2.0.18 milestone Feb 14, 2023
jazairi added a commit to MITLibraries/timdex that referenced this pull request Mar 20, 2023
Why these changes are being introduced:

The tracer API was overhauled in v2.0.18 of GraphQL for
performance reasons. Custom tracers are now defined as modules
instead of classes, and hooks are mixed in using `Schema.trace_with`.
The old way of defining custom tracers is still allowed by
adding `trace_class(GraphQL::Tracing::LegacyTrace)` to the schema.

See rmosolgo/graphql-ruby#4344 for more
info on this change.

Relevant ticket(s):

N/A.

How this addresses that need:

This updates graphql-ruby to the latest version and specifies the
legacy tracer API in the schema.

Side effects of this change:

We should update our tracer to use the new API. I opened a ticket
to that effect: https://mitlibraries.atlassian.net/browse/ENGX-221
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant