Welcome to Thoth's metrics-exporter documentation
This is a Promotheus Metrics exporter for Thoth.
- Create a
.env
file from the.env.template
. - Once you have populated all the values for
.env
, follow up withpipenv install --dev
. oc login
into the Openshift cluster.- Run the local version of
thoth-storages
after restoring the dump - guide. (or connect to the production db using replacing the env variables in.env
). - Run the metrics exporter using
pipenv run python3 wsgi.py
- You should see metrics in localhost:8080.
- Add the metric you want to expose to metrics.py. The metric types stated here adhere to the Prometheus client library core metric types, and are mentioned here in detail.
- Checkout metrics_exporter/jobs, if the metric you want to add belongs to a existing class add to it else create a new class and inherit the base class
MetricsBase
. - Register the metric method you write using the decorator
@register_metric_job
. Here is an example to look at. - Set the metric variable value from
metrics.py
in the method that you define. More, on that here on prometheus documentation. - Finally if you have a new class added in jobs, add it to the init.py.
For any binary metrics the convention used is:
0
all good1
alarm is required
Copyright (C) 2018, 2019, 2020, 2021, 2022 Red Hat Inc.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
The GNU General Public License is provided within the file LICENSE.