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

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

Overview

Patches the graphql gem to support ddtrace 1.0. This is not necessary in versions containing github.com/rmosolgo/graphql-ruby/pull/4038.

Instance Method Summary collapse

Instance Method Details

#fallback_transaction_name(context) ⇒ Object

Ensure resource name is not left as ‘nil`. This is fixed in graphql > 2.0.6.



80
81
82
# File 'lib/datadog/tracing/contrib/graphql/patcher.rb', line 80

def fallback_transaction_name(context)
  context[:tracing_fallback_transaction_name] || 'execute.graphql'
end

#tracerObject

Ensure invocation to #trace method targets the new namespaced public API object, instead of the old global Datadog.trace. This is fixed in graphql > 2.0.3.



74
75
76
# File 'lib/datadog/tracing/contrib/graphql/patcher.rb', line 74

def tracer
  options.fetch(:tracer, Datadog::Tracing) # GraphQL will invoke #trace on the returned object
end