{"_id":"@pm2/opencensus-core","_rev":"3-541abc418a1a43e10a261f657fceeff1","name":"@pm2/opencensus-core","dist-tags":{"latest":"0.0.9"},"versions":{"0.0.9":{"name":"@pm2/opencensus-core","version":"0.0.9","description":"OpenCensus is a toolkit for collecting application performance and behavior data.","main":"build/src/index.js","types":"build/src/index.d.ts","repository":{"type":"git","url":"git+https://github.com/census-instrumentation/opencensus-node.git"},"scripts":{"test":"nyc mocha build/test/**/*.js","codecov":"nyc report --reporter=json && codecov -f coverage/*.json","clean":"rimraf build/*","check":"gts check","compile":"tsc -p .","compile:release":"tsc -p tsconfig-release.json","fix":"gts fix","prepare":"npm run compile:release","pretest":"npm run compile","posttest":"npm run check"},"keywords":["opencensus","nodejs","tracing","profiling"],"author":{"name":"Google Inc."},"license":"Apache-2.0","engines":{"node":">=6.0"},"publishConfig":{"access":"public"},"devDependencies":{"@types/continuation-local-storage":"^3.2.1","@types/mocha":"^5.2.5","@types/node":"^10.12.12","@types/once":"^1.4.0","@types/semver":"^5.5.0","@types/shimmer":"^1.0.1","@types/uuid":"^3.4.3","codecov":"^3.1.0","gts":"^0.9.0","intercept-stdout":"^0.1.2","mocha":"^5.0.4","ncp":"^2.0.0","nyc":"13.1.0","ts-node":"^7.0.1","typescript":"~2.9.0"},"dependencies":{"continuation-local-storage":"^3.2.1","log-driver":"^1.2.7","semver":"^5.5.0","shimmer":"^1.2.0","uuid":"^3.2.1"},"contributors":[{"name":"Google LLC"},{"name":"CESAR Team","url":"www.cesar.org.br"}],"bugs":{"url":"https://github.com/census-instrumentation/opencensus-node/issues"},"homepage":"https://github.com/census-instrumentation/opencensus-node#readme","_id":"@pm2/opencensus-core@0.0.9","_npmVersion":"6.4.1","_nodeVersion":"8.15.0","_npmUser":{"name":"tknew","email":"strzelewicz.alexandre@gmail.com"},"dist":{"integrity":"sha512-tSeIjxa6dvISlrXnuacMdBmOpscSFs26K3bqJhdBeDPzBRnewL/PHgR3gJ2FWcAQJW8NYrW1FQLbEzxb3WAStg==","shasum":"ef046ccfa6fe68b3ee33096e92c5c6484cc70c7d","tarball":"https://registry.npmjs.org/@pm2/opencensus-core/-/opencensus-core-0.0.9.tgz","fileCount":99,"unpackedSize":268283,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWWExCRA9TVsSAnZWagAAQN4P/0v/dOBKXilmOsQ0LICe\nZLTKjYQeJsN4A8lRbA3Gy3eCSM18GHvJoNyiNv85PCwPu8XUIKnAttW+E50R\nLFCeIyPB64HsNHazsM5MIN/aIeeu5/dV5p1r9LC06FA28X+8LKNs5mT6U0+t\nmFycNXDZF7nuj6qw51RxCJKIRyM74mV8T5NOVYM2BuN+o68if5hVI0Ub2xZt\n8pslA2QB10TP+l6X2TKkfD7WFCMo63CpEl/99RNP1x2lGp+XfriL630a5hnT\ndwti/76yYxv6HCwQqKFZusQP1Pr5pH/IhBH/DYup3pYB8vpFxJa/7pJM0iis\njJDrptbLragZ6jZPKsHAKlvVvcXMaTuVtyNeoMKRtM4shWX2lkqRT4DortPF\n4R0zBV/hAZeBmymBlUfbwwsPqwjaZRhdLQMhoPWGB8ap42x1cG+Kp3Spo75L\n/f7wbNgne0R6dzn5s6jqZjtNNfwXMiqLo0sdecoKanvAZ19LuMMuLmdgcN6m\nn+XvCnZyw4xftOSY5Z3jZOTlaavfQiaVCSuTSp1+XIp+QBgGZVmtBuzNZgzx\nUjGHY5CeStVwDC9pnRUy3Pr2E5nvp5yqeugqHJd8FkMeM3V5tJkluzu0wSQF\nchMO3op9I0wQauzGRT2C3BQoIlJ2VcYmnL03Yz0XXyclZwmSqag1nnZZoch7\nslok\r\n=5oHU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBP89HMktjD73y4ZG8DJ32Rdm1UcrRXxcvDG3Zc6S/2AAiB2BR20hhONS9I8i4ZaYEMAHBUH4IyfUiNxQNmITURx5A=="}]},"maintainers":[{"name":"keymetrics_bot","email":"tech@keymetrics.io"},{"name":"eywek","email":"contact@eywek.fr"},{"name":"vmarchaud","email":"contact@vmarchaud.fr"},{"name":"tknew","email":"strzelewicz.alexandre@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/opencensus-core_0.0.9_1549361456813_0.7935751912476201"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-05T10:10:56.663Z","0.0.9":"2019-02-05T10:10:56.930Z","modified":"2022-04-06T15:29:38.695Z"},"maintainers":[{"email":"tech@keymetrics.io","name":"keymetrics_bot"},{"email":"strzelewicz.alexandre@gmail.com","name":"tknew"}],"description":"OpenCensus is a toolkit for collecting application performance and behavior data.","homepage":"https://github.com/census-instrumentation/opencensus-node#readme","keywords":["opencensus","nodejs","tracing","profiling"],"repository":{"type":"git","url":"git+https://github.com/census-instrumentation/opencensus-node.git"},"contributors":[{"name":"Google LLC"},{"name":"CESAR Team","url":"www.cesar.org.br"}],"author":{"name":"Google Inc."},"bugs":{"url":"https://github.com/census-instrumentation/opencensus-node/issues"},"license":"Apache-2.0","readme":"# OpenCensus Core Node.js\n[![Gitter chat][gitter-image]][gitter-url] ![Node Version][node-img] [![NPM Published Version][npm-img]][npm-url] ![dependencies Status][dependencies-status] ![devDependencies Status][devdependencies-status] ![Apache License][license-image]\n\nOpenCensus for Node.js is an implementation of OpenCensus, a toolkit for collecting application performance and behavior monitoring data. It currently includes 3 apis: stats, tracing and tags.\n\nThe library is in alpha stage and the API is subject to change.\n\n## Installation\n\nInstall the opencensus-core package with NPM:\n```bash\nnpm install @opencensus/core\n```\n\n## Usage\n\n#### Set up a new Stats manager instance.\n\nTo enable metrics, we’ll import a few items from OpenCensus Core package.\n\n```javascript\nconst { Stats, MeasureUnit, AggregationType } = require('@opencensus/core');\n\n// Create the Stats manager\nconst stats = new Stats();\n\n// The latency in milliseconds\nconst mLatencyMs = stats.createMeasureDouble(\n  \"repl/latency\",\n  MeasureUnit.MS,\n  \"The latency in milliseconds\"\n);\n```\n\n#### Create Views and Tags:\n\nWe now determine how our metrics will be organized by creating ```Views```. We will also create the variable needed to add extra text meta-data to our metrics – ```methodTagKey```, ```statusTagKey```, and ```errorTagKey```.\n\n```javascript\nconst methodTagKey = \"method\";\nconst statusTagKey = \"status\";\nconst errorTagKey = \"error\";\n\nconst latencyView = stats.createView(\n  \"demo/latency\",\n  mLatencyMs,\n  AggregationType.DISTRIBUTION,\n  [methodTagKey, statusTagKey, errorTagKey],\n  \"The distribution of the latencies\",\n  // Bucket Boundaries:\n  // [>=0ms, >=25ms, >=50ms, >=75ms, >=100ms, >=200ms, >=400ms, >=600ms, >=800ms, >=1s, >=2s, >=4s, >=6s]\n  [0, 25, 50, 75, 100, 200, 400, 600, 800, 1000, 2000, 4000, 6000]\n);\n```\n\n#### Recording Metrics:\n\nNow we will record the desired metrics. To do so, we will use ```stats.record()``` and pass in measurements.\n\n```javascript\nconst [_, startNanoseconds] = process.hrtime();\nconst tags = {method: \"repl\", status: \"OK\"};\n\nstats.record({\n  measure: mLatencyMs,\n  tags,\n  value: sinceInMilliseconds(startNanoseconds)\n});\n\n\nfunction sinceInMilliseconds(startNanoseconds) {\n  const [_, endNanoseconds] = process.hrtime();\n  return (endNanoseconds - startNanoseconds) / 1e6;\n}\n```\n\nSee [Quickstart/Metrics](https://opencensus.io/quickstart/nodejs/metrics/) for a full example of registering and collecting metrics.\n\n## Useful links\n- For more information on OpenCensus, visit: <https://opencensus.io/>\n- To checkout the OpenCensus for Node.js, visit: <https://github.com/census-instrumentation/opencensus-node>\n- For help or feedback on this project, join us on [gitter](https://gitter.im/census-instrumentation/Lobby)\n\n[gitter-image]: https://badges.gitter.im/census-instrumentation/lobby.svg\n[gitter-url]: https://gitter.im/census-instrumentation/lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n[npm-url]: https://www.npmjs.com/package/@opencensus/core\n[npm-img]: https://badge.fury.io/js/%40opencensus%2Fcore.svg\n[node-img]: https://img.shields.io/node/v/@opencensus/core.svg\n[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat\n[dependencies-status]: https://david-dm.org/census-instrumentation/opencensus-node/status.svg?path=packages/opencensus-core\n[devdependencies-status]:\nhttps://david-dm.org/census-instrumentation/opencensus-node/dev-status.svg?path=packages/opencensus-core\n\n## LICENSE\n\nApache License 2.0\n","readmeFilename":"README.md"}