File tree Expand file tree Collapse file tree
packages/datadog-plugin-oracledb Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ class OracledbPlugin extends DatabasePlugin {
1111
1212 start ( { query, connAttrs } ) {
1313 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 )
1516
1617 this . startSpan ( this . operationName ( ) , {
1718 service,
Original file line number Diff line number Diff line change @@ -342,6 +342,36 @@ describe('Plugin', () => {
342342 connection . execute ( dbQuery )
343343 } )
344344 } )
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+ } )
345375 } )
346376 } )
347377 } )
You can’t perform that action at this time.
0 commit comments