In #286, I attempted to fix a broken readme TOC link, but I didn't check the result closely and left it still broken 🤦 The correct anchor is `histogram---custom-buckets` (3 hyphens).
* Update activerecord collector
* Add extra AR collector test
* Add expiration test for resque collector
* Add process collector test file
* Adds the basic process collection tests (individually for the collector class)
* Fixes hostname collection (hostname was previously ignored, see #272 for details)
* Add unicorn collector test
* Handle stale sidekiq queue and process metrics
* Refactor sidekiq collectors to use metrics container with auto-expiration of data
* Fix linting issues
* Clarify wrap_expire method
Redis 5 gem introduces redis_client as the low level transport method
We no longer patch Redis gem if we detect it is version 5 and above and
instead use the supported middleware interface to patch it.
Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
The documentation advises that a custom collector should inherit from
`PrometheusExporter::Server::BaseCollector` and the example in the docs
does so. The code example inherits from `Collector` instead. We found
this seemed to work in development but would behave unreliably in
production. This change updates the example to match the code snippet in
the Readme.
* Pass msg hash to Sidekiq jobs custom_labels function
The hash only gets passed if the function expects > 0
arguments. This avoids a breaking change with the
previous version where a custom_labels function on a
worker class didn't take any arguments
* Fix weird formatting in collector test
* Add TODO to remove arity check after next major version
* FIX: ensure threads do not leak when #start is called
Periodic instrumentation now follows a general pattern where they
inherit from PeriodicStats.
This implementation ensures proper management of backing thread
1. All classes inheriting now have a .started? method to determine
if instrument is started
2. All classes implement a clean .stop method for stopping active
periodic instrumentation
3. Consumers of the class get to write less code repeat code due
to worker_loop
* Added per-worker custom labels to sidekiq metrics
If a worker class a a custom_labels method then its
return value will be merged with any global custom
labels and attached to its exported sidekiq metrics
* Do not include status label everywhere
The `status` label is included in every metrics, and not only in
`http_requests_total`, even though the README states that
```
All metrics have a `controller` and an `action` label.
`http_requests_total` additionally has a (HTTP response) `status` label.
```
This can be a problem as this `status` label can quickly increase the
cardinality of the metrics.
* Explicitly add label instead if removing it