{
  "_args": [
    [
      "applicationinsights@https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.18.0.tgz",
      "D:\\work\\3\\s\\extensions\\git"
    ]
  ],
  "_from": "applicationinsights@0.18.0",
  "_id": "applicationinsights@0.18.0",
  "_inCache": true,
  "_location": "/applicationinsights",
  "_phantomChildren": {},
  "_requested": {
    "name": "applicationinsights",
    "raw": "applicationinsights@https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.18.0.tgz",
    "rawSpec": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.18.0.tgz",
    "scope": null,
    "spec": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.18.0.tgz",
    "type": "remote"
  },
  "_requiredBy": [
    "/vscode-extension-telemetry"
  ],
  "_resolved": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.18.0.tgz",
  "_shasum": "162ebb48a383408bc4de44db32b417307f45bbc1",
  "_shrinkwrap": null,
  "_spec": "applicationinsights@https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.18.0.tgz",
  "_where": "D:\\work\\3\\s\\extensions\\git",
  "bugs": {
    "url": "https://github.com/Microsoft/ApplicationInsights-node.js/issues"
  },
  "contributors": [
    {
      "email": "aidevsupport@microsoft.com",
      "name": "Application Insights Developer Support"
    },
    {
      "email": "kszostak@microsoft.com",
      "name": "kszostak"
    },
    {
      "name": "southwood",
      "url": "https://github.com/southwood"
    },
    {
      "email": "bogdanbe@microsoft.com",
      "name": "bogdanbe"
    },
    {
      "email": "lukim@microsoft.com",
      "name": "lukim"
    }
  ],
  "dependencies": {},
  "description": "Microsoft Application Insights module for Node.JS",
  "devDependencies": {
    "mocha": "3.1.2",
    "node-mocks-http": "1.2.3",
    "sinon": "1.17.6",
    "typescript": "1.8.9",
    "typings": "2.0.0"
  },
  "homepage": "https://github.com/Microsoft/ApplicationInsights-node.js#readme",
  "keywords": [
    "exception monitoring",
    "request monitoring",
    "performance monitoring",
    "application insights",
    "microsoft",
    "azure"
  ],
  "license": "MIT",
  "main": "applicationinsights",
  "name": "applicationinsights",
  "optionalDependencies": {},
  "readme": "# Application Insights for Node.js\r\n\r\n[![NPM version](https://badge.fury.io/js/applicationinsights.svg)](http://badge.fury.io/js/applicationinsights)\r\n[![Build Status](https://travis-ci.org/Microsoft/ApplicationInsights-node.js.svg?branch=master)](https://travis-ci.org/Microsoft/ApplicationInsights-node.js)\r\n\r\n\r\n\r\nThis 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.\r\n\r\nThe 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.\r\n\r\n\r\n## Requirements ##\r\n**Install**\r\n```\r\nnpm install applicationinsights\r\n```\r\n\r\n### Get an instrumentation key\r\n\r\n[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.)\r\n\r\n\r\n## Usage ##\r\n\r\nThis will enable request monitoring, unhandled exception tracking, and system performance monitoring (CPU/Memory/RPS).\r\n\r\n```javascript\r\nimport appInsights = require(\"applicationinsights\");\r\nappInsights.setup(\"<instrumentation_key>\").start();\r\n```\r\n\r\n>The instrumentation key can also be set in the environment variable APPINSIGHTS_INSTRUMENTATIONKEY. If this is done, no argument is required when calling `appInsights.setup()` or `appInsights.getClient()`.\r\n\r\n\r\n\r\n## Customized Usage ##\r\n\r\n### Disabling auto-collection\r\n\r\n```javascript\r\nimport appInsights = require(\"applicationinsights\");\r\nappInsights.setup(\"<instrumentation_key>\")\r\n    .setAutoCollectRequests(false)\r\n    .setAutoCollectPerformance(false)\r\n    .setAutoCollectExceptions(false)\r\n    // no telemetry will be sent until .start() is called\r\n    .start();\r\n```\r\n\r\n### Custom monitoring\r\n\r\n```javascript\r\nimport appInsights = require(\"applicationinsights\");\r\nvar client = appInsights.getClient();\r\n\r\nclient.trackEvent(\"custom event\", {customProperty: \"custom property value\"});\r\nclient.trackException(new Error(\"handled exceptions can be logged with this method\"));\r\nclient.trackMetric(\"custom metric\", 3);\r\nclient.trackTrace(\"trace message\");\r\n```\r\n\r\n### Telemetry Processor\r\n\r\n```javascript\r\npublic addTelemetryProcessor(telemetryProcessor: (envelope: ContractsModule.Contracts.Envelope) => boolean)\r\n```\r\n\r\nAdds a telemetry processor to the collection. Telemetry processors will be called one by one, in the order they were added, before the telemetry item is pushed for sending. \r\nIf one of the telemetry processors returns false then the telemetry item will not be sent. \r\nIf one of the telemetry processors throws an error then the telemetry item will not be sent.\r\n\r\n**Example**\r\n\r\nAdd the below code before you send any telemetry, it will remove stack trace information from any Exception reported by the SDK.\r\n\r\n```javascript\r\nappInsights.client.addTelemetryProcessor((envelope) => {\r\n    if (envelope.data.baseType === \"Microsoft.ApplicationInsights.ExceptionData\") {\r\n        var data = envelope.data.baseData;\r\n        if (data.exceptions && data.exceptions.length > 0) {\r\n            for(var i = 0; i < data.exceptions.length; i++) {\r\n                var exception = data.exceptions[i];\r\n                exception.parsedStack = null;\r\n                exception.hasFullStack = false;\r\n            }\r\n        }\r\n    }\r\n    return true;\r\n});\r\n```\r\n\r\n[Learn more about the telemetry API](https://azure.microsoft.com/documentation/articles/app-insights-api-custom-events-metrics/).\r\n\r\n### Using multiple instrumentation keys\r\n\r\n```javascript\r\nimport appInsights = require(\"applicationinsights\");\r\n\r\n// configure auto-collection with one instrumentation key\r\nappInsights.setup(\"<instrumentation_key>\").start();\r\n\r\n// get a client for another instrumentation key\r\nvar otherClient = appInsights.getClient(\"<other_instrumentation_key>\");\r\notherClient.trackEvent(\"custom event\");\r\n```\r\n\r\n## Examples\r\n\r\n### Tracking dependency\r\n\r\n```javascript\r\nimport appInsights = require(\"applicationinsights\");\r\nvar client = appInsights.getClient();\r\n\r\nvar startTime = Date.now();\r\n// execute dependency call\r\nvar endTime = Date.now();\r\n\r\nvar elapsedTime = endTime - startTime;\r\nvar success = true;\r\nclient.trackDependency(\"dependency name\", \"command name\", elapsedTime, success);\r\n```\r\n\r\n\r\n\r\n### Manual request tracking of all \"GET\" requests\r\n\r\n```javascript\r\nvar http = require(\"http\");\r\nvar appInsights = require(\"applicationinsights\");\r\nappInsights.setup(\"<instrumentation_key>\")\r\n    .setAutoCollectRequests(false) // disable auto-collection of requests for this example\r\n    .start();\r\n\r\n// assign common properties to all telemetry sent from the default client\r\nappInsights.client.commonProperties = {\r\n    environment: process.env.SOME_ENV_VARIABLE\r\n};\r\n\r\n// track a system startup event\r\nappInsights.client.trackEvent(\"server start\");\r\n\r\n// create server\r\nvar port = process.env.port || 1337\r\nvar server = http.createServer(function (req, res) {\r\n    // track all \"GET\" requests\r\n    if(req.method === \"GET\") {\r\n        appInsights.client.trackRequest(req, res);\r\n    }\r\n\r\n    res.writeHead(200, { \"Content-Type\": \"text/plain\" });\r\n    res.end(\"Hello World\\n\");\r\n}).listen(port);\r\n\r\n// track startup time of the server as a custom metric\r\nvar start = +new Date;\r\nserver.on(\"listening\", () => {\r\n    var end = +new Date;\r\n    var duration = end - start;\r\n    appInsights.client.trackMetric(\"StartupTime\", duration);\r\n});\r\n```\r\n\r\n\r\n## Branches\r\n\r\n- [master](https://github.com/Microsoft/ApplicationInsights-node.js/tree/master) contains the *latest* published release located on [NPM](https://www.npmjs.com/package/applicationinsights).\r\n- [develop](https://github.com/Microsoft/ApplicationInsights-node.js/tree/develop) contains the code for the *next* release. Please send all pull requests to this branch.  \r\n\r\n## Links\r\n\r\n* Follow the latest Application Insights changes and announcements on [ApplicationInsights Announcements](https://github.com/Microsoft/ApplicationInsights-Announcements)\r\n\r\n## Contributing\r\n\r\n**Development environment**\r\n\r\n* Install dev dependencies\r\n    \r\n    ```\r\n    npm install \r\n    ```\r\n* (optional) Set an environment variable to your instrumentation key\r\n    \r\n    ```\r\n    set APPINSIGHTS_INSTRUMENTATIONKEY=<insert_your_instrumentation_key_here>\r\n    ```\r\n* Run tests\r\n    \r\n    ```\r\n    npm test\r\n    ```\r\n\r\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\r\n",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/Microsoft/ApplicationInsights-node.js.git"
  },
  "scripts": {
    "prepublish": "tsc --module commonjs --declaration applicationinsights.ts",
    "pretest": "find Tests -type f -name \"*.ts\" | xargs tsc --module commonjs",
    "test": "./node_modules/mocha/bin/mocha ./Tests --recursive"
  },
  "version": "0.18.0"
}
