Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 50 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ if (!tediousPath.includes(expectedLocalPath)) {
);
}

const localNodeModules = tediousPath.substring(0, tediousPath.lastIndexOf('node_modules') + 'node_modules'.length);
const tediousVersion = require(path.join(localNodeModules, 'tedious', 'package.json')).version;
const otelTediousVersion = require(path.join(localNodeModules, '@opentelemetry', 'instrumentation-tedious', 'package.json')).version;

console.log('[tedious-app] tedious version:', tediousVersion);
console.log('[tedious-app] tedious resolved path:', tediousPath);
console.log('[tedious-app] @opentelemetry/instrumentation-tedious version:', otelTediousVersion);

const Connection = tedious.Connection;
const Request = tedious.Request;
const bodyParser = require('body-parser');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ if (!tediousPath.includes(expectedLocalPath)) {
);
}

const localNodeModules = tediousPath.substring(0, tediousPath.lastIndexOf('node_modules') + 'node_modules'.length);
const tediousVersion = require(resolve(localNodeModules, 'tedious', 'package.json')).version;
const otelTediousVersion = require(resolve(localNodeModules, '@opentelemetry', 'instrumentation-tedious', 'package.json')).version;

console.log('[tedious-app] tedious version:', tediousVersion);
console.log('[tedious-app] tedious resolved path:', tediousPath);
console.log('[tedious-app] @opentelemetry/instrumentation-tedious version:', otelTediousVersion);

const Connection = tedious.Connection;
const Request = tedious.Request;
const app = express();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ module.exports = function (name, version, isLatest) {
expect(span.data.tags.name).to.eql(`${queryType} azure-nodejs-test`);

expect(span.data.operation).to.equal('tedious');
expect(span.data.tags['db.system']).to.eql('mssql');
expect(span.data.tags['db.name']).to.eql('azure-nodejs-test');
expect(span.data.tags['db.user']).to.eql('admin@instana@nodejs-team-db-server');
expect(span.data.tags['db.statement']).to.eql(expectedStatement);
expect(span.data.tags['net.peer.name']).to.eql('nodejs-team-db-server.database.windows.net');
expect(span.data.tags['db.system.name']).to.eql('microsoft.sql_server');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed assertions to adapt new semconv

The stable OpenTelemetry semantic conventions (v1.33.0+) are supported starting with @opentelemetry/instrumentation-tedious v0.39.0. See the Semantic Conventions section

expect(span.data.tags['db.namespace']).to.eql('azure-nodejs-test');
expect(span.data.tags['db.query.text']).to.eql(expectedStatement);
expect(span.data.tags['server.address']).to.eql('nodejs-team-db-server.database.windows.net');
checkTelemetryResourceAttrs(span);
}
});
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
"@opentelemetry/instrumentation-oracledb": "0.46.0",
"@opentelemetry/instrumentation-restify": "0.63.0",
"@opentelemetry/instrumentation-socket.io": "0.67.0",
"@opentelemetry/instrumentation-tedious": "0.28.0",
"@opentelemetry/instrumentation-tedious": "0.40.0",
"@opentelemetry/sdk-trace-base": "2.9.0",
"cls-bluebird": "^2.1.0",
"import-in-the-middle": "2.0.5",
"import-in-the-middle": "3.3.3",
"lru-cache": "^10.1.0",
"methods": "^1.1.2",
"opentracing": "^0.14.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* (c) Copyright IBM Corp. 2024
*/

/* eslint-disable no-console */

'use strict';

const constants = require('../constants');
Expand All @@ -25,6 +27,18 @@ module.exports.init = () => {

const instrumentation = new TediousInstrumentation();

const moduleDefinitions = instrumentation.getModuleDefinitions();
const instrumentedPath = moduleDefinitions && moduleDefinitions[0] ? moduleDefinitions[0].name : 'unknown';
console.log('[Instana] tedious instrumented path:', instrumentedPath);

let resolvedPath;
try {
resolvedPath = require.resolve('tedious');
} catch (e) {
resolvedPath = `not resolvable: ${e.message}`;
}
console.log('[Instana] tedious required resolved path:', resolvedPath);

if (!instrumentation.getConfig().enabled) {
instrumentation.enable();
}
Expand Down