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.15.15 to 0.15.16

0

.vscode/launch.json

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ // Available variables which can be used inside of strings.

18

AutoCollection/RequestDataHelper.js

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

this.method = request.method;
this.url = request.url;
this.url = this._getAbsoluteUrl(request);
this.startTime = +new Date();

@@ -44,3 +44,3 @@ this.rawHeaders = request.headers || request.rawHeaders;

requestData.duration = Util.msToTimeSpan(this.duration);
requestData.responseCode = this.statusCode.toString();
requestData.responseCode = this.statusCode ? this.statusCode.toString() : null;
requestData.success = this._isSuccess(this.statusCode);

@@ -65,4 +65,16 @@ requestData.properties = this.properties;

RequestDataHelper.prototype._isSuccess = function (statusCode) {
return (statusCode < 400); // todo: this could probably be improved
return statusCode && (statusCode < 400); // todo: this could probably be improved
};
RequestDataHelper.prototype._getAbsoluteUrl = function (request) {
if (!request.headers) {
return request.url;
}
var encrypted = request.connection ? request.connection.encrypted : null;
var absoluteUrl = url.format({
protocol: encrypted ? "https" : "http",
host: request.headers.host,
pathname: request.url
});
return absoluteUrl;
};
RequestDataHelper.prototype._getIp = function () {

@@ -69,0 +81,0 @@ // regex to match ipv4 without port

2

package.json

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

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

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

@@ -8,7 +8,7 @@ # Application Insights for Node.js

This project provides a Node.js SDK for Application Insights. [Application Insights](http://azure.microsoft.com/en-us/services/application-insights/) is a service that allows developers to keep their applications available, performant, and successful. This node module will allow you to send telemetry of various kinds (event, trace, exception, etc.) to the Application Insights service where they can be visualized in the Azure Portal.
This project provides a [Visual Studio Application Insights](https://azure.microsoft.com/documentation/articles/app-insights-overview/) SDK for [Node.js](https://nodejs.org/). The SDK sends telemetry about the performance and usage of your live Node.js application to the Application Insights service. There you can analyze charts of request rates, response times, failures and dependencies, and diagnose issues using powerful search and aggregation tools.
The SDK provides automatic collection of incoming HTTP request rates and responses, performance counters (CPU, memory, RPS), and unhandled exceptions. In addition, you can add custom calls to track dependencies, metrics, or other events.
## Requirements ##

@@ -19,6 +19,6 @@ **Install**

```
**Get an instrumentation key**
>**Note**: an instrumentation key is required before any data can be sent. Please see the "[Getting an Application Insights Instrumentation Key](https://github.com/Microsoft/AppInsights-Home/wiki#getting-an-application-insights-instrumentation-key)" section of the wiki for more information. To try the SDK without an instrumentation key, set the instrumentationKey config value to a non-empty string.
### Get an instrumentation key
[Create an Application Insights resource](https://azure.microsoft.com/documentation/articles/app-insights-create-new-resource/) where your telemetry will be displayed. This provides you with an instrumentation key that identifies the resource. (You can try the SDK without sending telemetry: set the instrumentation key to a non-empty string.)

@@ -28,3 +28,4 @@

This will enable request monitoring, unhandled exception tracking, and system performance monitoring (CPU/Memory/RPS)
This will enable request monitoring, unhandled exception tracking, and system performance monitoring (CPU/Memory/RPS).
```javascript

@@ -40,3 +41,5 @@ import appInsights = require("applicationinsights");

## Customized Usage ##
#####Disabling auto-collection#####
### Disabling auto-collection
```javascript

@@ -52,5 +55,18 @@ import appInsights = require("applicationinsights");

### Custom monitoring
```javascript
import appInsights = require("applicationinsights");
var client = appInsights.getClient();
#####Using multiple instrumentaion keys#####
client.trackEvent("custom event", {customProperty: "custom property value"});
client.trackException(new Error("handled exceptions can be logged with this method"));
client.trackMetric("custom metric", 3);
client.trackTrace("trace message");
```
[Learn more about the telemetry API](https://azure.microsoft.com/documentation/articles/app-insights-api-custom-events-metrics/).
### Using multiple instrumentation keys
```javascript

@@ -67,5 +83,6 @@ import appInsights = require("applicationinsights");

## Examples
### Tracking dependency
#####Custom monitoring#####
```javascript

@@ -75,15 +92,2 @@ import appInsights = require("applicationinsights");

client.trackEvent("custom event", {customProperty: "custom property value"});
client.trackException(new Error("handled exceptions can be logged with this method"));
client.trackMetric("custom metric", 3);
client.trackTrace("trace message");
```
#####Example with tracking dependency#####
```javascript
import appInsights = require("applicationinsights");
var client = appInsights.getClient();
var startTime = Date.now();

@@ -100,3 +104,4 @@ // execute dependency call

#####Example with manual request tracking of all "GET" requests#####
### Manual request tracking of all "GET" requests
```javascript

@@ -141,3 +146,4 @@ var http = require("http");

## Contributing ##
## Contributing
**Development environment**

@@ -144,0 +150,0 @@

Sorry, the diff of this file is not supported yet

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