{"id":13780081,"url":"https://github.com/koajs/trace-influxdb","last_synced_at":"2025-10-19T13:31:27.169Z","repository":{"id":25418713,"uuid":"28847935","full_name":"koajs/trace-influxdb","owner":"koajs","description":"InfluxDB tracing for koa-trace","archived":false,"fork":false,"pushed_at":"2016-01-26T20:58:45.000Z","size":4,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-29T15:32:18.680Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koajs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-06T05:15:24.000Z","updated_at":"2024-07-21T00:15:08.000Z","dependencies_parsed_at":"2022-07-24T05:31:59.759Z","dependency_job_id":null,"html_url":"https://github.com/koajs/trace-influxdb","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Ftrace-influxdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Ftrace-influxdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Ftrace-influxdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Ftrace-influxdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koajs","download_url":"https://codeload.github.com/koajs/trace-influxdb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237133584,"owners_count":19260505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T18:01:12.141Z","updated_at":"2025-10-19T13:31:26.879Z","avatar_url":"https://github.com/koajs.png","language":"JavaScript","funding_links":[],"categories":["Middleware"],"sub_categories":[],"readme":"\n# koa-trace-influxdb\n\n[![NPM version][npm-image]][npm-url]\n[![Build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![Dependency Status][david-image]][david-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n[![Gittip][gittip-image]][gittip-url]\n\nTracing for [koa-trace](https://github.com/koajs/trace) using [influxdb-udp](https://github.com/jonathanong/node-influxdb-udp).\n\n## Usage\n\n```js\nvar app = koa();\nrequire('koa-trace')(app);\n\nvar traceInflux = require('koa-trace-influxdb');\napp.instrument(traceInflux({\n  port: 4444,\n  host: '127.0.0.1'\n}));\n\napp.use(function* (next) {\n  // set an ID for every request.\n  // optionally, make this a request UUID\n  this.id = '1234';\n\n  // optionally set properties to add to all traces\n  this.traces = {\n    user_id: this.session.user_id.toString('hex')\n  };\n\n  // trace something\n  this.trace('start')\n})\n```\n\nThis will create a time series called `trace.start`.\nThus, it tracks each event as a separate series.\nYou probably want to track the elapsed time.\n\n```js\napp.use(function* (next) {\n  var start = Date.now();\n\n  yield* next;\n\n  this.trace('response-time', {\n    elapsed: Date.now() - start\n  });\n});\n```\n\nYou may want to build your own helper for this.\n\n## Options\n\n- `host`\n- `port`\n- `prefix` - prefix to add to all the series, defaulting to `trace.`.\n  If you don't want any prefixes, set it as `''`.\n\n## Limitations\n\n- The trace arguments must only be a single object, if anything at all.\n- UDP is used underneath, so you may lose events.\n  There is no error reporting for logging these.\n\n[gitter-image]: https://badges.gitter.im/koajs/trace-influxdb.png\n[gitter-url]: https://gitter.im/koajs/trace-influxdb\n[npm-image]: https://img.shields.io/npm/v/koa-trace-influxdb.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/koa-trace-influxdb\n[github-tag]: http://img.shields.io/github/tag/koajs/trace-influxdb.svg?style=flat-square\n[github-url]: https://github.com/koajs/trace-influxdb/tags\n[travis-image]: https://img.shields.io/travis/koajs/trace-influxdb.svg?style=flat-square\n[travis-url]: https://travis-ci.org/koajs/trace-influxdb\n[coveralls-image]: https://img.shields.io/coveralls/koajs/trace-influxdb.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/koajs/trace-influxdb\n[david-image]: http://img.shields.io/david/koajs/trace-influxdb.svg?style=flat-square\n[david-url]: https://david-dm.org/koajs/trace-influxdb\n[license-image]: http://img.shields.io/npm/l/koa-trace-influxdb.svg?style=flat-square\n[license-url]: LICENSE\n[downloads-image]: http://img.shields.io/npm/dm/koa-trace-influxdb.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/koa-trace-influxdb\n[gittip-image]: https://img.shields.io/gratipay/jonathanong.svg?style=flat-square\n[gittip-url]: https://gratipay.com/jonathanong/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoajs%2Ftrace-influxdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoajs%2Ftrace-influxdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoajs%2Ftrace-influxdb/lists"}