diagnostic-channel-publishers
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -0,1 +1,2 @@ | ||
import * as azuresdk from "./azure-coretracing.pub"; | ||
import * as bunyan from "./bunyan.pub"; | ||
@@ -10,4 +11,5 @@ import * as consolePub from "./console.pub"; | ||
import * as redis from "./redis.pub"; | ||
import * as tedious from "./tedious.pub"; | ||
import * as winston from "./winston.pub"; | ||
export { bunyan, consolePub as console, mongodbCore, mongodb, mysql, redis, winston, pg, pgPool, IPostgresData, IPostgresResult, }; | ||
export { azuresdk, bunyan, consolePub as console, mongodbCore, mongodb, mysql, redis, winston, pg, pgPool, tedious, IPostgresData, IPostgresResult, }; | ||
export declare function enable(): void; |
@@ -5,2 +5,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var azuresdk = require("./azure-coretracing.pub"); | ||
exports.azuresdk = azuresdk; | ||
var bunyan = require("./bunyan.pub"); | ||
@@ -22,2 +24,4 @@ exports.bunyan = bunyan; | ||
exports.redis = redis; | ||
var tedious = require("./tedious.pub"); | ||
exports.tedious = tedious; | ||
var winston = require("./winston.pub"); | ||
@@ -35,4 +39,6 @@ exports.winston = winston; | ||
winston.enable(); | ||
azuresdk.enable(); | ||
tedious.enable(); | ||
} | ||
exports.enable = enable; | ||
//# sourceMappingURL=index.js.map |
@@ -6,2 +6,3 @@ import { IModulePatcher } from "diagnostic-channel"; | ||
command?: any; | ||
time: Date; | ||
}; | ||
@@ -8,0 +9,0 @@ event: { |
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -22,3 +30,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
} | ||
eventMap[event.requestId] = event; | ||
eventMap[event.requestId] = __assign({}, event, { time: new Date() }); | ||
}); | ||
@@ -30,3 +38,9 @@ listener.on("succeeded", function (event) { | ||
} | ||
event.operationId(function () { return diagnostic_channel_1.channel.publish("mongodb", { startedData: startedData, event: event, succeeded: true }); }); | ||
if (typeof event.operationId === "function") { | ||
event.operationId(function () { return diagnostic_channel_1.channel.publish("mongodb", { startedData: startedData, event: event, succeeded: true }); }); | ||
} | ||
else { | ||
// fallback -- correlation will not work here | ||
diagnostic_channel_1.channel.publish("mongodb", { startedData: startedData, event: event, succeeded: true }); | ||
} | ||
}); | ||
@@ -38,3 +52,9 @@ listener.on("failed", function (event) { | ||
} | ||
event.operationId(function () { return diagnostic_channel_1.channel.publish("mongodb", { startedData: startedData, event: event, succeeded: false }); }); | ||
if (typeof event.operationId === "function") { | ||
event.operationId(function () { return diagnostic_channel_1.channel.publish("mongodb", { startedData: startedData, event: event, succeeded: false }); }); | ||
} | ||
else { | ||
// fallback -- correlation will not work here | ||
diagnostic_channel_1.channel.publish("mongodb", { startedData: startedData, event: event, succeeded: false }); | ||
} | ||
}); | ||
@@ -55,3 +75,3 @@ return originalMongo; | ||
contextMap[event.requestId] = diagnostic_channel_1.channel.bindToContext(function (cb) { return cb(); }); | ||
eventMap[event.requestId] = event; | ||
eventMap[event.requestId] = __assign({}, event, { time: new Date() }); | ||
}); | ||
@@ -58,0 +78,0 @@ listener.on("succeeded", function (event) { |
@@ -16,4 +16,5 @@ import { IModulePatcher } from "diagnostic-channel"; | ||
duration: number; | ||
time: Date; | ||
} | ||
export declare const mysql: IModulePatcher; | ||
export declare function enable(): void; |
@@ -27,3 +27,3 @@ "use strict"; | ||
var cb = arguments[cbidx]; | ||
var resultContainer = { result: null, startTime: null }; | ||
var resultContainer = { result: null, startTime: null, startDate: null }; | ||
if (typeof cb === "function") { | ||
@@ -35,2 +35,3 @@ // Preserve context on the callback. | ||
resultContainer.startTime = process.hrtime(); | ||
resultContainer.startDate = new Date(); | ||
arguments[cbidx] = diagnostic_channel_1.channel.bindToContext(cbWrapper(resultContainer, cb)); | ||
@@ -64,3 +65,3 @@ } | ||
var duration = (hrDuration[0] * 1e3 + hrDuration[1] / 1e6) | 0; | ||
diagnostic_channel_1.channel.publish("mysql", { query: resultContainer.result, callbackArgs: arguments, err: err, duration: duration }); | ||
diagnostic_channel_1.channel.publish("mysql", { query: resultContainer.result, callbackArgs: arguments, err: err, duration: duration, time: resultContainer.startDate }); | ||
cb.apply(this, arguments); | ||
@@ -67,0 +68,0 @@ }; |
@@ -22,2 +22,3 @@ import { IModulePatcher } from "diagnostic-channel"; | ||
error?: Error; | ||
time: Date; | ||
} | ||
@@ -24,0 +25,0 @@ export declare const postgres6: IModulePatcher; |
@@ -22,2 +22,3 @@ "use strict"; | ||
duration: 0, | ||
time: new Date(), | ||
}; | ||
@@ -145,2 +146,3 @@ var start = process.hrtime(); | ||
duration: 0, | ||
time: new Date(), | ||
}; | ||
@@ -191,3 +193,3 @@ var start = process.hrtime(); | ||
callbackProvided = typeof callback === "function"; | ||
callback = callback ? patchCallback(callback) : callback; | ||
callback = callbackProvided ? patchCallback(callback) : callback; | ||
} | ||
@@ -194,0 +196,0 @@ else { |
@@ -8,4 +8,5 @@ import { IModulePatcher } from "diagnostic-channel"; | ||
result: any; | ||
time: Date; | ||
} | ||
export declare const redis: IModulePatcher; | ||
export declare function enable(): void; |
@@ -15,2 +15,3 @@ "use strict"; | ||
var startTime_1 = process.hrtime(); | ||
var startDate_1 = new Date(); | ||
// Note: augmenting the callback on internal_send_command is correct for context | ||
@@ -24,3 +25,3 @@ // tracking, but may be too low-level for dependency tracking. There are some 'errors' | ||
var duration = (hrDuration[0] * 1e3 + hrDuration[1] / 1e6) | 0; | ||
diagnostic_channel_1.channel.publish("redis", { duration: duration, address: address_1, commandObj: commandObj, err: err, result: result }); | ||
diagnostic_channel_1.channel.publish("redis", { duration: duration, address: address_1, commandObj: commandObj, err: err, result: result, time: startDate_1 }); | ||
if (typeof cb_1 === "function") { | ||
@@ -27,0 +28,0 @@ cb_1.apply(this, arguments); |
{ | ||
"name": "diagnostic-channel-publishers", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"main": "dist/src/index.js", | ||
@@ -23,6 +23,9 @@ "types": "dist/src/index.d.ts", | ||
"devDependencies": { | ||
"@azure/core-tracing": "^1.0.0-preview.5", | ||
"@opentelemetry/tracing": "^0.1.1", | ||
"@types/mocha": "^2.2.40", | ||
"@types/node": "^10.0.0", | ||
"@types/node": "12.12.17", | ||
"@types/pg": "^7.4.11", | ||
"diagnostic-channel": "0.2.0", | ||
"@types/tedious": "^4.0.0", | ||
"diagnostic-channel": "file:../diagnostic-channel", | ||
"mocha": "^3.2.0", | ||
@@ -35,2 +38,3 @@ "mongodb": "^3.1.13", | ||
"rimraf": "^2.6.1", | ||
"tedious": "^8.0.1", | ||
"tslint": "^5.0.0", | ||
@@ -37,0 +41,0 @@ "typescript": "^2.2.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55485
27
1200
19