Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
dogear
Advanced tools
Readme
A hapi plugin for sending request round trip metrics and server ops metrics to a statsd-compliant service (Datadog, InfluxDB's Telegraf, etc) and also exposes an expanded statsd client to the server.
This plugin started life as a fork of hapi-statsd and has evolved since then. Thanks to Mac Angell for his hard work on hapi-statsd!
NOTE:
$ npm install --save dogear
#or
$ yarn add dogear
To install this plugin on your hapi server, do something similar to this:
const hapi = require('@hapi/hapi');
const server = new hapi.Server();
const dogearOptions = {}
await server.register({
plugin: require('dogear'),
options: dogearOptions
});
await server.start();
The plugin accepts multiple optional configuration parameters to customize its behavior.
statsdConfig
Optional initialization parameters for the statsd client:
host
- The host to send stats to default: localhost
port
- The port to send stats to default: 8125
prefix
- What to prefix each stat name with default: 'hapi.'
suffix
- What to suffix each stat name with default: ''
globalize
- Expose this StatsD instance globally? default: false
cacheDns
- Cache the initial dns lookup to host default: false
mock
- Create a mock StatsD instance, sending no stats to the server? default: false
globalTags
- Tags that will be added to every metric default: []
maxBufferSize
- If larger than 0, metrics will be buffered and only sent when the string length is greater than the size. default: 0
bufferFlushInterval
- If buffering is in use, this is the time in ms to always flush any buffered metrics. default: 1000
telegraf
- Use Telegraf's StatsD line protocol, which is slightly different than the rest default: false
errorHandler
- A function with one argument. It is called to handle various errors. default: none
, errors are thrown/logger to consoleopsInterval
How often the server will send operational stats. Defaults to 1000
. If set to null
or <= 0
, the plugin will not report operational metrics.
opsMetrics
An array of strings represeting the operational metrics to report. Allowed values:
os.load.1
- One minute average of server CPU loados.load.5
- Five minute average of server CPU loados.load.15
- Fifteen minute average of server CPU loadproc.uptime
- Uptime for hapi server processproc.mem.rss
- Amount of memory set aside for hapi server process (Learn More)proc.mem.heapTotal
- Heap memory allocated for hapi server processproc.mem.heapUsed
- Heap memory used by hapi server processproc.delay
- Current event queue delayDefaults to an array containing all the above.
A hapi route configured like this:
server.route({
method: 'GET',
path: '/test/{param}',
handler: () => 'Success!'
});
would send increment stats to statsd with the following names:
hapi.request.status.200
hapi.request.received
and a timing stat named:
hapi.request.response_time
if the statsd server supports tags, it will also receive the following tags (in addition to any global tags):
path:/test/{param}
method:GET
status:200
As the statsd client is also exposed to the hapi server, you can use any of its methods, e.g.:
server.statsd.increment('systemname.subsystem.value');
server.statsd.gauge('what.you.gauge', 100);
server.statsd.set('your.set', 200);
server.statsd.histogram('timing.metric', 235, [ 'tags' ]);
This project is licensed under the MIT license. See the LICENSE file for more info.
FAQs
A hapi plugin for sending expanded metrics to statsd-compliant services
The npm package dogear receives a total of 311 weekly downloads. As such, dogear popularity was classified as not popular.
We found that dogear demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.