Repository URL to install this package:
|
Version:
1.4.0-1470329130 ▾
|
{
"_args": [
[
"applicationinsights@https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.15.6.tgz",
"/vso/work/2/s"
]
],
"_from": "applicationinsights@0.15.6",
"_id": "applicationinsights@0.15.6",
"_inCache": true,
"_location": "/applicationinsights",
"_phantomChildren": {},
"_requested": {
"name": "applicationinsights",
"raw": "applicationinsights@https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.15.6.tgz",
"rawSpec": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.15.6.tgz",
"scope": null,
"spec": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.15.6.tgz",
"type": "remote"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.15.6.tgz",
"_shasum": "201a0682c0704fe4bdd9a92d0b2cbe34d2ae5972",
"_shrinkwrap": null,
"_spec": "applicationinsights@https://registry.npmjs.org/applicationinsights/-/applicationinsights-0.15.6.tgz",
"_where": "/vso/work/2/s",
"bugs": {
"url": "https://github.com/Microsoft/ApplicationInsights-node.js/issues"
},
"contributors": [
{
"email": "scsouthw@microsoft.com",
"name": "scsouthw"
},
{
"email": "bogdanbe@microsoft.com",
"name": "bogdanbe"
}
],
"dependencies": {},
"description": "Microsoft Application Insights module for Node.JS",
"devDependencies": {
"async": "^0.9.0",
"chai": "^2.3.0",
"mocha": "^2.2.4",
"node-mocks-http": "^1.2.3",
"sinon": "^1.14.1",
"typescript": "^1.0.1"
},
"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[](http://badge.fury.io/js/applicationinsights)\r\n[](https://travis-ci.org/Microsoft/ApplicationInsights-node.js)\r\n\r\n\r\n\r\nThis 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. \r\n\r\n\r\n\r\n\r\n## Requirements ##\r\n**Install**\r\n```\r\nnpm install applicationinsights\r\n```\r\n**Get an instrumentation key**\r\n>**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.\r\n\r\n\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```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#####Disabling auto-collection#####\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\r\n\r\n#####Using multiple instrumentaion keys#####\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\r\n\r\n#####Custom monitoring#####\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\r\n\r\n#####Example with manual request tracking of all \"GET\" requests#####\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\r\n\r\n## Contributing ##\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",
"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.15.6"
}