Class: GraphQL::Tracing::SkylightTracing

Inherits:
PlatformTracing show all
Defined in:
lib/graphql/tracing/skylight_tracing.rb

Instance Method Summary collapse

Methods inherited from PlatformTracing

#initialize, #instrument, #trace, #trace_field, use

Constructor Details

This class inherits a constructor from GraphQL::Tracing::PlatformTracing

Instance Method Details

#platform_field_key(type, field) ⇒ Object



34
35
36
# File 'lib/graphql/tracing/skylight_tracing.rb', line 34

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

#platform_trace(platform_key, key, data) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/graphql/tracing/skylight_tracing.rb', line 17

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