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
- 
  
    
      #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
#initialize, #instrument, #trace, #trace_field, use
Constructor Details
This class inherits a constructor from GraphQL::Tracing::PlatformTracing
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
| 27 28 29 | # File 'lib/graphql/tracing/appoptics_tracing.rb', line 27 def self.version Gem::Version.new('1.0.0') end | 
Instance Method Details
#platform_authorized_key(type) ⇒ Object
| 61 62 63 | # File 'lib/graphql/tracing/appoptics_tracing.rb', line 61 def (type) "graphql.authorized.#{type.graphql_name}" end | 
#platform_field_key(type, field) ⇒ Object
| 57 58 59 | # File 'lib/graphql/tracing/appoptics_tracing.rb', line 57 def platform_field_key(type, field) "graphql.#{type.graphql_name}.#{field.graphql_name}" end | 
#platform_resolve_type_key(type) ⇒ Object
| 65 66 67 | # File 'lib/graphql/tracing/appoptics_tracing.rb', line 65 def platform_resolve_type_key(type) "graphql.resolve_type.#{type.graphql_name}" end | 
#platform_trace(platform_key, _key, data) ⇒ Object
| 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | # File 'lib/graphql/tracing/appoptics_tracing.rb', line 42 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 |