From b00a2f32684cca4c9d8236fac4b8134dc21be1fe Mon Sep 17 00:00:00 2001 From: Mark Wolff Date: Wed, 6 Nov 2019 16:58:11 -0800 Subject: [PATCH] fix(grpc): use correct supportedVersions (#487) * fix(grpc): use correct supportedVersions * chore: use more clear semver * chore: use more clear semver * fix: incorrect file changed --- .../opentelemetry-plugin-grpc/package.json | 6 +++--- packages/opentelemetry-plugin-grpc/src/grpc.ts | 18 +++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/packages/opentelemetry-plugin-grpc/package.json b/packages/opentelemetry-plugin-grpc/package.json index 146b4b15659..5ce0ec36683 100644 --- a/packages/opentelemetry-plugin-grpc/package.json +++ b/packages/opentelemetry-plugin-grpc/package.json @@ -40,12 +40,14 @@ "access": "public" }, "devDependencies": { + "@opentelemetry/node": "^0.2.0", + "@opentelemetry/tracing": "^0.2.0", "@types/mocha": "^5.2.7", "@types/node": "^12.6.9", "@types/shimmer": "^1.0.1", "@types/sinon": "^7.0.13", "codecov": "^3.5.0", - "grpc": "~1.23.3", + "grpc": "^1.23.3", "gts": "^1.1.0", "mocha": "^6.2.0", "node-pre-gyp": "^0.12.0", @@ -60,8 +62,6 @@ }, "dependencies": { "@opentelemetry/core": "^0.2.0", - "@opentelemetry/node": "^0.2.0", - "@opentelemetry/tracing": "^0.2.0", "@opentelemetry/types": "^0.2.0", "shimmer": "^1.2.1" } diff --git a/packages/opentelemetry-plugin-grpc/src/grpc.ts b/packages/opentelemetry-plugin-grpc/src/grpc.ts index aa93a534c08..531bd80bbf6 100644 --- a/packages/opentelemetry-plugin-grpc/src/grpc.ts +++ b/packages/opentelemetry-plugin-grpc/src/grpc.ts @@ -51,7 +51,7 @@ let grpcClientModule: GrpcInternalClientTypes; export class GrpcPlugin extends BasePlugin { static readonly component = 'grpc'; - readonly supportedVersions = ['^1.23.3']; + readonly supportedVersions = ['1.*']; protected _config!: GrpcPluginOptions; @@ -83,13 +83,11 @@ export class GrpcPlugin extends BasePlugin { } // Wrap the externally exported client constructor - if (this._moduleExports.makeGenericClientConstructor) { - shimmer.wrap( - this._moduleExports, - 'makeGenericClientConstructor', - this._patchClient() - ); - } + shimmer.wrap( + this._moduleExports, + 'makeGenericClientConstructor', + this._patchClient() + ); if (this._internalFilesExports['client']) { grpcClientModule = this._internalFilesExports[ @@ -117,9 +115,7 @@ export class GrpcPlugin extends BasePlugin { shimmer.unwrap(this._moduleExports.Server.prototype, 'register'); } - if (this._moduleExports.makeGenericClientConstructor) { - shimmer.unwrap(this._moduleExports, 'makeGenericClientConstructor'); - } + shimmer.unwrap(this._moduleExports, 'makeGenericClientConstructor'); if (grpcClientModule) { shimmer.unwrap(grpcClientModule, 'makeClientConstructor');