Module: OpenTelemetry::Instrumentation::LMDB::Patches::Database
- Defined in:
- lib/opentelemetry/instrumentation/lmdb/patches/database.rb
Overview
Module to prepend to LMDB::Database for instrumentation
Constant Summary collapse
- STATEMENT_MAX_LENGTH =
500
Instance Method Summary collapse
Instance Method Details
#clear ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/opentelemetry/instrumentation/lmdb/patches/database.rb', line 47 def clear attributes = { 'db.system' => 'lmdb' } attributes['db.statement'] = 'CLEAR' if config[:db_statement] == :include attributes['peer.service'] = config[:peer_service] if config[:peer_service] tracer.in_span('CLEAR', attributes: attributes, kind: :client) do super end end |
#delete(key, value = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/opentelemetry/instrumentation/lmdb/patches/database.rb', line 27 def delete(key, value = nil) attributes = { 'db.system' => 'lmdb' } attributes['db.statement'] = formatted_statement('DELETE', "DELETE #{key} #{value}".strip) if config[:db_statement] == :include attributes['peer.service'] = config[:peer_service] if config[:peer_service] tracer.in_span("DELETE #{key}", attributes: attributes, kind: :client) do super end end |
#get(key) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/opentelemetry/instrumentation/lmdb/patches/database.rb', line 17 def get(key) attributes = { 'db.system' => 'lmdb' } attributes['db.statement'] = formatted_statement('GET', "GET #{key}") if config[:db_statement] == :include attributes['peer.service'] = config[:peer_service] if config[:peer_service] tracer.in_span("GET #{key}", attributes: attributes, kind: :client) do super end end |
#put(key, value) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/opentelemetry/instrumentation/lmdb/patches/database.rb', line 37 def put(key, value) attributes = { 'db.system' => 'lmdb' } attributes['db.statement'] = formatted_statement('PUT', "PUT #{key} #{value}") if config[:db_statement] == :include attributes['peer.service'] = config[:peer_service] if config[:peer_service] tracer.in_span("PUT #{key}", attributes: attributes, kind: :client) do super end end |