Add a Rails::Engine-based dashboard with trace viewer#5244
Merged
Conversation
| autoload :LoadApplicationObjectFailedError, "graphql/load_application_object_failed_error" | ||
| autoload :Testing, "graphql/testing" | ||
| autoload :Current, "graphql/current" | ||
| if defined?(::Rails::Engine) |
There was a problem hiding this comment.
module GraphQL missing tests for lines 15, 16, 17, 18, 63, 67, 68, 72, 128, 128, 128 (coverage: 0.88)
| # @return [Boolean] When `true`, save a detailed trace for this query. | ||
| # @see Tracing::DetailedTrace DetailedTrace saves traces when this method returns true | ||
| def detailed_trace?(query) | ||
| raise "#{self} must implement `def.detailed_trace?(query)` to use DetailedTrace. Implement this method in your schema definition." |
There was a problem hiding this comment.
instance method detailed_trace? missing tests for line 1376 (coverage: 0.0)
| target = options[:query] || options[:multiplex] | ||
| mode ||= target && target.context[:trace_mode] | ||
| should_sample = if detailed_trace | ||
| if (query = options[:query]) |
There was a problem hiding this comment.
instance method new_trace missing tests for lines 1469, 1470, 1471, 1475, 1469, 1470, 1471, 1471, 1474 (coverage: 0.75)
| # @param redis [Redis] If provided, profiles will be stored in Redis for later review | ||
| # @param limit [Integer] A maximum number of profiles to store | ||
| def self.use(schema, trace_mode: :profile_sample, memory: false, redis: nil, limit: nil) | ||
| storage = if redis |
There was a problem hiding this comment.
class method use missing tests for lines 34, 35, 34, 35 (coverage: 0.75)
| target = options[:query] || options[:multiplex] | ||
| mode ||= target && target.context[:trace_mode] | ||
| should_sample = if detailed_trace | ||
| if (query = options[:query]) |
There was a problem hiding this comment.
instance method new_trace missing tests for lines 1469, 1470, 1471, 1469, 1470, 1471, 1471 (coverage: 0.85)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I've been working on a detailed query tracer which produces artifacts for Perfetto (https://perfetto.dev). In this PR I'm going to:
GraphQL::Dashboard, which is a Rails enginePerfettoTraceso that traces can be saved for later (Redis and ActiveRecord)Why a Rails Engine? I've seen it done nicely, eg https://github.com/bensheldon/good_job, https://github.com/mbajur/inner_performance. I have rolled my own in
GraphQL::Pro::Dashboardfor a long time but I'm not sure it's worth it. I think everyone uses Rails, and an Engine will bring a lot of convenience in development, robustness in production, lots of configuration options. If you're not using Rails, I think you could spin up a sidecar app just for running the dashboard if you need to.I plan to replace
GraphQL::Pro::Dashboardwith this one (rolling its features into this one).TODO: