Skip to content

Commit 27e4dd3

Browse files
authored
feat: added support for oracledb (#1828)
refs https://jsw.ibm.com/browse/INSTA-43857
1 parent d7fee3f commit 27e4dd3

File tree

13 files changed

+355
-8
lines changed

13 files changed

+355
-8
lines changed

.tekton/assets/sidecars.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
"timeoutSeconds": 10
2121
}
2222
},
23+
{
24+
"name": "oracledb",
25+
"image": "gvenzl/oracle-free:23-slim",
26+
"env": [
27+
{ "name": "ORACLE_PASSWORD", "value": "teamnodejstest" },
28+
{ "name": "APP_USER", "value": "teamnodejs" },
29+
{ "name": "APP_USER_PASSWORD", "value": "teamnodejspassword" }
30+
]
31+
},
2332
{
2433
"name": "mongodb",
2534
"image": "public.ecr.aws/docker/library/mongo:8.0.8"

.tekton/generate-test-files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const groups = {
7878
subname: 'test:ci:tracing:protocols'
7979
},
8080
'test:ci:collector:tracing:general': {
81-
sidecars: ['postgres'],
81+
sidecars: ['postgres', 'oracledb'],
8282
condition: ' && true'
8383
},
8484
'test:ci:collector:tracing:misc': {

.tekton/tasks/test-groups/collector-tracing-general-task.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ spec:
2323
initialDelaySeconds: 3
2424
periodSeconds: 2
2525
timeoutSeconds: 10
26+
- name: oracledb
27+
image: gvenzl/oracle-free:23-slim
28+
imagePullPolicy: IfNotPresent
29+
env:
30+
- name: "ORACLE_PASSWORD"
31+
value: "teamnodejstest"
32+
- name: "APP_USER"
33+
value: "teamnodejs"
34+
- name: "APP_USER_PASSWORD"
35+
value: "teamnodejspassword"
2636
envFrom:
2737
- configMapRef:
2838
name: environment-properties

currencies.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,5 +867,16 @@
867867
"ignoreUpdates": false,
868868
"note": "",
869869
"core": false
870+
},
871+
{
872+
"name": "oracledb",
873+
"policy": "45-days",
874+
"lastSupportedVersion": "",
875+
"latestVersion": "",
876+
"cloudNative": false,
877+
"isBeta": false,
878+
"ignoreUpdates": false,
879+
"note": "",
880+
"core": false
870881
}
871882
]

docker-compose-base.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
version: '2'
22
services:
3+
oracledb:
4+
image: gvenzl/oracle-free:23-slim
5+
container_name: oracle-free
6+
ports:
7+
- "1521:1521"
8+
- "8080:8080"
9+
environment:
10+
ORACLE_PASSWORD: teamnodejstest
11+
APP_USER: teamnodejs
12+
APP_USER_PASSWORD: teamnodejspassword
13+
314
redis:
415
image: redis:7.4.3
516
ports:
617
- 6379:6379
718

8-
# sentinel test setup
19+
# sentinel test setup
920
redis-slave:
1021
image: redis:7.4.3
1122
network_mode: host
@@ -205,7 +216,7 @@ services:
205216
- "4510-4559:4510-4559" # external services port range
206217
environment:
207218
- DEBUG=${DEBUG-}
208-
- DOCKER_HOST=unix:///var/run/docker.sock
219+
- DOCKER_HOST=unix:///var/run/docker.sock
209220
volumes:
210221
- "/var/run/docker.sock:/var/run/docker.sock"
211222

@@ -214,4 +225,4 @@ networks:
214225
driver: bridge
215226
ipam:
216227
config:
217-
- subnet: 172.30.0.0/16
228+
- subnet: 172.30.0.0/16

package-lock.json

Lines changed: 81 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
"node-fetch-v2": "npm:[email protected]",
212212
"node-gyp": "11.2.0",
213213
"node-nats-streaming": "0.3.2",
214+
"oracledb": "6.9.0",
214215
"pg": "8.16.3",
215216
"pino": "9.9.1",
216217
"pino-http": "9.0.0",

packages/collector/test/initEnv.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const DEFAULT_ENV_VALUES = {
1616
KAFKA: '127.0.0.1:9092',
1717
REDIS: '127.0.0.1:6379',
1818
REDIS_ALTERNATIVE: 'localhost:6379',
19+
ORACLEDB: 'localhost:1521',
1920
REDIS_SENTINEL_MASTER_NAME: 'mymaster',
2021
REDIS_SENTINEL_HOST: 'localhost',
2122
REDIS_SENTINEL_PORT: 26379,
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* (c) Copyright IBM Corp. 2025
3+
*/
4+
5+
/* eslint-disable no-console */
6+
7+
'use strict';
8+
9+
// NOTE: c8 bug https://github.com/bcoe/c8/issues/166
10+
process.on('SIGTERM', () => {
11+
process.disconnect();
12+
process.exit(0);
13+
});
14+
15+
const opentelemetryDisabled = process.env.INSTANA_DISABLE_USE_OPENTELEMETRY === 'true';
16+
17+
require('@instana/collector')({
18+
tracing: {
19+
useOpentelemetry: !opentelemetryDisabled
20+
}
21+
});
22+
23+
const oracledb = require('oracledb');
24+
const port = require('../../test_util/app-port')();
25+
const delay = require('@instana/core/test/test_util/delay');
26+
const logPrefix = `Oracle App (${process.pid}):\t`;
27+
const express = require('express');
28+
const app = express();
29+
30+
let connected = false;
31+
let connection;
32+
33+
(async function connect() {
34+
try {
35+
connection = await oracledb.getConnection({
36+
user: 'teamnodejs',
37+
password: 'teamnodejspassword',
38+
connectString: `${process.env.ORACLEDB}/FREEPDB1`
39+
});
40+
41+
connected = true;
42+
log('Connected to OracleDB');
43+
} catch (err) {
44+
log('Failed to connect to OracleDB:', err);
45+
log('Retrying in a few seconds...');
46+
await delay(1000 * 5);
47+
await connect();
48+
}
49+
})();
50+
51+
app.get('/', (req, res) => {
52+
if (!connected) {
53+
return res.sendStatus(500);
54+
}
55+
56+
res.sendStatus(200);
57+
});
58+
59+
app.get('/trace', async (req, res) => {
60+
await connection.execute('SELECT 1 FROM DUAL');
61+
log('Executed query');
62+
res.sendStatus(200);
63+
});
64+
65+
app.listen(port, () => {
66+
log(`Listening on port: ${port}`);
67+
});
68+
69+
function log() {
70+
/* eslint-disable no-console */
71+
const args = Array.prototype.slice.call(arguments);
72+
args[0] = logPrefix + args[0];
73+
console.log.apply(console, args);
74+
}

0 commit comments

Comments
 (0)