Module: GraphQL::Tracing::StatsdTrace

Includes:
PlatformTrace
Defined in:
lib/graphql/tracing/statsd_trace.rb

Instance Method Summary collapse

Methods included from PlatformTrace

#platform_authorized_lazy, #platform_execute_field_lazy, #platform_resolve_type_lazy

Instance Method Details

#initialize(statsd:, **rest) ⇒ Object

Parameters:

  • statsd (Object)

    A statsd client



9
10
11
12
# File 'lib/graphql/tracing/statsd_trace.rb', line 9

def initialize(statsd:, **rest)
  @statsd = statsd
  super(**rest)
end

#platform_authorized(key, &block) ⇒ Object Also known as: platform_resolve_type



37
38
39
# File 'lib/graphql/tracing/statsd_trace.rb', line 37

def platform_authorized(key, &block)
  @statsd.time(key, &block)
end

#platform_authorized_key(type) ⇒ Object



47
48
49
# File 'lib/graphql/tracing/statsd_trace.rb', line 47

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

#platform_execute_field(platform_key, &block) ⇒ Object



33
34
35
# File 'lib/graphql/tracing/statsd_trace.rb', line 33

def platform_execute_field(platform_key, &block)
  @statsd.time(platform_key, &block)
end

#platform_field_key(field) ⇒ Object



43
44
45
# File 'lib/graphql/tracing/statsd_trace.rb', line 43

def platform_field_key(field)
  "graphql.#{field.path}"
end

#platform_resolve_type_key(type) ⇒ Object



51
52
53
# File 'lib/graphql/tracing/statsd_trace.rb', line 51

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