Sha256: fd8cb771f4533c456433edbaf03a2a23a04137c3e96a5752904f3fd3c1c83971

Contents?: true

Size: 1.07 KB

Versions: 28

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module GraphQL
  module Tracing
    class SkylightTracing < PlatformTracing
      self.platform_keys = {
        "lex" => "graphql.language",
        "parse" => "graphql.language",
        "validate" => "graphql.prepare",
        "analyze_query" => "graphql.prepare",
        "analyze_multiplex" => "graphql.prepare",
        "execute_multiplex" => "graphql.execute",
        "execute_query" => "graphql.execute",
        "execute_query_lazy" => "graphql.execute",
      }

      def platform_trace(platform_key, key, data)
        if (query = data[:query])
          title = query.selected_operation_name || "<anonymous>"
          category = platform_key
        elsif key.start_with?("execute_field")
          title = platform_key
          category = key
        else
          title = key
          category = platform_key
        end

        Skylight.instrument(category: category, title: title) do
          yield
        end
      end

      def platform_field_key(type, field)
        "graphql.#{type.name}.#{field.name}"
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
graphql-1.8.5 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.4 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.3 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.2 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.1 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.0 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.0.pre11 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.0.pre10 lib/graphql/tracing/skylight_tracing.rb
graphql-1.7.14 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.0.pre9 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.0.pre8 lib/graphql/tracing/skylight_tracing.rb
graphql-1.7.13 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.0.pre7 lib/graphql/tracing/skylight_tracing.rb
graphql-1.7.12 lib/graphql/tracing/skylight_tracing.rb
graphql-1.7.11 lib/graphql/tracing/skylight_tracing.rb
graphql-1.7.10 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.0.pre6 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.0.pre5 lib/graphql/tracing/skylight_tracing.rb
graphql-1.7.9 lib/graphql/tracing/skylight_tracing.rb
graphql-1.8.0.pre4 lib/graphql/tracing/skylight_tracing.rb