New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zaplabs/opencensus-instrumentation-mongodb

Package Overview
Dependencies
Maintainers
26
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zaplabs/opencensus-instrumentation-mongodb - npm Package Compare versions

Comparing version

to
0.0.14

7

build/src/mongodb.d.ts

@@ -23,3 +23,2 @@ /**

private readonly CURSOR_FNS_FIRST;
private readonly SPAN_MONGODB_QUERY_TYPE;
/** Constructs a new MongoDBPlugin instance. */

@@ -34,7 +33,7 @@ constructor(moduleName: string);

/** Creates spans for Command operations */
private getPatchCommand();
private getPatchCommand;
/** Creates spans for Query operations */
private getPatchQuery();
private getPatchQuery;
/** Creates spans for Cursor operations */
private getPatchCursor();
private getPatchCursor;
/**

@@ -41,0 +40,0 @@ * Ends a created span.

@@ -27,3 +27,2 @@ "use strict";

this.CURSOR_FNS_FIRST = ['_find', '_getmore'];
this.SPAN_MONGODB_QUERY_TYPE = 'db.mongodb.query';
}

@@ -57,7 +56,8 @@ /**

return (original) => {
return function (ns, command,
return function (ns,
// tslint:disable-next-line:no-any
...args) {
let resultHandler = args[args.length - 1];
if (plugin.tracer.currentRootSpan && arguments.length > 0 &&
command, options, callback) {
const resultHandler = typeof options === 'function' ? options : callback;
if (plugin.tracer.currentRootSpan &&
arguments.length > 0 &&
typeof resultHandler === 'function') {

@@ -80,4 +80,12 @@ let type;

}
const span = plugin.tracer.startChildSpan(ns + '.' + type, plugin.SPAN_MONGODB_QUERY_TYPE);
resultHandler = plugin.patchEnd(span, resultHandler);
const span = plugin.tracer.startChildSpan({
name: `${ns}.${type}`,
kind: opencensus_core_1.SpanKind.SERVER,
});
if (typeof options === 'function') {
return original.call(this, ns, command, plugin.patchEnd(span, options));
}
else {
return original.call(this, ns, command, options, plugin.patchEnd(span, callback));
}
}

@@ -92,9 +100,21 @@ return original.apply(this, arguments);

return (original) => {
return function (ns,
// tslint:disable-next-line:no-any
return function (ns, ...args) {
let resultHandler = args[args.length - 1];
if (plugin.tracer.currentRootSpan && arguments.length > 0 &&
command,
// tslint:disable-next-line:no-any
options, callback) {
const resultHandler = typeof options === 'function' ? options : callback;
if (plugin.tracer.currentRootSpan &&
arguments.length > 0 &&
typeof resultHandler === 'function') {
const span = plugin.tracer.startChildSpan(ns + '.query', plugin.SPAN_MONGODB_QUERY_TYPE);
resultHandler = plugin.patchEnd(span, resultHandler);
const span = plugin.tracer.startChildSpan({
name: `${ns}.query`,
kind: opencensus_core_1.SpanKind.SERVER,
});
if (typeof options === 'function') {
return original.call(this, ns, command, plugin.patchEnd(span, options));
}
else {
return original.call(this, ns, command, options, plugin.patchEnd(span, callback));
}
}

@@ -112,8 +132,12 @@ return original.apply(this, arguments);

let resultHandler = args[0];
if (plugin.tracer.currentRootSpan && arguments.length > 0 &&
if (plugin.tracer.currentRootSpan &&
arguments.length > 0 &&
typeof resultHandler === 'function') {
const span = plugin.tracer.startChildSpan(this.ns + '.cursor', plugin.SPAN_MONGODB_QUERY_TYPE);
const span = plugin.tracer.startChildSpan({
name: `${this.ns}.cursor`,
kind: opencensus_core_1.SpanKind.SERVER,
});
resultHandler = plugin.patchEnd(span, resultHandler);
}
return original.apply(this, arguments);
return original.call(this, resultHandler);
};

@@ -120,0 +144,0 @@ };

{
"name": "@zaplabs/opencensus-instrumentation-mongodb",
"version": "0.0.8",
"version": "0.0.14",
"description": "Opencensus MongoDB automatic instrumentation package.",

@@ -9,3 +9,4 @@ "main": "build/src/index.js",

"scripts": {
"test": "nyc -x '**/test/**' --reporter=html --reporter=text mocha 'build/test/**/*.js'",
"test": "nyc ts-mocha -p ./tsconfig.json test/**/*.ts",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json",
"clean": "rimraf build/*",

@@ -16,3 +17,2 @@ "check": "gts check",

"prepare": "npm run compile",
"pretest": "npm run compile",
"posttest": "npm run check"

@@ -29,3 +29,3 @@ },

"engines": {
"node": ">=6.0"
"node": ">=8"
},

@@ -40,2 +40,13 @@ "files": [

],
"nyc": {
"extension": [
".ts",
".tsx"
],
"exclude": [
"**/*.d.ts",
"build/**/**/*.js"
],
"all": true
},
"publishConfig": {

@@ -45,27 +56,21 @@ "access": "public"

"devDependencies": {
"@types/end-of-stream": "^1.4.0",
"@types/continuation-local-storage": "^3.2.1",
"@types/mocha": "^5.2.5",
"@types/mongodb": "^3.0.19",
"@types/nock": "^9.1.3",
"@types/node": "^10.12.12",
"@types/semver": "^5.5.0",
"@types/shimmer": "^1.0.1",
"@types/uuid": "^3.4.3",
"gts": "^0.5.1",
"mocha": "^5.0.4",
"mongodb": "^3.0.10",
"ncp": "^2.0.0",
"nock": "^9.2.6",
"nyc": "^11.7.1",
"codecov": "^3.4.0",
"gts": "^1.0.0",
"mocha": "^6.1.0",
"mongodb": "3.1.10",
"nyc": "^14.0.0",
"rimraf": "^2.6.2",
"ts-node": "^4.0.0",
"typescript": "~2.7.2"
"ts-mocha": "^6.0.0",
"ts-node": "^8.0.0",
"typescript": "~2.9.0"
},
"dependencies": {
"@zaplabs/opencensus-core": "^0.0.8",
"end-of-stream": "^1.4.1",
"semver": "^5.5.0",
"shimmer": "^1.2.0",
"uuid": "^3.2.1"
"@zaplabs/opencensus-core": "^0.0.14",
"shimmer": "^1.2.0"
}
}

@@ -6,3 +6,3 @@ # OpenCensus MongoDB Instrumentation for Node.js

This project is still at an early stage of development. It's subject to change.
The library is in alpha stage and the API is subject to change.

@@ -9,0 +9,0 @@ ## Useful links