Sha256: d005be435944d30ebf78605e1cb7813b8d660d1403136f90f98694160917adf1

Contents?: true

Size: 808 Bytes

Versions: 6

Compression:

Stored size: 808 Bytes

Contents

# frozen_string_literal: true

module Datadog
  module Tracing
    module Contrib
      module GraphQL
        # Provides instrumentation for `graphql` through the GraphQL's tracing
        module TracingPatcher
          module_function

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
datadog-2.3.0 lib/datadog/tracing/contrib/graphql/tracing_patcher.rb
datadog-2.2.0 lib/datadog/tracing/contrib/graphql/tracing_patcher.rb
datadog-2.1.0 lib/datadog/tracing/contrib/graphql/tracing_patcher.rb
datadog-2.0.0 lib/datadog/tracing/contrib/graphql/tracing_patcher.rb
datadog-2.0.0.beta2 lib/datadog/tracing/contrib/graphql/tracing_patcher.rb
datadog-2.0.0.beta1 lib/datadog/tracing/contrib/graphql/tracing_patcher.rb