Module: Datadog::Tracing::Contrib::GraphQL::Patcher

Includes:
Patcher
Defined in:
lib/datadog/tracing/contrib/graphql/patcher.rb

Overview

Provides instrumentation for ‘graphql` through the GraphQL tracing framework

Class Method Summary collapse

Methods included from Patcher

included

Class Method Details

.configurationObject



47
48
49
# File 'lib/datadog/tracing/contrib/graphql/patcher.rb', line 47

def configuration
  Datadog.configuration.tracing[:graphql]
end

.patchObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/datadog/tracing/contrib/graphql/patcher.rb', line 23

def patch
  # DEV-3.0: We should remove as many patching options as possible, given the alternatives do not
  # DEV-3.0: provide any benefit to the recommended `with_unified_tracer` patching method.
  # DEV-3.0: `with_deprecated_tracer` is likely safe to remove.
  # DEV-3.0: `with_unified_tracer: false` should be removed if possible.
  # DEV-3.0: `with_unified_tracer: true` should be the default and hopefully not even necessary as an option.
  if configuration[:with_deprecated_tracer]
    TracingPatcher.patch!(schemas)
  elsif Integration.trace_supported?
    if configuration[:with_unified_tracer]
      UnifiedTracePatcher.patch!(schemas)
    else
      TracePatcher.patch!(schemas)
    end
  else
    Datadog.logger.warn(
      "GraphQL version (#{target_version}) does not support GraphQL::Tracing::DataDogTrace"\
      'or Datadog::Tracing::Contrib::GraphQL::UnifiedTrace.'\
      'Falling back to GraphQL::Tracing::DataDogTracing.'
    )
    TracingPatcher.patch!(schemas)
  end
end

.schemasObject



51
52
53
# File 'lib/datadog/tracing/contrib/graphql/patcher.rb', line 51

def schemas
  configuration[:schemas]
end

.target_versionObject



19
20
21
# File 'lib/datadog/tracing/contrib/graphql/patcher.rb', line 19

def target_version
  Integration.version
end