diff --git a/packages/opencensus-core/src/exporters/console-exporter.ts b/packages/opencensus-core/src/exporters/console-exporter.ts index fc4d7009c..9da641a35 100644 --- a/packages/opencensus-core/src/exporters/console-exporter.ts +++ b/packages/opencensus-core/src/exporters/console-exporter.ts @@ -67,9 +67,7 @@ export class ConsoleExporter implements Exporter { */ publish(spans: modelTypes.Span[]) { spans.map(span => { - const ROOT_STR = `RootSpan: {traceId: ${span.traceId}, spanId: ${ - span.id - }, name: ${span.name} }`; + const ROOT_STR = `RootSpan: {traceId: ${span.traceId}, spanId: ${span.id}, name: ${span.name} }`; const SPANS_STR: string[] = span.spans.map(child => [`\t\t{spanId: ${child.id}, name: ${child.name}}`].join('\n') ); diff --git a/packages/opencensus-core/test/test-recorder.ts b/packages/opencensus-core/test/test-recorder.ts index a078c5d74..c0db78388 100644 --- a/packages/opencensus-core/test/test-recorder.ts +++ b/packages/opencensus-core/test/test-recorder.ts @@ -98,9 +98,7 @@ describe('Recorder', () => { for (const measure of measures) { describe(`for count aggregation data of ${measure.type} values`, () => { for (const testCase of testCases) { - it(`should record measurements ${ - testCase.description - } correctly`, () => { + it(`should record measurements ${testCase.description} correctly`, () => { const countData: CountData = { type: AggregationType.COUNT, tagValues, @@ -122,13 +120,9 @@ describe('Recorder', () => { } }); - describe(`for last value aggregation data of ${ - measure.type - } values`, () => { + describe(`for last value aggregation data of ${measure.type} values`, () => { for (const testCase of testCases) { - it(`should record measurements ${ - testCase.description - } correctly`, () => { + it(`should record measurements ${testCase.description} correctly`, () => { const lastValueData: LastValueData = { type: AggregationType.LAST_VALUE, tagValues, @@ -152,9 +146,7 @@ describe('Recorder', () => { describe(`for sum aggregation data of ${measure.type} values`, () => { for (const testCase of testCases) { - it(`should record measurements ${ - testCase.description - } correctly`, () => { + it(`should record measurements ${testCase.description} correctly`, () => { const sumData: SumData = { type: AggregationType.SUM, tagValues, @@ -177,13 +169,9 @@ describe('Recorder', () => { } }); - describe(`for distribution aggregation data of ${ - measure.type - } values`, () => { + describe(`for distribution aggregation data of ${measure.type} values`, () => { for (const testCase of testCases) { - it(`should record measurements ${ - testCase.description - } correctly`, () => { + it(`should record measurements ${testCase.description} correctly`, () => { const distributionData: DistributionData = { type: AggregationType.DISTRIBUTION, tagValues, diff --git a/packages/opencensus-core/test/test-view.ts b/packages/opencensus-core/test/test-view.ts index bb982ba3c..c62f5a2b6 100644 --- a/packages/opencensus-core/test/test-view.ts +++ b/packages/opencensus-core/test/test-view.ts @@ -189,9 +189,7 @@ describe('BaseView', () => { tags.set(tagKey2, tagValue2); for (const aggregationTestCase of aggregationTestCases) { - it(`should record measurements on a View with ${ - aggregationTestCase.description - } Aggregation Data type`, () => { + it(`should record measurements on a View with ${aggregationTestCase.description} Aggregation Data type`, () => { const view = new BaseView( 'test/view/name', measure, @@ -308,9 +306,7 @@ describe('BaseView', () => { const { descriptor, timeseries } = view.getMetric(mockStartTime); - describe(`Aggregation type: ${ - aggregationTestCase.aggregationType - }`, () => { + describe(`Aggregation type: ${aggregationTestCase.aggregationType}`, () => { it('should have descriptor', () => { assert.ok(descriptor); assert.deepStrictEqual(descriptor, { diff --git a/packages/opencensus-exporter-jaeger/src/jaeger-driver/index.ts b/packages/opencensus-exporter-jaeger/src/jaeger-driver/index.ts index fbc26a04a..f836be118 100644 --- a/packages/opencensus-exporter-jaeger/src/jaeger-driver/index.ts +++ b/packages/opencensus-exporter-jaeger/src/jaeger-driver/index.ts @@ -125,9 +125,9 @@ export function spanToThrift(span: Span): ThriftSpan { ? Utils.encodeInt64(span.parentSpanId) : ThriftUtils.emptyBuffer; - const traceId = `00000000000000000000000000000000${ - span.spanContext.traceId - }`.slice(-32); + const traceId = `00000000000000000000000000000000${span.spanContext.traceId}`.slice( + -32 + ); const high = traceId.slice(0, 16); const low = traceId.slice(16); @@ -151,20 +151,18 @@ export function spanToThrift(span: Span): ThriftSpan { function getThriftReference(links: Link[]): ThriftReference[] { return links - .map( - (link): ThriftReference | null => { - const refType = getThriftType(link.type); - if (!refType) return null; - - const traceId = `00000000000000000000000000000000${link.traceId}`.slice( - -32 - ); - const traceIdHigh = Utils.encodeInt64(traceId.slice(0, 16)); - const traceIdLow = Utils.encodeInt64(traceId.slice(16)); - const spanId = Utils.encodeInt64(link.spanId); - return { traceIdLow, traceIdHigh, spanId, refType }; - } - ) + .map((link): ThriftReference | null => { + const refType = getThriftType(link.type); + if (!refType) return null; + + const traceId = `00000000000000000000000000000000${link.traceId}`.slice( + -32 + ); + const traceIdHigh = Utils.encodeInt64(traceId.slice(0, 16)); + const traceIdLow = Utils.encodeInt64(traceId.slice(16)); + const spanId = Utils.encodeInt64(link.spanId); + return { traceIdLow, traceIdHigh, spanId, refType }; + }) .filter(ref => !!ref) as ThriftReference[]; } diff --git a/packages/opencensus-exporter-prometheus/src/prometheus-stats.ts b/packages/opencensus-exporter-prometheus/src/prometheus-stats.ts index 5f1d5df1b..b74a8c9b1 100644 --- a/packages/opencensus-exporter-prometheus/src/prometheus-stats.ts +++ b/packages/opencensus-exporter-prometheus/src/prometheus-stats.ts @@ -251,9 +251,7 @@ export class PrometheusStatsExporter implements StatsEventListener { labels.forEach(label => { if (label === PrometheusStatsExporter.RESERVED_HISTOGRAM_LABEL) { throw new Error( - `${ - PrometheusStatsExporter.RESERVED_HISTOGRAM_LABEL - } is a reserved label keyword` + `${PrometheusStatsExporter.RESERVED_HISTOGRAM_LABEL} is a reserved label keyword` ); } }); diff --git a/packages/opencensus-instrumentation-grpc/src/grpc.ts b/packages/opencensus-instrumentation-grpc/src/grpc.ts index ba312c109..c645692f2 100644 --- a/packages/opencensus-instrumentation-grpc/src/grpc.ts +++ b/packages/opencensus-instrumentation-grpc/src/grpc.ts @@ -425,9 +425,12 @@ export class GrpcPlugin extends BasePlugin { name: traceOptions.name, kind: traceOptions.kind, }); - return plugin.makeGrpcClientRemoteCall(original, args, this, plugin)( - span - ); + return plugin.makeGrpcClientRemoteCall( + original, + args, + this, + plugin + )(span); } }; }; diff --git a/packages/opencensus-instrumentation-grpc/test/test-grpc.ts b/packages/opencensus-instrumentation-grpc/test/test-grpc.ts index 3da9ff414..94acb422b 100644 --- a/packages/opencensus-instrumentation-grpc/test/test-grpc.ts +++ b/packages/opencensus-instrumentation-grpc/test/test-grpc.ts @@ -481,12 +481,8 @@ describe('GrpcPlugin() ', function() { } methodList.map(method => { - describe(`Test automatic tracing for grpc remote method ${ - method.description - }`, () => { - it(`should create a rootSpan for client and for server - ${ - method.description - }`, async () => { + describe(`Test automatic tracing for grpc remote method ${method.description}`, () => { + it(`should create a rootSpan for client and for server - ${method.description}`, async () => { assert.strictEqual(rootSpanVerifier.endedRootSpans.length, 0); const spanName = `grpc.pkg_test.GrpcTester/${method.methodName}`; const args = [client, method.request]; @@ -518,9 +514,7 @@ describe('GrpcPlugin() ', function() { }); }); - it(`should create a rootSpan for client and for server with tag context- ${ - method.description - }`, () => { + it(`should create a rootSpan for client and for server with tag context- ${method.description}`, () => { assert.strictEqual(rootSpanVerifier.endedRootSpans.length, 0); const spanName = `grpc.pkg_test.GrpcTester/${method.methodName}`; const args = [client, method.request]; @@ -559,9 +553,7 @@ describe('GrpcPlugin() ', function() { }); }); - it(`should create a childSpan for client and rootSpan for server - ${ - method.description - }`, () => { + it(`should create a childSpan for client and rootSpan for server - ${method.description}`, () => { assert.strictEqual(rootSpanVerifier.endedRootSpans.length, 0); const options = { name: 'TestRootSpan' }; const spanName = `grpc.pkg_test.GrpcTester/${method.methodName}`; @@ -598,9 +590,7 @@ describe('GrpcPlugin() ', function() { }); }); - it(`should create a childSpan for client and rootSpan for server with tag context - ${ - method.description - }`, () => { + it(`should create a childSpan for client and rootSpan for server with tag context - ${method.description}`, () => { assert.strictEqual(rootSpanVerifier.endedRootSpans.length, 0); const options = { name: 'TestRootSpan' }; const spanName = `grpc.pkg_test.GrpcTester/${method.methodName}`; @@ -661,9 +651,7 @@ describe('GrpcPlugin() ', function() { // tslint:disable-next-line:no-any const errorCode = Number(grpcModule.status[key as any]); if (errorCode > grpcModule.status.OK) { - it(`should raise an error for client/server rootSpans - ${ - method.description - } - status = ${key}`, async () => { + it(`should raise an error for client/server rootSpans - ${method.description} - status = ${key}`, async () => { assert.strictEqual(rootSpanVerifier.endedRootSpans.length, 0); const spanName = `grpc.pkg_test.GrpcTester/${method.methodName}`; const errRequest = @@ -685,9 +673,7 @@ describe('GrpcPlugin() ', function() { }); }); - it(`should raise an error for client childSpan/server rootSpan - ${ - method.description - } - status = ${key}`, () => { + it(`should raise an error for client childSpan/server rootSpan - ${method.description} - status = ${key}`, () => { assert.strictEqual(rootSpanVerifier.endedRootSpans.length, 0); const options = { name: 'TestRootSpan' }; const spanName = `grpc.pkg_test.GrpcTester/${method.methodName}`; diff --git a/packages/opencensus-instrumentation-http/src/http.ts b/packages/opencensus-instrumentation-http/src/http.ts index d4db57335..2df7bab37 100644 --- a/packages/opencensus-instrumentation-http/src/http.ts +++ b/packages/opencensus-instrumentation-http/src/http.ts @@ -422,9 +422,11 @@ export class HttpPlugin extends BasePlugin { name: traceOptions.name, kind: traceOptions.kind, }); - return plugin.getMakeRequestTraceFunction(request, options, plugin)( - span - ); + return plugin.getMakeRequestTraceFunction( + request, + options, + plugin + )(span); } }; }; diff --git a/packages/opencensus-instrumentation-http/test/test-http.ts b/packages/opencensus-instrumentation-http/test/test-http.ts index ac8ad3855..4cbb666ea 100644 --- a/packages/opencensus-instrumentation-http/test/test-http.ts +++ b/packages/opencensus-instrumentation-http/test/test-http.ts @@ -309,9 +309,7 @@ describe('HttpPlugin', () => { const httpErrorCodes = [400, 401, 403, 404, 429, 501, 503, 504, 500]; for (let i = 0; i < httpErrorCodes.length; i++) { - it(`should test rootSpan for GET requests with http error ${ - httpErrorCodes[i] - }`, async () => { + it(`should test rootSpan for GET requests with http error ${httpErrorCodes[i]}`, async () => { const testPath = '/outgoing/rootSpan/1'; doNock( urlHost, @@ -358,9 +356,7 @@ describe('HttpPlugin', () => { }); for (let i = 0; i < httpErrorCodes.length; i++) { - it(`should test a child spans for GET requests with http error ${ - httpErrorCodes[i] - }`, () => { + it(`should test a child spans for GET requests with http error ${httpErrorCodes[i]}`, () => { const testPath = '/outgoing/rootSpan/childs/1'; doNock( urlHost, diff --git a/packages/opencensus-instrumentation-https/test/test-https.ts b/packages/opencensus-instrumentation-https/test/test-https.ts index d644f0968..9433fcb0b 100644 --- a/packages/opencensus-instrumentation-https/test/test-https.ts +++ b/packages/opencensus-instrumentation-https/test/test-https.ts @@ -251,9 +251,7 @@ describe('HttpsPlugin', () => { const httpErrorCodes = [400, 401, 403, 404, 429, 501, 503, 504, 500]; for (let i = 0; i < httpErrorCodes.length; i++) { - it(`should test rootSpan for GET requests with http error ${ - httpErrorCodes[i] - }`, async () => { + it(`should test rootSpan for GET requests with http error ${httpErrorCodes[i]}`, async () => { const testPath = '/outgoing/rootSpan/1'; doNock( urlHost, @@ -311,9 +309,7 @@ describe('HttpsPlugin', () => { }); for (let i = 0; i < httpErrorCodes.length; i++) { - it(`should test a child spans for GET requests with http error ${ - httpErrorCodes[i] - }`, () => { + it(`should test a child spans for GET requests with http error ${httpErrorCodes[i]}`, () => { const testPath = '/outgoing/rootSpan/childs/1'; doNock( urlHost, diff --git a/packages/opencensus-instrumentation-mongodb/package-lock.json b/packages/opencensus-instrumentation-mongodb/package-lock.json index d2c4c5130..c15b64605 100644 --- a/packages/opencensus-instrumentation-mongodb/package-lock.json +++ b/packages/opencensus-instrumentation-mongodb/package-lock.json @@ -6,15 +6,14 @@ "packages": { "": { "dependencies": { - "@types/bson": "1.0.11", "@types/mocha": "7.0.2", - "@types/mongodb": "3.6.20", + "@types/mongodb": "3.0.19", "@types/node": "10.17.60", "@types/shimmer": "1.0.2", "codecov": "3.8.3", "gts": "1.1.2", "mocha": "7.2.0", - "mongodb": "3.6.10", + "mongodb": "3.1.10", "nyc": "14.1.1", "rimraf": "3.0.2", "shimmer": "^1.2.0", @@ -233,6 +232,11 @@ "@types/node": "*" } }, + "node_modules/@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==" + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -245,11 +249,12 @@ "integrity": "sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w==" }, "node_modules/@types/mongodb": { - "version": "3.6.20", - "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.20.tgz", - "integrity": "sha512-WcdpPJCakFzcWWD9juKoZbRtQxKIMYF/JIAM4JrNHrMcnJL6/a2NWjXxW7fo9hxboxxkg+icff8d7+WIEvKgYQ==", + "version": "3.0.19", + "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.0.19.tgz", + "integrity": "sha512-KK30PZmGuCqSJQgb3tozzjy5hpQswMsAuqkO+T8vCUh9bSz1sZGx1nAOu79IzVNh2vBy1Xj46vk4A0PUHN5yBg==", "dependencies": { "@types/bson": "*", + "@types/events": "*", "@types/node": "*" } }, @@ -435,15 +440,6 @@ "node": ">=8" } }, - "node_modules/bl": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz", - "integrity": "sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g==", - "dependencies": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, "node_modules/boxen": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/boxen/-/boxen-3.2.0.tgz", @@ -833,11 +829,6 @@ "safe-buffer": "~5.1.1" } }, - "node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, "node_modules/cp-file": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-6.2.0.tgz", @@ -964,14 +955,6 @@ "node": ">= 0.4" } }, - "node_modules/denque": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", - "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==", - "engines": { - "node": ">=0.10" - } - }, "node_modules/diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -1924,11 +1907,6 @@ "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==" }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2447,42 +2425,30 @@ } }, "node_modules/mongodb": { - "version": "3.6.10", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.10.tgz", - "integrity": "sha512-fvIBQBF7KwCJnDZUnFFy4WqEFP8ibdXeFANnylW19+vOwdjOAvqIzPdsNCEMT6VKTHnYu4K64AWRih0mkFms6Q==", - "dependencies": { - "bl": "^2.2.1", - "bson": "^1.1.4", - "denque": "^1.4.1", - "optional-require": "^1.0.3", - "safe-buffer": "^5.1.2", - "saslprep": "^1.0.0" + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.10.tgz", + "integrity": "sha512-Uml42GeFxhTGQVml1XQ4cD0o/rp7J2ROy0fdYUcVitoE7vFqEhKH4TYVqRDpQr/bXtCJVxJdNQC1ntRxNREkPQ==", + "license": "Apache-2.0", + "dependencies": { + "mongodb-core": "3.1.9", + "safe-buffer": "^5.1.2" }, "engines": { "node": ">=4" + } + }, + "node_modules/mongodb-core": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.9.tgz", + "integrity": "sha512-MJpciDABXMchrZphh3vMcqu8hkNf/Mi+Gk6btOimVg1XMxLXh87j6FAvRm+KmwD1A9fpu3qRQYcbQe4egj23og==", + "dependencies": { + "bson": "^1.1.0", + "require_optional": "^1.0.1", + "safe-buffer": "^5.1.2", + "saslprep": "^1.0.0" }, "optionalDependencies": { "saslprep": "^1.0.0" - }, - "peerDependenciesMeta": { - "aws4": { - "optional": true - }, - "bson-ext": { - "optional": true - }, - "kerberos": { - "optional": true - }, - "mongodb-client-encryption": { - "optional": true - }, - "mongodb-extjson": { - "optional": true - }, - "snappy": { - "optional": true - } } }, "node_modules/ms": { @@ -2759,14 +2725,6 @@ "node": ">=6" } }, - "node_modules/optional-require": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz", - "integrity": "sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA==", - "engines": { - "node": ">=4" - } - }, "node_modules/os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", @@ -3029,11 +2987,6 @@ "node": ">=4" } }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -3100,20 +3053,6 @@ "node": ">=4" } }, - "node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, "node_modules/readdirp": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", @@ -3170,6 +3109,15 @@ "node": ">=4" } }, + "node_modules/require_optional": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", + "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", + "dependencies": { + "resolve-from": "^2.0.0", + "semver": "^5.1.0" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -3191,6 +3139,14 @@ "path-parse": "^1.0.6" } }, + "node_modules/resolve-from": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", + "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/responselike": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", @@ -3410,14 +3366,6 @@ "stubs": "^3.0.0" } }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, "node_modules/string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -3923,11 +3871,6 @@ "fast-url-parser": "^1.1.3" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, "node_modules/uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", @@ -4323,6 +4266,11 @@ "@types/node": "*" } }, + "@types/events": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", + "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==" + }, "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -4335,11 +4283,12 @@ "integrity": "sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w==" }, "@types/mongodb": { - "version": "3.6.20", - "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.6.20.tgz", - "integrity": "sha512-WcdpPJCakFzcWWD9juKoZbRtQxKIMYF/JIAM4JrNHrMcnJL6/a2NWjXxW7fo9hxboxxkg+icff8d7+WIEvKgYQ==", + "version": "3.0.19", + "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.0.19.tgz", + "integrity": "sha512-KK30PZmGuCqSJQgb3tozzjy5hpQswMsAuqkO+T8vCUh9bSz1sZGx1nAOu79IzVNh2vBy1Xj46vk4A0PUHN5yBg==", "requires": { "@types/bson": "*", + "@types/events": "*", "@types/node": "*" } }, @@ -4482,15 +4431,6 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==" }, - "bl": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz", - "integrity": "sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g==", - "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, "boxen": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/boxen/-/boxen-3.2.0.tgz", @@ -4805,11 +4745,6 @@ "safe-buffer": "~5.1.1" } }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, "cp-file": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-6.2.0.tgz", @@ -4908,11 +4843,6 @@ "object-keys": "^1.0.12" } }, - "denque": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", - "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==" - }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -5623,11 +5553,6 @@ "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==" }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -6035,14 +5960,21 @@ } }, "mongodb": { - "version": "3.6.10", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.10.tgz", - "integrity": "sha512-fvIBQBF7KwCJnDZUnFFy4WqEFP8ibdXeFANnylW19+vOwdjOAvqIzPdsNCEMT6VKTHnYu4K64AWRih0mkFms6Q==", - "requires": { - "bl": "^2.2.1", - "bson": "^1.1.4", - "denque": "^1.4.1", - "optional-require": "^1.0.3", + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.10.tgz", + "integrity": "sha512-Uml42GeFxhTGQVml1XQ4cD0o/rp7J2ROy0fdYUcVitoE7vFqEhKH4TYVqRDpQr/bXtCJVxJdNQC1ntRxNREkPQ==", + "requires": { + "mongodb-core": "3.1.9", + "safe-buffer": "^5.1.2" + } + }, + "mongodb-core": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.9.tgz", + "integrity": "sha512-MJpciDABXMchrZphh3vMcqu8hkNf/Mi+Gk6btOimVg1XMxLXh87j6FAvRm+KmwD1A9fpu3qRQYcbQe4egj23og==", + "requires": { + "bson": "^1.1.0", + "require_optional": "^1.0.1", "safe-buffer": "^5.1.2", "saslprep": "^1.0.0" } @@ -6262,11 +6194,6 @@ } } }, - "optional-require": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz", - "integrity": "sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA==" - }, "os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", @@ -6454,11 +6381,6 @@ "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==" }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -6513,20 +6435,6 @@ "read-pkg": "^3.0.0" } }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, "readdirp": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", @@ -6568,6 +6476,15 @@ "es6-error": "^4.0.1" } }, + "require_optional": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", + "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", + "requires": { + "resolve-from": "^2.0.0", + "semver": "^5.1.0" + } + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -6586,6 +6503,11 @@ "path-parse": "^1.0.6" } }, + "resolve-from": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", + "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" + }, "responselike": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", @@ -6771,14 +6693,6 @@ "stubs": "^3.0.0" } }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -7148,11 +7062,6 @@ "fast-url-parser": "^1.1.3" } }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", diff --git a/packages/opencensus-instrumentation-mongodb/package.json b/packages/opencensus-instrumentation-mongodb/package.json index 27367be3a..27d94e6e1 100644 --- a/packages/opencensus-instrumentation-mongodb/package.json +++ b/packages/opencensus-instrumentation-mongodb/package.json @@ -49,15 +49,14 @@ "access": "public" }, "devDependencies": { - "@types/bson": "1.0.11", "@types/mocha": "7.0.2", - "@types/mongodb": "3.6.20", + "@types/mongodb": "3.0.19", "@types/node": "10.17.60", "@types/shimmer": "1.0.2", "codecov": "3.8.3", "gts": "1.1.2", "mocha": "7.2.0", - "mongodb": "3.6.10", + "mongodb": "3.1.10", "nyc": "14.1.1", "rimraf": "3.0.2", "ts-mocha": "7.0.0", diff --git a/packages/opencensus-nodejs-base/src/trace/instrumentation/plugin-loader.ts b/packages/opencensus-nodejs-base/src/trace/instrumentation/plugin-loader.ts index 1005d952f..9deabf052 100644 --- a/packages/opencensus-nodejs-base/src/trace/instrumentation/plugin-loader.ts +++ b/packages/opencensus-nodejs-base/src/trace/instrumentation/plugin-loader.ts @@ -70,9 +70,7 @@ export class PluginLoader { * @returns The default name for that package. */ private static defaultPackageName(moduleName: string): string { - return `${Constants.OPENCENSUS_SCOPE}/${ - Constants.DEFAULT_PLUGIN_PACKAGE_NAME_PREFIX - }-${moduleName}`; + return `${Constants.OPENCENSUS_SCOPE}/${Constants.DEFAULT_PLUGIN_PACKAGE_NAME_PREFIX}-${moduleName}`; } /** diff --git a/packages/opencensus-nodejs-base/test/test-plugin-loader.ts b/packages/opencensus-nodejs-base/test/test-plugin-loader.ts index 2681137b4..0ff5be74b 100644 --- a/packages/opencensus-nodejs-base/test/test-plugin-loader.ts +++ b/packages/opencensus-nodejs-base/test/test-plugin-loader.ts @@ -57,15 +57,11 @@ describe('Plugin Loader', () => { assert.ok(plugins[TEST_MODULES[3]]); assert.strictEqual( plugins[TEST_MODULES[0]], - `@opencensus/${ - Constants.DEFAULT_PLUGIN_PACKAGE_NAME_PREFIX - }-simple-module` + `@opencensus/${Constants.DEFAULT_PLUGIN_PACKAGE_NAME_PREFIX}-simple-module` ); assert.strictEqual( plugins[TEST_MODULES[1]], - `@opencensus/${ - Constants.DEFAULT_PLUGIN_PACKAGE_NAME_PREFIX - }-nonexistent-module` + `@opencensus/${Constants.DEFAULT_PLUGIN_PACKAGE_NAME_PREFIX}-nonexistent-module` ); assert.strictEqual( plugins[TEST_MODULES[2]], @@ -73,9 +69,7 @@ describe('Plugin Loader', () => { ); assert.strictEqual( plugins[TEST_MODULES[3]], - `@opencensus/${ - Constants.DEFAULT_PLUGIN_PACKAGE_NAME_PREFIX - }-load-internal-file-module` + `@opencensus/${Constants.DEFAULT_PLUGIN_PACKAGE_NAME_PREFIX}-load-internal-file-module` ); }); }); diff --git a/packages/opencensus-propagation-b3/src/validators.ts b/packages/opencensus-propagation-b3/src/validators.ts index 0982bed83..1ae911c06 100644 --- a/packages/opencensus-propagation-b3/src/validators.ts +++ b/packages/opencensus-propagation-b3/src/validators.ts @@ -59,27 +59,16 @@ const compose = (...fns: ValidationFn[]): ValidationFn => { * Determines if the given traceId is valid based on section 2.2.2.1 of the * Trace Context spec. */ -export const isValidTraceId = compose( - isHex, - isNotAllZeros, - isLength(32) -); +export const isValidTraceId = compose(isHex, isNotAllZeros, isLength(32)); /** * Determines if the given spanId is valid based on section 2.2.2.2 of the Trace * Context spec. */ -export const isValidSpanId = compose( - isHex, - isNotAllZeros, - isLength(16) -); +export const isValidSpanId = compose(isHex, isNotAllZeros, isLength(16)); /** * Determines if the given option is valid based on section 2.2.3 of the Trace * Context spec. */ -export const isValidOption = compose( - isHex, - isLength(2) -); +export const isValidOption = compose(isHex, isLength(2)); diff --git a/packages/opencensus-propagation-jaeger/src/validators.ts b/packages/opencensus-propagation-jaeger/src/validators.ts index cd3488f96..da2a05823 100644 --- a/packages/opencensus-propagation-jaeger/src/validators.ts +++ b/packages/opencensus-propagation-jaeger/src/validators.ts @@ -78,19 +78,12 @@ export const isValidTraceId = compose( /** * Determines if the given spanId is valid based on https://www.jaegertracing.io/docs/1.21/client-libraries/#value */ -export const isValidSpanId = compose( - isHex, - isNotAllZeros, - isLength(16) -); +export const isValidSpanId = compose(isHex, isNotAllZeros, isLength(16)); /** * Determines if the given option is valid based on https://www.jaegertracing.io/docs/1.21/client-libraries/#value */ -export const isValidOption = compose( - isHex, - isLength(2) -); +export const isValidOption = compose(isHex, isLength(2)); /** * Formats a traceId to 64Bit or 128Bit Hex and add leading zeroes diff --git a/packages/opencensus-propagation-tracecontext/src/validators.ts b/packages/opencensus-propagation-tracecontext/src/validators.ts index 386c31f49..4f828ac6a 100644 --- a/packages/opencensus-propagation-tracecontext/src/validators.ts +++ b/packages/opencensus-propagation-tracecontext/src/validators.ts @@ -61,36 +61,22 @@ const compose = (...fns: ValidationFn[]): ValidationFn => { * the version. If the version is parsable as hex and of length 2, we will * attempt to parse the header. This is per section 2.2.5 of the spec. */ -export const isValidVersion = compose( - isHex, - isLength(2) -); +export const isValidVersion = compose(isHex, isLength(2)); /** * Determines if the given traceId is valid based on section 2.2.2.1 of the * Trace Context spec. */ -export const isValidTraceId = compose( - isHex, - isNotAllZeros, - isLength(32) -); +export const isValidTraceId = compose(isHex, isNotAllZeros, isLength(32)); /** * Determines if the given spanId is valid based on section 2.2.2.2 of the Trace * Context spec. */ -export const isValidSpanId = compose( - isHex, - isNotAllZeros, - isLength(16) -); +export const isValidSpanId = compose(isHex, isNotAllZeros, isLength(16)); /** * Determines if the given option is valid based on section 2.2.3 of the Trace * Context spec. */ -export const isValidOption = compose( - isHex, - isLength(2) -); +export const isValidOption = compose(isHex, isLength(2));