Node.js

To start working with Azure Application Insights in Node.js, you will need the following command:

npm install applicationinsights

It will install an NPM package of Application Insights, which allows working with this service. Here is a full example of the interface of this package:

let http = require("http");let appInsights = require("applicationinsights");appInsights.setup("<instrumentation-key>");appInsights.start();let client = appInsights.defaultClient;client.trackEvent({name: "my custom event", properties: {customProperty: "custom property value"}});client.trackException({exception: new Error("handled exceptions can be logged with this method")});client.trackMetric({name: "custom metric", value: 3});client.trackTrace({message: ...

Get Hands-On Azure for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.