Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tedious): support new tedious versions 15, 16 #1638

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/node/instrumentation-tedious/.tav.yml
@@ -1,6 +1,6 @@
tedious:
# 4.0.0 is broken: https://github.com/tediousjs/tedious/commit/4eceb48
versions: "1.11.0 || 1.14.0 || 2.7.1 || 3.0.1 || 4.2.0 || ^6.7.0 || 8.3.0 || 9.2.3 || 11.0.9 || 11.2.0 || 11.4.0 || ^11.8.0 || ^12.3.0 || ^13.2.0 || ^14.0.0"
versions: "1.11.0 || 1.14.0 || 2.7.1 || 3.0.1 || 4.2.0 || ^6.7.0 || 8.3.0 || 9.2.3 || 11.0.9 || 11.2.0 || 11.4.0 || ^11.8.0 || ^12.3.0 || ^13.2.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
commands: npm run test

# Fix missing `test-utils` package
Expand Down
2 changes: 1 addition & 1 deletion plugins/node/instrumentation-tedious/README.md
Expand Up @@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-tedious

## Supported Versions

- `>=1.11.0`
- `>=1.11.0 <=17`

## Usage

Expand Down
6 changes: 4 additions & 2 deletions plugins/node/instrumentation-tedious/package.json
Expand Up @@ -53,18 +53,20 @@
"@opentelemetry/sdk-trace-base": "^1.8.0",
"@types/mocha": "7.0.2",
"@types/node": "18.16.19",
"@types/semver": "7.5.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "5.0.1",
"tedious": "14.1.0",
"semver": "7.5.4",
"tedious": "15.1.3",
"test-all-versions": "5.0.1",
"ts-mocha": "10.0.0",
"typescript": "4.4.4"
},
"dependencies": {
"@opentelemetry/instrumentation": "^0.41.2",
"@opentelemetry/semantic-conventions": "^1.0.0",
"@types/tedious": "^4.0.6"
"@types/tedious": "^4.0.9"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-tedious#readme"
}
Expand Up @@ -74,7 +74,7 @@ export class TediousInstrumentation extends InstrumentationBase<
return [
new InstrumentationNodeModuleDefinition<typeof tedious>(
TediousInstrumentation.COMPONENT,
['*'],
['>=1.11.0 <=17'],
(moduleExports: any, moduleVersion) => {
this._diag.debug(`Patching tedious@${moduleVersion}`);

Expand Down
Expand Up @@ -32,7 +32,9 @@ import * as assert from 'assert';
import { TediousInstrumentation } from '../src';
import makeApi from './api';
import type { Connection, ConnectionConfig } from 'tedious';
import * as semver from 'semver';

const LIB_VERSION = testUtils.getPackageVersion('tedious');
const port = Number(process.env.MSSQL_PORT) || 1433;
const database = process.env.MSSQL_DATABASE || 'master';
const host = process.env.MSSQL_HOST || '127.0.0.1';
Expand Down Expand Up @@ -66,6 +68,12 @@ const config: ConnectionConfig & { userName: string; password: string } = {
};

describe('tedious', () => {

const isNode14 = process.versions.node.startsWith('14');
if (semver.gte(LIB_VERSION, '16') && isNode14) {
return;
}

let tedious: any;
let contextManager: AsyncHooksContextManager;
let connection: Connection;
Expand Down