Sha256: f18223cfa447bb98b8c9e29b676e32168e140aa01af9c019d3a1ff4c46c34479

Contents?: true

Size: 777 Bytes

Versions: 4

Compression:

Stored size: 777 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)
            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
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
datadog-2.7.0 lib/datadog/tracing/contrib/graphql/tracing_patcher.rb
datadog-2.6.0 lib/datadog/tracing/contrib/graphql/tracing_patcher.rb
datadog-2.5.0 lib/datadog/tracing/contrib/graphql/tracing_patcher.rb
datadog-2.4.0 lib/datadog/tracing/contrib/graphql/tracing_patcher.rb