Class: OpenTelemetry::Instrumentation::GraphQL::Tracers::GraphQLTracer

Inherits:
GraphQL::Tracing::PlatformTracing
  • Object
show all
Defined in:
lib/opentelemetry/instrumentation/graphql/tracers/graphql_tracer.rb

Overview

GraphQLTracer contains the OpenTelemetry tracer implementation compatible with the GraphQL tracer API

Instance Method Summary collapse

Instance Method Details

#platform_authorized_key(type) ⇒ Object



41
42
43
44
45
# File 'lib/opentelemetry/instrumentation/graphql/tracers/graphql_tracer.rb', line 41

def platform_authorized_key(type)
  return unless config[:enable_platform_authorized]

  "#{type.graphql_name}.authorized"
end

#platform_field_key(type, field) ⇒ Object



35
36
37
38
39
# File 'lib/opentelemetry/instrumentation/graphql/tracers/graphql_tracer.rb', line 35

def platform_field_key(type, field)
  return unless config[:enable_platform_field]

  "#{type.graphql_name}.#{field.graphql_name}"
end

#platform_resolve_type_key(type) ⇒ Object



47
48
49
50
51
# File 'lib/opentelemetry/instrumentation/graphql/tracers/graphql_tracer.rb', line 47

def platform_resolve_type_key(type)
  return unless config[:enable_platform_resolve_type]

  "#{type.graphql_name}.resolve_type"
end

#platform_trace(platform_key, key, data) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/opentelemetry/instrumentation/graphql/tracers/graphql_tracer.rb', line 27

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|
    yield
  end
end