-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Prometheus #150
Add support for Prometheus #150
Conversation
…o on the received and sent data and to use the wall clock time for the last update timestamp
…ia a program_get_context function
…otocol in use is redis
…-to-support-the-basic-scraping-of-the-metrics-via-the-text-protocol
Codecov Report
@@ Coverage Diff @@
## main #150 +/- ##
==========================================
+ Coverage 80.18% 80.72% +0.54%
==========================================
Files 87 88 +1
Lines 5193 5515 +322
==========================================
+ Hits 4164 4452 +288
- Misses 1029 1063 +34
Continue to review full report at Codecov.
|
This pull request introduces 1 alert when merging 689b70a into dc16335 - view on LGTM.com new alerts:
|
This PR implements a new module in cachegrand to support Prometheus, a well known and widely used monitoring and time series database.
The new module relies on http_parser, from the nodejs project, to process the http requests, and provides the metrics under the /metrics end point and a generic 404 not found error page for all the other URLs.
The error page is statically built-in and can't be modified, currently it doesn't make too much sense to expose this kind of configuration as this module doesn't provide a fully flagged http webserver (e.g. able to provide static content from the disk).
The module expose all the available internal statistics provided by cachegrand, for the occasion these have actually need expanded to include metrics related to the amount of data sent and received, not only in terms of packets but also of bytes, and to provide an uptime.
Two groups of metrics are offered, total counters and per minute counters. so scraping the data each minute is enough to do not lose any data.
The module doesn't support any special metric type apart from the basic counters (e.g. percentiles, etc.).
To give as much flexibility as possible, the module will search for environment variables prefixed with
CACHEGRAND_METRIC_ENV_
and use these as labels, so an env variable calledCACHEGRAND_METRIC_ENV_ORGANIZATION=example.org
will become a label calledorganization
with valueexample.org
.The example configuration has been updated to include a commented out example of the necessary parameters to enable the module, the prometheus documentation has been updated to provide as much information are possible and some basic tests are included in the PR as well.
Below an example of the metrics provided with 2 labels provided via environment variables
Closes #149