Sha256: c2451d920f6d8fa91aa1a1266f921aba490dd7348c659f4f4cc3a039386e9d05

Contents?: true

Size: 901 Bytes

Versions: 4

Compression:

Stored size: 901 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

        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

4 entries across 4 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-lmdb-0.18.1 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb
opentelemetry-instrumentation-lmdb-0.18.0 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb
opentelemetry-instrumentation-lmdb-0.17.0 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb
opentelemetry-instrumentation-lmdb-0.16.0 lib/opentelemetry/instrumentation/lmdb/instrumentation.rb