File tree Expand file tree Collapse file tree 1 file changed +11
-17
lines changed
instrumentation/pg/test/opentelemetry/instrumentation/pg Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Original file line number Diff line number Diff line change 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 (
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
You can’t perform that action at this time.
0 commit comments