lib/opentelemetry/instrumentation/lmdb/patches/database.rb in opentelemetry-instrumentation-lmdb-0.18.1 vs lib/opentelemetry/instrumentation/lmdb/patches/database.rb in opentelemetry-instrumentation-lmdb-0.19.0
- old
+ new
@@ -13,49 +13,41 @@
# Module to prepend to LMDB::Database for instrumentation
module Database
STATEMENT_MAX_LENGTH = 500
def get(key)
- attributes = {
- 'db.system' => 'lmdb',
- 'db.statement' => formatted_statement('GET', "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
def delete(key, value = nil)
- attributes = {
- 'db.system' => 'lmdb',
- 'db.statement' => formatted_statement('DELETE', "DELETE #{key} #{value}".strip)
- }
+ 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
def put(key, value)
- attributes = {
- 'db.system' => 'lmdb',
- 'db.statement' => formatted_statement('PUT', "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
def clear
- attributes = {
- 'db.system' => 'lmdb',
- 'db.statement' => '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