Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

applicationinsights

Package Overview
Dependencies
Maintainers
1
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

applicationinsights - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

4

out/AutoCollection/Performance.js

@@ -195,3 +195,3 @@ "use strict";

var elapsedSeconds = elapsedMs / 1000;
var averageRequestExecutionTime = AutoCollectPerformance._intervalRequestExecutionTime / intervalRequests;
var averageRequestExecutionTime = (AutoCollectPerformance._intervalRequestExecutionTime / intervalRequests) || 0; // default to 0 in case no requests in this interval
AutoCollectPerformance._intervalRequestExecutionTime = 0; // reset

@@ -227,3 +227,3 @@ if (elapsedMs > 0) {

var elapsedSeconds = elapsedMs / 1000;
var averageDependencyExecutionTime = AutoCollectPerformance._intervalDependencyExecutionTime / intervalDependencies;
var averageDependencyExecutionTime = (AutoCollectPerformance._intervalDependencyExecutionTime / intervalDependencies) || 0;
AutoCollectPerformance._intervalDependencyExecutionTime = 0; // reset

@@ -230,0 +230,0 @@ if (elapsedMs > 0) {

@@ -8,6 +8,6 @@ /// <reference types="node" />

constructor(config: Config);
ping(envelope: Contracts.EnvelopeQuickPulse, done: (shouldPOST: boolean) => void): void;
post(envelope: Contracts.EnvelopeQuickPulse, done: (shouldPOST: boolean, res: http.IncomingMessage) => void): void;
ping(envelope: Contracts.EnvelopeQuickPulse, done: (shouldPOST: boolean, res?: http.IncomingMessage) => void): void;
post(envelope: Contracts.EnvelopeQuickPulse, done: (shouldPOST: boolean, res?: http.IncomingMessage) => void): void;
private _submitData(envelope, done, postOrPing);
}
export = QuickPulseSender;

@@ -43,3 +43,4 @@ "use strict";

// Do nothing for now.
Logging.warn("Unable to contact qps endpoint", error);
Logging.warn("Unable to contact qps endpoint, dropping this Live Metrics packet", error);
done(false); // Stop POSTing QPS data
});

@@ -46,0 +47,0 @@ req.write(payload);

@@ -8,6 +8,12 @@ import Config = require("./Config");

context: Context;
private static _isCollectingData;
private static MAX_POST_WAIT_TIME;
private static MAX_PING_WAIT_TIME;
private static FALLBACK_INTERVAL;
private static PING_INTERVAL;
private static POST_INTERVAL;
private _isCollectingData;
private _sender;
private _isEnabled;
private _lastSuccessTime;
private _lastSendSucceeded;
private _handle;

@@ -51,4 +57,4 @@ private _metrics;

private _post(envelope);
private _quickPulseDone(shouldPOST, res);
private _quickPulseDone(shouldPOST, res?);
}
export = QuickPulseStateManager;

@@ -11,3 +11,5 @@ "use strict";

function QuickPulseStateManager(iKey, context) {
this._isCollectingData = false;
this._lastSuccessTime = Date.now();
this._lastSendSucceeded = true;
this._metrics = {};

@@ -101,3 +103,3 @@ this._documents = [];

// Send it to QuickPulseService, if collecting
if (QuickPulseStateManager._isCollectingData) {
if (this._isCollectingData) {
this._post(envelope);

@@ -108,12 +110,13 @@ }

}
var currentTimeout = QuickPulseStateManager._isCollectingData ? 1000 : 5000;
if (QuickPulseStateManager._isCollectingData && Date.now() - this._lastSuccessTime >= 20000) {
var currentTimeout = this._isCollectingData ? QuickPulseStateManager.POST_INTERVAL : QuickPulseStateManager.PING_INTERVAL;
if (this._isCollectingData && Date.now() - this._lastSuccessTime >= QuickPulseStateManager.MAX_POST_WAIT_TIME && !this._lastSendSucceeded) {
// Haven't posted successfully in 20 seconds, so wait 60 seconds and ping
QuickPulseStateManager._isCollectingData = false;
currentTimeout = 60000;
this._isCollectingData = false;
currentTimeout = QuickPulseStateManager.FALLBACK_INTERVAL;
}
else if (!QuickPulseStateManager._isCollectingData && Date.now() - this._lastSuccessTime >= 60000) {
else if (!this._isCollectingData && Date.now() - this._lastSuccessTime >= QuickPulseStateManager.MAX_PING_WAIT_TIME && !this._lastSendSucceeded) {
// Haven't pinged successfully in 60 seconds, so wait another 60 seconds
currentTimeout = 60000;
currentTimeout = QuickPulseStateManager.FALLBACK_INTERVAL;
}
this._lastSendSucceeded = null;
this._handle = setTimeout(this._goQuickPulse.bind(this), currentTimeout);

@@ -129,12 +132,20 @@ this._handle.unref(); // Don't block apps from terminating

QuickPulseStateManager.prototype._quickPulseDone = function (shouldPOST, res) {
if (QuickPulseStateManager._isCollectingData !== shouldPOST) {
if (this._isCollectingData !== shouldPOST) {
Logging.info("Live Metrics sending data", shouldPOST);
this.enableCollectors(shouldPOST);
}
QuickPulseStateManager._isCollectingData = shouldPOST;
if (res.statusCode < 300 && res.statusCode >= 200) {
this._isCollectingData = shouldPOST;
if (res && res.statusCode < 300 && res.statusCode >= 200) {
this._lastSuccessTime = Date.now();
this._lastSendSucceeded = true;
}
else {
this._lastSendSucceeded = false;
}
};
QuickPulseStateManager._isCollectingData = false;
QuickPulseStateManager.MAX_POST_WAIT_TIME = 20000;
QuickPulseStateManager.MAX_PING_WAIT_TIME = 60000;
QuickPulseStateManager.FALLBACK_INTERVAL = 60000;
QuickPulseStateManager.PING_INTERVAL = 5000;
QuickPulseStateManager.POST_INTERVAL = 1000;
return QuickPulseStateManager;

@@ -141,0 +152,0 @@ }());

@@ -5,3 +5,3 @@ {

"bugs": "https://github.com/Microsoft/ApplicationInsights-node.js/issues",
"version": "1.3.0",
"version": "1.3.1",
"description": "Microsoft Application Insights module for Node.js",

@@ -8,0 +8,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc