From 905b40d7f1f9aa08859691d59f5f3c75834c4273 Mon Sep 17 00:00:00 2001 From: Kelvin Jin Date: Mon, 12 Nov 2018 16:20:50 -0800 Subject: [PATCH] feat: support restify@7 --- README.md | 2 +- src/plugins/plugin-restify.ts | 2 +- test/fixtures/plugin-fixtures.json | 5 +++++ test/test-trace-web-frameworks.ts | 4 ++-- test/web-frameworks/restify.ts | 1 + 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f5fb66e78..64d002c2c 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ The trace agent can do automatic tracing of the following web frameworks: * [gRPC](https://www.npmjs.com/package/grpc) server (version ^1.1) * [hapi](https://www.npmjs.com/package/hapi) (versions 8 - 16) * [koa](https://www.npmjs.com/package/koa) (version 1) -* [restify](https://www.npmjs.com/package/restify) (versions 3 - 6) +* [restify](https://www.npmjs.com/package/restify) (versions 3 - 7) The agent will also automatically trace RPCs from the following modules: * Outbound HTTP requests through `http`, `https`, and `http2` core modules diff --git a/src/plugins/plugin-restify.ts b/src/plugins/plugin-restify.ts index 722bd261e..bdcc7aed3 100644 --- a/src/plugins/plugin-restify.ts +++ b/src/plugins/plugin-restify.ts @@ -28,7 +28,7 @@ type Response = restify_5.Response; type Next = restify_5.Next; type CreateServerFn = (options?: restify_5.ServerOptions) => restify_5.Server; -const SUPPORTED_VERSIONS = '<=6.x'; +const SUPPORTED_VERSIONS = '<=7.x'; function unpatchRestify(restify: Restify5) { shimmer.unwrap(restify, 'createServer'); diff --git a/test/fixtures/plugin-fixtures.json b/test/fixtures/plugin-fixtures.json index c379179a8..3047495c3 100644 --- a/test/fixtures/plugin-fixtures.json +++ b/test/fixtures/plugin-fixtures.json @@ -203,5 +203,10 @@ "dependencies": { "restify": "^6.0.1" } + }, + "restify7": { + "dependencies": { + "restify": "^7.2.2" + } } } diff --git a/test/test-trace-web-frameworks.ts b/test/test-trace-web-frameworks.ts index 49d501129..3c512949f 100644 --- a/test/test-trace-web-frameworks.ts +++ b/test/test-trace-web-frameworks.ts @@ -33,7 +33,7 @@ import {Hapi17} from './web-frameworks/hapi17'; import {Hapi12, Hapi15, Hapi16, Hapi8} from './web-frameworks/hapi8_16'; import {Koa1} from './web-frameworks/koa1'; import {Koa2} from './web-frameworks/koa2'; -import {Restify3, Restify4, Restify5, Restify6} from './web-frameworks/restify'; +import {Restify3, Restify4, Restify5, Restify6, Restify7} from './web-frameworks/restify'; // The type of a stack trace object after being parsed from a trace span's stack // frame label. @@ -46,7 +46,7 @@ const ABORTED_SPAN_RETRIES = 3; // The list of web frameworks to test. const FRAMEWORKS: WebFrameworkConstructor[] = [ Connect3, Express4, Hapi8, Hapi12, Hapi15, Hapi16, Hapi17, Koa1, Koa2, - Restify3, Restify4, Restify5, Restify6 + Restify3, Restify4, Restify5, Restify6, Restify7 ]; /** diff --git a/test/web-frameworks/restify.ts b/test/web-frameworks/restify.ts index f918545a5..45abbe619 100644 --- a/test/web-frameworks/restify.ts +++ b/test/web-frameworks/restify.ts @@ -85,4 +85,5 @@ export const Restify3 = makeRestifyClass(3, '<7'); export const Restify4 = makeRestifyClass(4); export const Restify5 = makeRestifyClass(5); export const Restify6 = makeRestifyClass(6); +export const Restify7 = makeRestifyClass(7); // tslint:enable:variable-name