Sha256: 15d47677f0ed79777188fff8dd76022cd1e23a9c7a2163026a38bf0249c0591f

Contents?: true

Size: 977 Bytes

Versions: 7

Compression:

Stored size: 977 Bytes

Contents

# frozen_string_literal: true

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

require 'opentelemetry'

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

        present do
          defined?(::LMDB)
        end

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

        private

        def patch
          ::LMDB::Environment.prepend(Patches::Environment)
          ::LMDB::Database.prepend(Patches::Database)
        end

        def require_dependencies
          require_relative 'patches/database'
          require_relative 'patches/environment'
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-lmdb-0.22.3 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb
opentelemetry-instrumentation-lmdb-0.22.2 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb
opentelemetry-instrumentation-lmdb-0.22.1 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb
opentelemetry-instrumentation-lmdb-0.22.0 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb
opentelemetry-instrumentation-lmdb-0.21.1 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb
opentelemetry-instrumentation-lmdb-0.21.0 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb
opentelemetry-instrumentation-lmdb-0.20.0 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb