Module: Datadog::Tracing::Contrib::GraphQL::TracingPatcher

Defined in:
lib/datadog/tracing/contrib/graphql/tracing_patcher.rb

Overview

Provides instrumentation for ‘graphql` through the GraphQL’s tracing

Class Method Summary collapse

Class Method Details

.patch!(schemas) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/datadog/tracing/contrib/graphql/tracing_patcher.rb', line 11

def patch!(schemas)
  if schemas.empty?
    ::GraphQL::Schema.tracer(::GraphQL::Tracing::DataDogTracing.new)
  else
    schemas.each do |schema|
      if schema.respond_to? :use
        schema.use(::GraphQL::Tracing::DataDogTracing)
      else
        Datadog.logger.warn("Unable to patch #{schema}: Please migrate to class-based schema.")
      end
    end
  end
end