prometheus-extended-gauge
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

prometheus-extended-gauge

CircleCI codecov

What's the problem this helps solve?

prometheus, as well as many other metrics collection frameworks, offers some basic constructs for gathering stats: Counters, Gauges, Histograms and Summaries.

The problem is that Gauges are sampled every time that Prometheus scrapes the stats, but there may be a lot of activity that is missed. Especially if the gauge changes a lot (e.g. # of active connections in a connection pool).

In this case, there may be spikes that are overlooked in the sampling. This is where the ExtendedGauge comes in handy. It is a drop-in replacement for a normal Prometheus Gauge with the exception that it keeps a moving time window that you can configure and it can expose the max, min and average value of the gauge in that moving time window (as Gauges).

The moving time window is implemented using a circular buffer where you have a certain number of buckets, each for a period of time. So, for example, you could specify to have 60 buckets of 1000ms each to have a moving time window of 1 minute with a granularity of 1 second.

You can configure the moving time window by setting:

  • bucketSizeMillis: The size of a bucket in millisencods (defaults to 1024ms)
  • numBuckets: The number of buckets to keep

Dependents (1)

Package Sidebar

Install

npm i prometheus-extended-gauge

Weekly Downloads

1

Version

0.1.2

License

Apache-2.0

Unpacked Size

40.6 kB

Total Files

17

Last publish

Collaborators

  • pragone