Class: GraphQL::Tracing::SkylightTracing
Instance Method Summary
collapse
#instrument, #trace, #trace_field, use
Constructor Details
Returns a new instance of SkylightTracing.
20
21
22
23
24
|
# File 'lib/graphql/tracing/skylight_tracing.rb', line 20
def initialize(options = {})
warn("GraphQL::Tracing::SkylightTracing is deprecated, please enable Skylight's GraphQL probe instead: https://www.skylight.io/support/getting-more-from-skylight#graphql.")
@set_endpoint_name = options.fetch(:set_endpoint_name, false)
super
end
|
Instance Method Details
61
62
63
|
# File 'lib/graphql/tracing/skylight_tracing.rb', line 61
def platform_authorized_key(type)
"graphql.authorized.#{type.graphql_name}"
end
|
57
58
59
|
# File 'lib/graphql/tracing/skylight_tracing.rb', line 57
def platform_field_key(type, field)
"graphql.#{type.graphql_name}.#{field.graphql_name}"
end
|
65
66
67
|
# File 'lib/graphql/tracing/skylight_tracing.rb', line 65
def platform_resolve_type_key(type)
"graphql.resolve_type.#{type.graphql_name}"
end
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/graphql/tracing/skylight_tracing.rb', line 26
def platform_trace(platform_key, key, data)
if key == "execute_query"
query = data[:query]
title = query.selected_operation_name || "<anonymous>"
category = platform_key
set_endpoint_name_override = query.context[:set_skylight_endpoint_name]
if set_endpoint_name_override == true || (set_endpoint_name_override.nil? && @set_endpoint_name)
instrumenter = Skylight.instrumenter
if instrumenter
current_trace = instrumenter.current_trace
if current_trace
op_type = query.selected_operation ? query.selected_operation.operation_type : "query"
endpoint = "GraphQL/#{op_type}.#{title}"
current_trace.endpoint = endpoint
end
end
end
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
|