Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/risto-stevcev/statsd-mongoose
:chart_with_upwards_trend: A statsd client for mongoose
https://github.com/risto-stevcev/statsd-mongoose
client mongo mongodb mongoose statsd
Last synced: 14 days ago
JSON representation
:chart_with_upwards_trend: A statsd client for mongoose
- Host: GitHub
- URL: https://github.com/risto-stevcev/statsd-mongoose
- Owner: Risto-Stevcev
- License: mit
- Created: 2016-03-20T05:23:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-20T06:14:18.000Z (almost 9 years ago)
- Last Synced: 2024-12-19T13:12:42.610Z (29 days ago)
- Topics: client, mongo, mongodb, mongoose, statsd
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/statsd-mongoose
- Size: 261 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# statsd-mongoose
[![Build Status](https://travis-ci.org/Risto-Stevcev/statsd-mongoose.svg)](https://travis-ci.org/Risto-Stevcev/statsd-mongoose)
[![Coverage Status](https://coveralls.io/repos/github/Risto-Stevcev/statsd-mongoose/badge.svg?branch=master)](https://coveralls.io/github/Risto-Stevcev/statsd-mongoose?branch=master):chart_with_upwards_trend: A statsd client for mongoose
## Usage
```js
const mongoose = require('mongoose')
, statsdMongoose = require('statsd-mongoose')mongoose.connect('mongodb://some.mongo.uri:1234/db-name')
mongoose.plugin(statsdMongoose)
```## Options
`host` - The statsd hostname (default: `'localhost'`)
`post` - The statsd port (default: `8125`)
`ns` - The function that gets called to generate the namespace. It binds `this` from the mongoose `pre` and `post` middleware, and passes in the `model` and `method` names as parameters. (default: ``(model, method) => `db.${model.toLowerCase()}.${method}` ``)## How It Works
The plugin uses the statsd [lynx](https://www.npmjs.com/package/lynx) client to create `timer` metrics with mongoose `pre` and `post` middleware to record start/finish times.
Metrics are namespaced as `db.[collection-name].[method-name]`. See the [docs](http://risto-stevcev.github.io/statsd-mongoose/docs/statsd-mongoose.html) for more info.## License
Licensed under the MIT license.