Sha256: 9de397b5af9119701d833aa96ddec00b472e2739acedb1c0682c23ed1882250a
Contents?: true
Size: 1.11 KB
Versions: 8
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true require "active_support/inflector" module Skylight module Probes module GraphQL module Instrumentation def initialize(*, **) super return unless defined?(@tracers) unless @tracers.include?(::GraphQL::Tracing::ActiveSupportNotificationsTracing) @tracers << ::GraphQL::Tracing::ActiveSupportNotificationsTracing end end end class Probe def install tracing_klass_name = "::GraphQL::Tracing::ActiveSupportNotificationsTracing" klasses_to_probe = %w[ ::GraphQL::Execution::Multiplex ::GraphQL::Query ] return unless ([tracing_klass_name] + klasses_to_probe).all?(&method(:safe_constantize)) klasses_to_probe.each do |klass_name| safe_constantize(klass_name).prepend(Instrumentation) end end def safe_constantize(klass_name) ActiveSupport::Inflector.safe_constantize(klass_name) end end end register(:graphql, "GraphQL", "graphql", GraphQL::Probe.new) end end
Version data entries
8 entries across 8 versions & 1 rubygems