Sha256: 419cfe5f6b776c49ced2383fb738842b9cc0f1f9517a3c0026bef659ca0b6584

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

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

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

        present do
          defined?(::Mysql2)
        end

        option :peer_service, default: nil, validate: :string
        option :db_statement, default: :obfuscate, validate: %I[omit include obfuscate]
        option :span_name, default: :statement_type, validate: %I[statement_type db_name db_operation_and_name]
        option :obfuscation_limit, default: 2000, validate: :integer

        private

        def require_dependencies
          require_relative 'patches/client'
        end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-mysql2-0.28.0 lib/opentelemetry/instrumentation/mysql2/instrumentation.rb
opentelemetry-instrumentation-mysql2-0.27.2 lib/opentelemetry/instrumentation/mysql2/instrumentation.rb
opentelemetry-instrumentation-mysql2-0.27.1 lib/opentelemetry/instrumentation/mysql2/instrumentation.rb
opentelemetry-instrumentation-mysql2-0.27.0 lib/opentelemetry/instrumentation/mysql2/instrumentation.rb
opentelemetry-instrumentation-mysql2-0.26.1 lib/opentelemetry/instrumentation/mysql2/instrumentation.rb
opentelemetry-instrumentation-mysql2-0.26.0 lib/opentelemetry/instrumentation/mysql2/instrumentation.rb
opentelemetry-instrumentation-mysql2-0.25.0 lib/opentelemetry/instrumentation/mysql2/instrumentation.rb