Module: Datadog::Tracing::Contrib::GraphQL::UnifiedTracePatcher

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

Overview

Provides instrumentation for ‘graphql` through the GraphQL’s tracing with methods defined in UnifiedTrace

Class Method Summary collapse

Class Method Details

.patch!(schemas) ⇒ Object

TODO: ‘GraphQL::Schema.trace_with` and `YOUR_SCHEMA.trace_with` don’t mix. TODO: They create duplicate spans when combined. TODO: We should measure how frequently users use ‘YOUR_SCHEMA.trace_with`, and hopefully we can remove it.



18
19
20
21
22
23
24
25
26
# File 'lib/datadog/tracing/contrib/graphql/unified_trace_patcher.rb', line 18

def patch!(schemas)
  if schemas.empty?
    ::GraphQL::Schema.trace_with(UnifiedTrace)
  else
    schemas.each do |schema|
      schema.trace_with(UnifiedTrace)
    end
  end
end