lib/opentelemetry/instrumentation/pg/patches/connection.rb in opentelemetry-instrumentation-pg-0.22.3 vs lib/opentelemetry/instrumentation/pg/patches/connection.rb in opentelemetry-instrumentation-pg-0.23.0
- old
+ new
@@ -84,11 +84,11 @@
end
attrs = { 'db.operation' => validated_operation(operation), 'db.postgresql.prepared_statement_name' => statement_name }
attrs['db.statement'] = sql unless config[:db_statement] == :omit
attrs.merge!(OpenTelemetry::Instrumentation::PG.attributes)
- attrs.reject! { |_, v| v.nil? }
+ attrs.compact!
[span_name(operation), client_attributes.merge(attrs)]
end
def extract_operation(sql)
@@ -129,10 +129,12 @@
'db.user' => user,
'db.name' => db
}
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
- attributes.merge(transport_attrs).reject { |_, v| v.nil? }
+ attributes.merge!(transport_attrs)
+ attributes.compact!
+ attributes
end
def transport_addr
# The hostaddr method is available when the gem is built against
# a recent version of libpq.