Class: GraphQL::Tracing::DataDogTracing
Instance Method Summary
collapse
#initialize, #instrument, #trace, #trace_field, use
Instance Method Details
44
45
46
|
# File 'lib/graphql/tracing/data_dog_tracing.rb', line 44
def platform_field_key(type, field)
"#{type.graphql_name}.#{field.graphql_name}"
end
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/graphql/tracing/data_dog_tracing.rb', line 17
def platform_trace(platform_key, key, data)
tracer.trace(platform_key, service: service_name) do |span|
span.span_type = 'custom'
if key == 'execute_multiplex'
operations = data[:multiplex].queries.map(&:selected_operation_name).join(', ')
span.resource = operations unless operations.empty?
end
if key == 'execute_query'
span.set_tag(:selected_operation_name, data[:query].selected_operation_name)
span.set_tag(:selected_operation_type, data[:query].selected_operation.operation_type)
span.set_tag(:query_string, data[:query].query_string)
end
yield
end
end
|
#service_name ⇒ Object
36
37
38
|
# File 'lib/graphql/tracing/data_dog_tracing.rb', line 36
def service_name
options.fetch(:service, 'ruby-graphql')
end
|
#tracer ⇒ Object
40
41
42
|
# File 'lib/graphql/tracing/data_dog_tracing.rb', line 40
def tracer
options.fetch(:tracer, Datadog.tracer)
end
|