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



11
12
13
14
# File 'lib/graphql/tracing/statsd_trace.rb', line 11

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

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



39
40
41
# File 'lib/graphql/tracing/statsd_trace.rb', line 39

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

#platform_authorized_key(type) ⇒ Object



49
50
51
# File 'lib/graphql/tracing/statsd_trace.rb', line 49

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

#platform_execute_field(platform_key, &block) ⇒ Object



35
36
37
# File 'lib/graphql/tracing/statsd_trace.rb', line 35

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

#platform_field_key(field) ⇒ Object



45
46
47
# File 'lib/graphql/tracing/statsd_trace.rb', line 45

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

#platform_resolve_type_key(type) ⇒ Object



53
54
55
# File 'lib/graphql/tracing/statsd_trace.rb', line 53

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