@@ -158,16 +158,18 @@ describe('postgresjs auto instrumentation', () => {
158
158
expect . objectContaining ( {
159
159
data : expect . objectContaining ( {
160
160
'db.namespace' : 'test_db' ,
161
- 'db.query.text' : 'SELECT * FROM "User" WHERE "email" = \'bar @baz.com\'' ,
161
+ 'db.query.text' : 'SELECT * FROM "User" WHERE "email" = \'foo @baz.com\'' ,
162
162
'db.system.name' : 'postgres' ,
163
163
'sentry.op' : 'db' ,
164
164
'sentry.origin' : 'manual' ,
165
165
'server.address' : 'localhost' ,
166
166
'server.port' : 5444 ,
167
167
} ) ,
168
- description : 'SELECT db:test_db' ,
168
+ // This span is an error span and the `command` is not available when a does not resolve
169
+ // That's why we can't update the span description when the query fails
170
+ description : 'postgresjs.query' ,
169
171
op : 'db' ,
170
- status : 'ok ' ,
172
+ status : 'unknown_error ' ,
171
173
origin : 'manual' ,
172
174
parent_span_id : expect . any ( String ) ,
173
175
span_id : expect . any ( String ) ,
@@ -184,14 +186,33 @@ describe('postgresjs auto instrumentation', () => {
184
186
trace : {
185
187
trace_id : expect . any ( String ) ,
186
188
span_id : expect . any ( String ) ,
187
- status : 'unknown_error' ,
188
189
} ,
189
190
} ,
191
+ exception : {
192
+ values : [
193
+ {
194
+ type : 'PostgresError' ,
195
+ value : 'relation "User" does not exist' ,
196
+ stacktrace : expect . objectContaining ( {
197
+ frames : expect . arrayContaining ( [
198
+ expect . objectContaining ( {
199
+ function : 'handle' ,
200
+ module : 'postgres.cjs.src:connection' ,
201
+ filename : expect . any ( String ) ,
202
+ lineno : expect . any ( Number ) ,
203
+ colno : expect . any ( Number ) ,
204
+ } ) ,
205
+ ] ) ,
206
+ } ) ,
207
+ } ,
208
+ ] ,
209
+ } ,
190
210
} ;
191
211
192
212
await createRunner ( __dirname , 'scenario.js' )
193
213
. withDockerCompose ( { workingDirectory : [ __dirname ] , readyMatches : [ 'port 5432' ] } )
194
- . expect ( { transaction : EXPECTED_TRANSACTION , event : EXPECTED_ERROR_EVENT } )
214
+ . expect ( { transaction : EXPECTED_TRANSACTION } )
215
+ . expect ( { event : EXPECTED_ERROR_EVENT } )
195
216
. start ( )
196
217
. completed ( ) ;
197
218
} ) ;
0 commit comments