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 0.16.0 to 0.17.0

.vscode/settings.json

31

applicationinsights.js

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

var AutoCollectPerformance = require("./AutoCollection/Performance");
var AutoCollectRequests = require("./AutoCollection/Requests");
var AutoCollectClientRequests = require("./AutoCollection/ClientRequests");
var AutoCollectServerRequests = require("./AutoCollection/ServerRequests");
var Client = require("./Library/Client");

@@ -36,3 +37,4 @@ var Logging = require("./Library/Logging");

ApplicationInsights._performance = new AutoCollectPerformance(ApplicationInsights.client);
ApplicationInsights._requests = new AutoCollectRequests(ApplicationInsights.client);
ApplicationInsights._serverRequests = new AutoCollectServerRequests(ApplicationInsights.client);
ApplicationInsights._clientRequests = new AutoCollectClientRequests(ApplicationInsights.client);
}

@@ -57,3 +59,4 @@ else {

ApplicationInsights._performance.enable(ApplicationInsights._isPerformance);
ApplicationInsights._requests.enable(ApplicationInsights._isRequests);
ApplicationInsights._serverRequests.enable(ApplicationInsights._isRequests);
ApplicationInsights._clientRequests.enable(ApplicationInsights._isDependencies);
}

@@ -109,3 +112,3 @@ else {

if (ApplicationInsights._isStarted) {
ApplicationInsights._requests.enable(value);
ApplicationInsights._serverRequests.enable(value);
}

@@ -115,2 +118,14 @@ return ApplicationInsights;

/**
* Sets the state of dependency tracking (enabled by default)
* @param value if true dependencies will be sent to Application Insights
* @returns {ApplicationInsights} this class
*/
ApplicationInsights.setAutoCollectDependencies = function (value) {
ApplicationInsights._isDependencies = value;
if (ApplicationInsights._isStarted) {
ApplicationInsights._clientRequests.enable(value);
}
return ApplicationInsights;
};
/**
* Enable or disable offline mode to cache events when client is offline (disabled by default)

@@ -151,5 +166,8 @@ * @param value if true events that occured while client is offline will be cached on disk

}
if (ApplicationInsights._requests) {
ApplicationInsights._requests.dispose();
if (ApplicationInsights._serverRequests) {
ApplicationInsights._serverRequests.dispose();
}
if (ApplicationInsights._clientRequests) {
ApplicationInsights._clientRequests.dispose();
}
};

@@ -160,2 +178,3 @@ ApplicationInsights._isConsole = true;

ApplicationInsights._isRequests = true;
ApplicationInsights._isDependencies = true;
ApplicationInsights._isOfflineMode = false;

@@ -162,0 +181,0 @@ ApplicationInsights._isStarted = false;

2

AutoCollection/Performance.js

@@ -19,3 +19,3 @@ ///<reference path="..\Declarations\node\node.d.ts" />

if (!!AutoCollectPerformance.INSTANCE) {
throw new Error("Exception tracking should be configured from the applicationInsights object");
throw new Error("Performance tracking should be configured from the applicationInsights object");
}

@@ -22,0 +22,0 @@ AutoCollectPerformance.INSTANCE = this;

"use strict";
var url = require("url");
var Config = require("./Config");

@@ -7,3 +8,4 @@ var Context = require("./Context");

var Channel = require("./Channel");
var RequestTracking = require("../AutoCollection/Requests");
var ServerRequestTracking = require("../AutoCollection/ServerRequests");
var ClientRequestTracking = require("../AutoCollection/ClientRequests");
var Sender = require("./Sender");

@@ -113,8 +115,11 @@ var Util = require("./Util");

Client.prototype.trackRequestSync = function (request, response, ellapsedMilliseconds, properties, error) {
RequestTracking.trackRequestSync(this, request, response, ellapsedMilliseconds, properties, error);
ServerRequestTracking.trackRequestSync(this, request, response, ellapsedMilliseconds, properties, error);
};
Client.prototype.trackRequest = function (request, response, properties) {
RequestTracking.trackRequest(this, request, response, properties);
ServerRequestTracking.trackRequest(this, request, response, properties);
};
Client.prototype.trackDependency = function (name, commandName, elapsedTimeMs, success, dependencyTypeName, properties, dependencyKind, async, dependencySource) {
Client.prototype.trackDependencyRequest = function (requestOptions, request, properties) {
ClientRequestTracking.trackRequest(this, requestOptions, request, properties);
};
Client.prototype.trackDependency = function (name, commandName, elapsedTimeMs, success, dependencyTypeName, properties, dependencyKind, async, dependencySource, target) {
if (properties === void 0) { properties = {}; }

@@ -124,5 +129,10 @@ if (dependencyKind === void 0) { dependencyKind = ContractsModule.Contracts.DependencyKind.Other; }

if (dependencySource === void 0) { dependencySource = ContractsModule.Contracts.DependencySourceType.Undefined; }
if (target === void 0) { target = null; }
if (!target && commandName) {
target = url.parse(commandName).host;
}
var remoteDependency = new ContractsModule.Contracts.RemoteDependencyData();
remoteDependency.name = name;
remoteDependency.commandName = commandName;
remoteDependency.target = target;
remoteDependency.value = elapsedTimeMs;

@@ -129,0 +139,0 @@ remoteDependency.success = success;

///<reference path="..\Declarations\node\node.d.ts" />
"use strict";
var crypto = require('crypto');
var Config = (function () {
function Config(instrumentationKey) {
this.instrumentationKey = instrumentationKey || this._getInstrumentationKey();
this.instrumentationKey = instrumentationKey || Config._getInstrumentationKey();
this.instrumentationKeyHash = Config._getStringHashBase64(this.instrumentationKey);
this.endpointUrl = "https://dc.services.visualstudio.com/v2/track";

@@ -13,3 +15,3 @@ this.sessionRenewalMs = 30 * 60 * 1000;

}
Config.prototype._getInstrumentationKey = function () {
Config._getInstrumentationKey = function () {
// check for both the documented env variable and the azure-prefixed variable

@@ -25,2 +27,8 @@ var iKey = process.env[Config.ENV_iKey]

};
Config._getStringHashBase64 = function (value) {
var hash = crypto.createHash('sha256');
hash.update(value);
var result = hash.digest('base64');
return result;
};
// Azure adds this prefix to all environment variables

@@ -27,0 +35,0 @@ Config.ENV_azurePrefix = "APPSETTING_";

@@ -197,2 +197,11 @@ "use strict";

Contracts.PageViewPerfData = PageViewPerfData;
var RemoteDependencyTypes = (function () {
function RemoteDependencyTypes() {
}
RemoteDependencyTypes.ApplicationInsights = "Application Insights";
RemoteDependencyTypes.Http = "Http";
RemoteDependencyTypes.Sql = "SQL";
return RemoteDependencyTypes;
}());
Contracts.RemoteDependencyTypes = RemoteDependencyTypes;
var RemoteDependencyData = (function (_super) {

@@ -199,0 +208,0 @@ __extends(RemoteDependencyData, _super);

@@ -11,2 +11,3 @@ ///<reference path="..\Declarations\node\node.d.ts" />

var Logging = require("./Logging");
var AutoCollectClientRequests = require("../AutoCollection/ClientRequests");
var Sender = (function () {

@@ -60,2 +61,4 @@ function Sender(getUrl, onSuccess, onError) {

Logging.info(Sender.TAG, options);
// Ensure this request is not captured by auto-collection.
options[AutoCollectClientRequests.disableCollectionRequestOption] = true;
var req = protocol.request(options, function (res) {

@@ -136,3 +139,3 @@ res.setEncoding("utf-8");

//create file - file name for now is the timestamp, a better approach would be a UUID but that
//would require an external dependency
//would require an external dependency
var fileName = new Date().getTime() + ".ai.json";

@@ -155,3 +158,3 @@ var fileFullPath = path.join(direcotry, fileName);

//create file - file name for now is the timestamp, a better approach would be a UUID but that
//would require an external dependency
//would require an external dependency
var fileName = new Date().getTime() + ".ai.json";

@@ -158,0 +161,0 @@ var fileFullPath = path.join(direcotry, fileName);

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

"bugs": "https://github.com/Microsoft/ApplicationInsights-node.js/issues",
"version": "0.16.0",
"version": "0.17.0",
"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