Sha256: 8310f4fea276a9e551d781e5574bae985b155b5caa02c13538b629cb4d4cec56

Contents?: true

Size: 1007 Bytes

Versions: 5

Compression:

Stored size: 1007 Bytes

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module Instrumentation
    module Trilogy
      # The Instrumentation class contains logic to detect and install the Trilogy instrumentation
      class Instrumentation < OpenTelemetry::Instrumentation::Base
        install do |_config|
          require_dependencies
          patch_client
        end

        present do
          defined?(::Trilogy)
        end

        compatible do
          Gem::Requirement.create('>= 2.0', '< 3.0').satisfied_by?(Gem::Version.new(::Trilogy::VERSION))
        end

        option :peer_service, default: nil, validate: :string
        option :db_statement, default: :obfuscate, validate: %I[omit include obfuscate]

        private

        def require_dependencies
          require_relative 'patches/client'
        end

        def patch_client
          ::Trilogy.prepend(Patches::Client)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-trilogy-0.51.1 lib/opentelemetry/instrumentation/trilogy/instrumentation.rb
opentelemetry-instrumentation-trilogy-0.51.0 lib/opentelemetry/instrumentation/trilogy/instrumentation.rb
opentelemetry-instrumentation-trilogy-0.50.2 lib/opentelemetry/instrumentation/trilogy/instrumentation.rb
opentelemetry-instrumentation-trilogy-0.50.1 lib/opentelemetry/instrumentation/trilogy/instrumentation.rb
opentelemetry-instrumentation-trilogy-0.50.0 lib/opentelemetry/instrumentation/trilogy/instrumentation.rb