-
Notifications
You must be signed in to change notification settings - Fork 80
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
fix: Make the tracer work with the new interpreter runtime #59
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e00b768
Default to nil to run the or conditional
daemonsy 1fde815
Another case where we fetch context without going into the conditional
daemonsy 03d8b2e
Use tests to produce the right code
daemonsy 3f679be
Don't assign
daemonsy 2bc16f2
Fix style offenses
daemonsy 28c0d99
Update specs again, got the way examples work wrong
daemonsy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ def self.execute_query_lazy(data, &block) | |
# because we don't have the error `location` here. | ||
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity | ||
def self.execute_field(data, &block) | ||
context = data.fetch(:context) || data.fetch(:query).context | ||
context = data.fetch(:context, nil) || data.fetch(:query).context | ||
return block.call unless context && context[:tracing_enabled] | ||
|
||
start_time_nanos = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond) | ||
|
@@ -116,16 +116,18 @@ def self.execute_field(data, &block) | |
|
||
end_time_nanos = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond) | ||
|
||
# interpreter runtime | ||
# legacy runtime | ||
if data.include?(:context) | ||
path = context.path | ||
field_name = context.field.graphql_name | ||
field_type = context.field.type.to_s | ||
parent_type = context.parent_type.graphql_name | ||
else # legacy runtime | ||
else # interpreter runtime | ||
path = data.fetch(:path) | ||
field_name = data.fetch(:field).graphql_name | ||
field_type = data.fetch(:field).type.unwrap.graphql_name | ||
field = data.fetch(:field) | ||
field_name = field.graphql_name | ||
field_type = field.type.unwrap.graphql_name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call to write a spec @grxy . This has always been broken by the test caught it. The |
||
field_type = field_type + '!' if field.type.non_null? | ||
parent_type = data.fetch(:owner).graphql_name | ||
end | ||
|
||
|
@@ -147,7 +149,7 @@ def self.execute_field(data, &block) | |
# Optional Step 3: | ||
# Overwrite the end times on the trace node if the resolver was lazy. | ||
def self.execute_field_lazy(data, &block) | ||
context = data.fetch(:context) || data.fetch(:query).context | ||
context = data.fetch(:context, nil) || data.fetch(:query).context | ||
return block.call unless context && context[:tracing_enabled] | ||
|
||
begin | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 believe we got the legacy and new interpreter the wrong way round. I get into this branch