File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
packages/datadog-plugin-oracledb Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ class OracledbPlugin extends DatabasePlugin {
11
11
12
12
start ( { query, connAttrs } ) {
13
13
const service = this . serviceName ( { pluginConfig : this . config , params : connAttrs } )
14
- const url = getUrl ( connAttrs . connectString )
14
+ // Users can pass either connectString or connectionString
15
+ const url = getUrl ( connAttrs . connectString || connAttrs . connectionString )
15
16
16
17
this . startSpan ( this . operationName ( ) , {
17
18
service,
Original file line number Diff line number Diff line change @@ -342,6 +342,36 @@ describe('Plugin', () => {
342
342
connection . execute ( dbQuery )
343
343
} )
344
344
} )
345
+
346
+ describe ( 'with connectionString fallback' , ( ) => {
347
+ before ( async ( ) => {
348
+ await agent . load ( 'oracledb' , {
349
+ service : connAttrs => connAttrs . connectString || connAttrs . connectionString
350
+ } )
351
+ oracledb = require ( `../../../versions/oracledb@${ version } ` ) . get ( )
352
+ tracer = require ( '../../dd-trace' )
353
+ } )
354
+
355
+ after ( async ( ) => {
356
+ await agent . close ( { ritmReset : false } )
357
+ } )
358
+
359
+ it ( 'should fallback to connectionString when connectString is not available' , async ( ) => {
360
+ const connection = await oracledb . getConnection ( {
361
+ user : config . user ,
362
+ password : config . password ,
363
+ connectionString : config . connectString // Use valid connection string
364
+ } )
365
+
366
+ const promise = agent . assertSomeTraces ( traces => {
367
+ expect ( traces [ 0 ] [ 0 ] ) . to . have . property ( 'service' , config . connectString )
368
+ } )
369
+
370
+ connection . execute ( dbQuery )
371
+ await connection . close ( )
372
+ return promise
373
+ } )
374
+ } )
345
375
} )
346
376
} )
347
377
} )
You can’t perform that action at this time.
0 commit comments