Sha256: f709f7ef82d2424b39ad569872bd2212d11f85f7715e777d003797547e3d56af
Contents?: true
Size: 1.24 KB
Versions: 5
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true # Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Instrumentation module Racecar # The Instrumentation class contains logic to detect and install the Racecar instrumentation class Instrumentation < OpenTelemetry::Instrumentation::Base MINIMUM_VERSION = Gem::Version.new('2.7') compatible do !defined?(::ActiveSupport::Notifications).nil? && gem_version >= MINIMUM_VERSION end install do |_config| require_patches patch add_subscribers end present do defined?(::Racecar) end private def require_patches require_relative 'patches/consumer' end def add_subscribers require_relative 'process_message_subscriber' subscriber = ProcessMessageSubscriber.new ::ActiveSupport::Notifications.subscribe('process_message.racecar', subscriber) end def patch ::Racecar::Consumer.prepend(Patches::Consumer) end def gem_version require 'racecar/version' Gem::Version.new(::Racecar::VERSION) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems