Sha256: c3ed206e03c1f02abc0e0ae1d04dd8520963912eda11bc9990f7eb8a85438fbf

Contents?: true

Size: 837 Bytes

Versions: 14

Compression:

Stored size: 837 Bytes

Contents

# frozen_string_literal: true

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

require 'opentelemetry'

module OpenTelemetry
  module Instrumentation
    module LMDB
      module Patches
        # Module to prepend to LMDB::Environment for instrumentation
        module Environment
          def transaction(*args)
            attributes = { 'db.system' => 'lmdb' }
            attributes['peer.service'] = config[:peer_service] if config[:peer_service]

            tracer.in_span('TRANSACTION', attributes: attributes) do
              super
            end
          end

          private

          def config
            LMDB::Instrumentation.instance.config
          end

          def tracer
            LMDB::Instrumentation.instance.tracer
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-lmdb-0.22.3 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.22.2 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.22.1 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.22.0 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.21.1 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.21.0 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.20.0 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.19.2 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.19.1 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.19.0 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.18.1 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.18.0 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.17.0 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb
opentelemetry-instrumentation-lmdb-0.16.0 lib/opentelemetry/instrumentation/lmdb/patches/environment.rb