Sha256: 70989dd45bd931615925cb528a134c34aacabe2521cd4960798013d226de629c
Contents?: true
Size: 1.18 KB
Versions: 7
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true # Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Instrumentation module Mongo # Instrumentation class that detects and installs the Mongo instrumentation class Instrumentation < OpenTelemetry::Instrumentation::Base MINIMUM_VERSION = Gem::Version.new('2.5.0') install do |_config| require_dependencies register_subscriber end present do !defined?(::Mongo::Monitoring::Global).nil? end compatible do gem_version >= MINIMUM_VERSION end option :peer_service, default: nil, validate: :string option :db_statement, default: :obfuscate, validate: %I[omit obfuscate include] private def gem_version Gem::Version.new(::Mongo::VERSION) end def require_dependencies require_relative 'subscriber' end def register_subscriber # Subscribe to all COMMAND queries with our subscriber class ::Mongo::Monitoring::Global.subscribe(::Mongo::Monitoring::COMMAND, Subscriber.new) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems