opencensusz
TypeScript icon, indicating that this package has built-in type declarations

0.0.5-beta.4 • Public • Published

Opencensusz

Opencensusz is a thin wrapper around the Opencensus Node.js metrics library to make it easier to add metrics.

This API is inspired by Google's internal cross-language metrics library and the name Opencensusz is an homage to it.

Usage

Regular Prometheus (poll-based)

const mBarStatus = new Counter(
  'foo/server/bar_status',
  'Bar status',
  ['status']
)
 
const mBarTime = new Distribution(
  'foo/server/bar_time_millis',
  'Time to bar',
  ['type'],
  [1, 2, 3, 4, 5, 6].map(n => 10**n),
  MeasureUnit.MS
)
 
 
mBarStatus.increment({ status: 'OK' })

Prometheus PushGateway (push-based)

Set environment variable:

PUSH_GATEWAY_ENDPOINT=http://localhost:9091

Counters:

const mErrors = new PushCounter('errors', 'General errrs', 'frontend_server')
await mErrors.increment({error: 'Invalid input'})

Convenience function for logging heartbeat timestamps:

await PulseHeartbeat('api_server', 'prod')

Readme

Keywords

none

Package Sidebar

Install

npm i opencensusz

Weekly Downloads

0

Version

0.0.5-beta.4

License

none

Unpacked Size

24 kB

Total Files

17

Last publish

Collaborators

  • jpvx