class GraphQL::Tracing::AppOpticsTracing
This class uses the AppopticsAPM SDK from the appoptics_apm gem to create traces for GraphQL.
There are 4 configurations available. They can be set in the appoptics_apm config file or in code. Please see: docs.appoptics.com/kb/apm_tracing/ruby/configure
AppOpticsAPM::Config[:graphql][:enabled] = true|false AppOpticsAPM::Config[:graphql][:transaction_name] = true|false AppOpticsAPM::Config[:graphql][:sanitize_query] = true|false AppOpticsAPM::Config[:graphql][:remove_comments] = true|false
Constants
Public Class Methods
Source
# File lib/graphql/tracing/appoptics_tracing.rb, line 26 def initialize(...) warn "GraphQL::Tracing::AppOptics tracing is deprecated; update to SolarWindsAPM instead, which uses OpenTelemetry." super end
Calls superclass method
Source
# File lib/graphql/tracing/appoptics_tracing.rb, line 35 def self.version Gem::Version.new('1.0.0') end
During auto-instrumentation this version of AppOpticsTracing is compared with the version provided in the appoptics_apm gem, so that the newer version of the class can be used
Public Instance Methods
# File lib/graphql/tracing/appoptics_tracing.rb, line 65 def platform_field_key(type, field) "graphql.#{type.graphql_name}.#{field.graphql_name}" end
# File lib/graphql/tracing/appoptics_tracing.rb, line 73 def platform_resolve_type_key(type) "graphql.resolve_type.#{type.graphql_name}" end
# File lib/graphql/tracing/appoptics_tracing.rb, line 50 def platform_trace(platform_key, _key, data) return yield if !defined?(AppOpticsAPM) || gql_config[:enabled] == false layer = span_name(platform_key) kvs = metadata(data, layer) kvs[:Key] = platform_key if (PREP_KEYS + EXEC_KEYS).include?(platform_key) transaction_name(kvs[:InboundQuery]) if kvs[:InboundQuery] && layer == 'graphql.execute' ::AppOpticsAPM::SDK.trace(layer, kvs) do kvs.clear # we don't have to send them twice yield end end