Skip to content

Commit 93e6b17

Browse files
committed
wip
1 parent cb076b1 commit 93e6b17

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

instrumentation/pg/test/opentelemetry/instrumentation/pg/instrumentation_test.rb

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,6 @@
136136
_(connect_span.attributes['peer.service']).must_equal 'readonly:postgres'
137137
end
138138

139-
it 'sets unix socket attributes when connecting via socket' do
140-
skip 'socket test requires no host/port' if host || port
141-
142-
conn = PG::Connection.open(
143-
user: user,
144-
dbname: dbname,
145-
password: password
146-
)
147-
conn.close
148-
149-
connect_span = exporter.finished_spans.first
150-
_(connect_span.name).must_equal 'connect'
151-
_(connect_span.attributes['db.system']).must_equal 'postgresql'
152-
_(connect_span.attributes['net.sock.family']).must_equal 'unix'
153-
_(connect_span.attributes['net.peer.name']).must_match %r{^/}
154-
end
155-
156139
it 'records connection errors' do
157140
expect do
158141
PG::Connection.open(
@@ -448,6 +431,17 @@
448431
_(last_span.attributes['net.peer.port']).must_be_nil
449432
_(last_span.attributes['net.sock.family']).must_equal 'unix'
450433
end
434+
435+
it 'sets attributes for the connect span' do
436+
client.query('SELECT 1')
437+
438+
raise exporter.finished_spans.map(&:name).inspect
439+
connect_span = exporter.finished_spans.first
440+
_(connect_span.name).must_equal 'connect'
441+
_(connect_span.attributes['db.system']).must_equal 'postgresql'
442+
_(connect_span.attributes['net.sock.family']).must_equal 'unix'
443+
_(connect_span.attributes['net.peer.name']).must_match %r{^/}
444+
end
451445
end
452446

453447
describe 'when connection has multiple hosts' do

0 commit comments

Comments
 (0)