Skip to content

thoth-station/metrics-exporter

Repository files navigation

Thoth Metrics Expoter

Welcome to Thoth's metrics-exporter documentation

GitHub tag (latest by date) Quay - Build

This is a Promotheus Metrics exporter for Thoth.

Setting up Metrics Exporter locally

  1. Create a .env file from the .env.template.
  2. Once you have populated all the values for .env, follow up with pipenv install --dev.
  3. oc login into the Openshift cluster.
  4. 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).
  5. Run the metrics exporter using pipenv run python3 wsgi.py
  6. You should see metrics in localhost:8080.

Adding new metrics to be exported

  1. 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.
  2. 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.
  3. Register the metric method you write using the decorator @register_metric_job. Here is an example to look at.
  4. Set the metric variable value from metrics.py in the method that you define. More, on that here on prometheus documentation.
  5. Finally if you have a new class added in jobs, add it to the init.py.

Conventions

For any binary metrics the convention used is:

  • 0 all good
  • 1 alarm is required

Copyright

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.