Class: GraphQL::Tracing::AppOpticsTracing
- Inherits:
 - 
      PlatformTracing
      
        
- Object
 - PlatformTracing
 - GraphQL::Tracing::AppOpticsTracing
 
 
- Defined in:
 - lib/graphql/tracing/appoptics_tracing.rb
 
Overview
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: https://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
  Constant Summary collapse
- PREP_KEYS =
          
These GraphQL events will show up as ‘graphql.prep’ spans
 ['lex', 'parse', 'validate', 'analyze_query', 'analyze_multiplex'].freeze
- EXEC_KEYS =
          
These GraphQL events will show up as ‘graphql.execute’ spans
 ['execute_multiplex', 'execute_query', 'execute_query_lazy'].freeze
Class Method Summary collapse
- 
  
    
      .version  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
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.
 
Instance Method Summary collapse
- 
  
    
      #initialize  ⇒ AppOpticsTracing 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of AppOpticsTracing.
 - 
  
    
      #platform_authorized_key(type)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      #platform_field_key(type, field)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      #platform_resolve_type_key(type)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      #platform_trace(platform_key, _key, data)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
 
Methods inherited from PlatformTracing
Constructor Details
#initialize ⇒ AppOpticsTracing
Returns a new instance of AppOpticsTracing.
      25 26 27 28  | 
    
      # File 'lib/graphql/tracing/appoptics_tracing.rb', line 25 def initialize(...) warn "GraphQL::Tracing::AppOptics tracing is deprecated; update to SolarWindsAPM instead, which uses OpenTelemetry." super end  | 
  
Class Method Details
.version ⇒ Object
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
      34 35 36  | 
    
      # File 'lib/graphql/tracing/appoptics_tracing.rb', line 34 def self.version Gem::Version.new('1.0.0') end  | 
  
Instance Method Details
#platform_authorized_key(type) ⇒ Object
      68 69 70  | 
    
      # File 'lib/graphql/tracing/appoptics_tracing.rb', line 68 def (type) "graphql.authorized.#{type.graphql_name}" end  | 
  
#platform_field_key(type, field) ⇒ Object
      64 65 66  | 
    
      # File 'lib/graphql/tracing/appoptics_tracing.rb', line 64 def platform_field_key(type, field) "graphql.#{type.graphql_name}.#{field.graphql_name}" end  | 
  
#platform_resolve_type_key(type) ⇒ Object
      72 73 74  | 
    
      # File 'lib/graphql/tracing/appoptics_tracing.rb', line 72 def platform_resolve_type_key(type) "graphql.resolve_type.#{type.graphql_name}" end  | 
  
#platform_trace(platform_key, _key, data) ⇒ Object
      49 50 51 52 53 54 55 56 57 58 59 60 61 62  | 
    
      # File 'lib/graphql/tracing/appoptics_tracing.rb', line 49 def platform_trace(platform_key, _key, data) return yield if !defined?(AppOpticsAPM) || gql_config[:enabled] == false layer = span_name(platform_key) kvs = (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  |