An open API service indexing awesome lists of open source software.

https://github.com/eggjs/egg-lookout

SOFALookout plugin for egg
https://github.com/eggjs/egg-lookout

egg-plugin eggjs lookout sofalookout

Last synced: about 2 months ago
JSON representation

SOFALookout plugin for egg

Awesome Lists containing this project

README

          

# egg-lookout
SOFALookout plugin for egg framework

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/egg-lookout.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-lookout
[travis-image]: https://img.shields.io/travis/eggjs/egg-lookout.svg?style=flat-square
[travis-url]: https://travis-ci.org/eggjs/egg-lookout
[codecov-image]: https://codecov.io/gh/eggjs/egg-lookout/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/eggjs/egg-lookout
[david-image]: https://img.shields.io/david/eggjs/egg-lookout.svg?style=flat-square
[david-url]: https://david-dm.org/eggjs/egg-lookout
[snyk-image]: https://snyk.io/test/npm/egg-lookout/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-lookout
[download-image]: https://img.shields.io/npm/dm/egg-lookout.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-lookout

[SOFALookout](https://github.com/alipay/sofa-lookout) plugin for egg framework

## Install

```bash
$ npm i egg-lookout --save
```

## Usage

### Enable the plugin

Change `${app_root}/config/plugin.js` to enable SOFALookout plugin:

```js
exports.lookout = {
enable: true,
package: 'egg-lookout',
};
```

### Configuration

```js
exports.lookout = {
agentHost: 'lookout server host',
agentPort: 7200,
maxMetricNum: 3000,
reportBatchSize: 1700,
compressThreshold: 100,
autoPoll: true,
};
```

- `agentHost`: the report service host
- `agentPort`: the report service port
- `maxMetricNum`: the maxinum number of metrics that can be created, default value is 3000
- `reportBatchSize`: the number of items reported to server at one time, default value is 1700
- `compressThreshold`: sets the minimum block size for which compression is to occur
- `autoPoll`: whether report to server automatically

## Example

You can access to lookout APIs by using app.lookout. More detail please refer to [sofa-lookout-node](https://github.com/alipay/sofa-lookout-node)

```js
const id = app.lookout.createId('http_request_count');
const counter = app.lookout.counter(id);
counter.inc();
```

## How to Contribute

Please let us know how can we help. Do check out [issues](https://github.com/eggjs/egg/issues) for bug reports or suggestions first.

To become a contributor, please follow our [contributing guide](https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md).

## License

[MIT](LICENSE)