Class: GraphQL::Tracing::OpenTelemetryTracing
Instance Method Summary
collapse
#initialize, #trace, use
Instance Method Details
39
40
41
|
# File 'lib/graphql/tracing/opentelemetry_tracing.rb', line 39
def platform_authorized_key(type)
"#{type.graphql_name}.authorized"
end
|
35
36
37
|
# File 'lib/graphql/tracing/opentelemetry_tracing.rb', line 35
def platform_field_key(type, field)
"#{type.graphql_name}.#{field.graphql_name}"
end
|
43
44
45
|
# File 'lib/graphql/tracing/opentelemetry_tracing.rb', line 43
def platform_resolve_type_key(type)
"#{type.graphql_name}.resolve_type"
end
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/graphql/tracing/opentelemetry_tracing.rb', line 17
def platform_trace(platform_key, key, data)
return yield if platform_key.nil?
tracer.in_span(platform_key, attributes: attributes_for(key, data)) do |span, _context|
yield.tap do |response|
errors = response[:errors]&.compact&.map { |e| e.to_h }&.to_json if key == 'validate'
unless errors.nil?
span.add_event(
'graphql.validation.error',
attributes: {
'message' => errors
}
)
end
end
end
end
|