Sha256: 3c9e8d92878d9fa25f8fb2fbb8ccceef7ddc4ca6d033f3a39dc509c9b1b2ccc6

Contents?: true

Size: 1003 Bytes

Versions: 3

Compression:

Stored size: 1003 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: ->(opt) { %I[omit include].include?(opt) }

        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

3 entries across 3 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-lmdb-0.19.2 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb
opentelemetry-instrumentation-lmdb-0.19.1 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb
opentelemetry-instrumentation-lmdb-0.19.0 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb