Prometheus instrumentation library for Go applications
Go to file
Matt T. Proud 5ea9b1a0b5 - Improved comments throughout the package.
- Added normal and exponential distributions to one of the examples.
- Improved the naming of a couple of local variables.
- Handled an error in the AccumulatingBucket ValueForIndex function whereby
  the vestigal old behavior was accidentally preserved and not updated.
  This could have been caught had the tests been updated first.
- Simplify Histogram prospectiveIndexForPercentile such that various
  small tasks it performs are extracted into separate functions for easier
  testing and code comprehension.
- Remedy a regression in Histogram prospectiveIndexForPercentile whereby
  the prospective index may have included the terminating element of a
  bucket.
- Provide help for Histogram prospectiveIndexForPercentile such that requesting
  the terminating element of a bucket will fast-forward to the first element of
  the next non-empty bucket.
- Fix TallingBucket's boundary constant, because they were originally keyed toward
  percentages [0, 100], not decimal-based ones.  The antique tests had been
  temporarily commented out, which prevented this regression from being exposed.
2012-05-22 09:20:09 +02:00
examples - Improved comments throughout the package. 2012-05-22 09:20:09 +02:00
maths Initial commit into version control. 2012-05-19 23:59:25 +02:00
metrics - Improved comments throughout the package. 2012-05-22 09:20:09 +02:00
utility Initial commit into version control. 2012-05-19 23:59:25 +02:00
.gitignore Initial commit into version control. 2012-05-19 23:59:25 +02:00
.travis.yml Incorporate the Travis-CI (continuous integration) configuration such 2012-05-20 00:00:39 +02:00
LICENSE Initial commit into version control. 2012-05-19 23:59:25 +02:00
README.md - Provide an example of this working with a uniform distribution. 2012-05-21 11:05:41 +02:00
TODO Initial commit into version control. 2012-05-19 23:59:25 +02:00
registry.go - Improved comments throughout the package. 2012-05-22 09:20:09 +02:00

README.md

Overview

This Go package is an extraction of a piece of instrumentation code I whipped-up for a personal project that a friend of mine and I are working on. We were in need for some rudimentary statistics to observe behaviors of the server's various components, so this was written.

The code here is not a verbatim copy thereof but rather a thoughtful re-implementation should other folks need to consume and analyze such telemetry.

N.B. --- I have spent a bit of time working through the model in my head and probably haven't elucidated my ideas as clearly as I need to. If you examine examples/{simple,uniform_random}/main.go and registry.go, you'll find several examples of what types of potential instrumentation use cases this package addresses. There are probably numerous Go language idiomatic changes that need to be made, but this task has been deferred for now.

Continuous Integration

Build Status

Metrics

A metric is a measurement mechanism.

Gauge

A Gauge is a metric that exposes merely an instantaneous value or some snapshot thereof.

Histogram

A Histogram is a metric that captures events or samples into buckets. It exposes its values via percentile estimations.

Buckets

A Bucket is a generic container that collects samples and their values. It prescribes no behavior on its own aside from merely accepting a value, leaving it up to the concrete implementation to what to do with the injected values.

Accumulating Bucket

An Accumulating Bucket is a bucket that appends the new sample to a timestamped priority queue such that the eldest values are evicted according to a given policy.

Eviction Policies

Once an Accumulating Bucket reaches capacity, its eviction policy is invoked. This reaps the oldest N objects subject to certain behavior.

Remove Oldest

This merely removes the oldest N items without performing some aggregation replacement operation on them.

Aggregate Oldest

This removes the oldest N items while performing some summary aggregation operation thereupon, which is then appended to the list in the former values' place.

Tallying Bucket

A Tallying Bucket differs from an Accumulating Bucket in that it never stores any of the values emitted into it but rather exposes a simplied summary representation thereof. For instance, if a values therein is requested, it may situationally emit a minimum, maximum, an average, or any other reduction mechanism requested.

Testing

This package employs gocheck for testing. Please ensure that all tests pass by running the following from the project root:

$ go test ./...