Skip to content

Commit 9bb6d07

Browse files
authored
fix(instrumentation-oracledb): Modify checking the db.namespace attribute value for roundtrip span. (#3185)
1 parent 23c5f4e commit 9bb6d07

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

packages/instrumentation-oracledb/test/oracle.test.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,17 @@ function updateAttrSpanList(connection: oracledb.Connection) {
198198
if (serverVersion >= VER_23_4) {
199199
if (oracledb.thin) {
200200
// for round trips.
201-
connAttrList.push({ ...attributes });
202-
poolConnAttrList.push({ ...attributes, ...POOL_ATTRIBUTES });
203-
poolConnAttrList.push({ ...connAttributes, ...POOL_ATTRIBUTES });
204-
connAttrList.push({ ...connAttributes });
201+
connAttrList.push({ ...attributes }); // FastAuth standalone
202+
poolConnAttrList.push({ ...attributes, ...POOL_ATTRIBUTES }); // FastAuth pool
203+
if (oracledb.version < 61000) {
204+
connAttrList.push({ ...connAttributes }); // OAUTH
205+
poolConnAttrList.push({ ...connAttributes, ...POOL_ATTRIBUTES }); // OAUTH
206+
} else {
207+
// From oracledb version 6.10 onwards, the db instance name is not populated
208+
// until all validations for connection establishment is done.
209+
connAttrList.push({ ...attributes }); // OAUTH
210+
poolConnAttrList.push({ ...attributes, ...POOL_ATTRIBUTES }); // OAUTH
211+
}
205212
failedConnAttrList = [...connAttrList];
206213
failedConnAttrList[2] = { ...CONN_FAILED_ATTRIBUTES };
207214
failedConnAttrList[1] = { ...attributes };
@@ -217,11 +224,16 @@ function updateAttrSpanList(connection: oracledb.Connection) {
217224
connAttrList.push({ ...attributes });
218225
connAttrList.push({ ...attributes });
219226
connAttrList.push({ ...attributes });
220-
connAttrList.push({ ...connAttributes });
221227
poolConnAttrList.push({ ...attributes, ...POOL_ATTRIBUTES });
222228
poolConnAttrList.push({ ...attributes, ...POOL_ATTRIBUTES });
223229
poolConnAttrList.push({ ...attributes, ...POOL_ATTRIBUTES });
224-
poolConnAttrList.push({ ...connAttributes, ...POOL_ATTRIBUTES });
230+
if (oracledb.version < 61000) {
231+
connAttrList.push({ ...attributes });
232+
poolConnAttrList.push({ ...attributes, ...POOL_ATTRIBUTES });
233+
} else {
234+
connAttrList.push({ ...connAttributes });
235+
poolConnAttrList.push({ ...connAttributes, ...POOL_ATTRIBUTES });
236+
}
225237
failedConnAttrList = [...connAttrList];
226238
failedConnAttrList[4] = { ...CONN_FAILED_ATTRIBUTES };
227239
failedConnAttrList[3] = { ...attributes };
@@ -236,7 +248,7 @@ function updateAttrSpanList(connection: oracledb.Connection) {
236248
failedConnAttrList = [{ ...CONN_FAILED_ATTRIBUTES }];
237249
}
238250
}
239-
// for getConnection
251+
// for getConnection public API span
240252
connAttrList.push({ ...connAttributes });
241253
poolConnAttrList.push({ ...poolAttributes });
242254
spanNamesList.push(SpanNames.CONNECT);

0 commit comments

Comments
 (0)