Sha256: fc7ab70dea9e4dcf49141a4b23d2271ce8858f71a930801551825c1efa039da2

Contents?: true

Size: 1.12 KB

Versions: 146

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

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

      # @param statsd [Object] A statsd client
      def initialize(statsd:, **rest)
        @statsd = statsd
        super(**rest)
      end

      def platform_trace(platform_key, key, data)
        @statsd.time(platform_key) do
          yield
        end
      end

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

      def platform_authorized_key(type)
        "graphql.authorized.#{type.graphql_name}"
      end

      def platform_resolve_type_key(type)
        "graphql.resolve_type.#{type.graphql_name}"
      end
    end
  end
end

Version data entries

146 entries across 146 versions & 2 rubygems

Version Path
graphql-1.11.6 lib/graphql/tracing/statsd_tracing.rb
graphql-1.11.5 lib/graphql/tracing/statsd_tracing.rb
graphql-1.11.4 lib/graphql/tracing/statsd_tracing.rb
graphql-1.11.3 lib/graphql/tracing/statsd_tracing.rb
graphql-1.11.2 lib/graphql/tracing/statsd_tracing.rb
graphql-1.11.1 lib/graphql/tracing/statsd_tracing.rb