{"id":22574868,"url":"https://github.com/thoth-station/metrics-exporter","last_synced_at":"2025-08-02T07:39:25.272Z","repository":{"id":39839417,"uuid":"153481575","full_name":"thoth-station/metrics-exporter","owner":"thoth-station","description":"This is a Prometheus exporter for Thoth.","archived":false,"fork":false,"pushed_at":"2023-10-04T01:40:43.000Z","size":2509,"stargazers_count":2,"open_issues_count":9,"forks_count":10,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-10T16:31:56.182Z","etag":null,"topics":["artificial-intelligence","hacktoberfest","thoth"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thoth-station.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-10-17T15:36:18.000Z","updated_at":"2023-01-31T17:06:04.000Z","dependencies_parsed_at":"2025-04-10T16:11:21.710Z","dependency_job_id":"051f4c66-b882-4243-af84-d73fd1966069","html_url":"https://github.com/thoth-station/metrics-exporter","commit_stats":null,"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"purl":"pkg:github/thoth-station/metrics-exporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoth-station%2Fmetrics-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoth-station%2Fmetrics-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoth-station%2Fmetrics-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoth-station%2Fmetrics-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thoth-station","download_url":"https://codeload.github.com/thoth-station/metrics-exporter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoth-station%2Fmetrics-exporter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266261119,"owners_count":23901284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artificial-intelligence","hacktoberfest","thoth"],"created_at":"2024-12-08T03:08:15.030Z","updated_at":"2025-07-21T07:31:50.981Z","avatar_url":"https://github.com/thoth-station.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Thoth Metrics Expoter\n---------------------\n\nWelcome to Thoth's metrics-exporter documentation\n\n.. image:: https://img.shields.io/github/v/tag/thoth-station/metrics-exporter?style=plastic\n  :target: https://github.com/thoth-station/metrics-exporter/tags\n  :alt: GitHub tag (latest by date)\n\n.. image:: https://quay.io/repository/thoth-station/metrics-exporter/status\n  :target: https://quay.io/repository/thoth-station/metrics-exporter?tab=tags\n  :alt: Quay - Build\n\nThis is a Promotheus Metrics exporter for Thoth.\n\nSetting up Metrics Exporter locally\n===================================\n\n1. Create a ``.env`` file from the ``.env.template``.\n2. Once you have populated all the values for ``.env``, follow up with ``pipenv install --dev``.\n3. ``oc login`` into the Openshift cluster.\n4. Run the local version of ``thoth-storages`` after restoring the dump - `guide \u003chttps://github.com/thoth-station/storages#running-postgresql-locally\u003e`__. (or connect to the production db using replacing the env variables in ``.env``).\n5. Run the metrics exporter using ``pipenv run python3 wsgi.py``\n6. You should see metrics in `localhost:8080 \u003chttp://localhost:8080\u003e`__.\n\nAdding new metrics to be exported\n=================================\n\n1. Add the metric you want to expose to `metrics.py \u003chttps://github.com/thoth-station/metrics-exporter/blob/master/thoth/metrics_exporter/metrics.py\u003e`__. The metric types stated here adhere to the Prometheus client library core metric types, and are mentioned `here \u003chttps://prometheus.io/docs/concepts/metric_types/\u003e`__ in detail.\n2. Checkout `metrics_exporter/jobs \u003chttps://github.com/thoth-station/metrics-exporter/tree/master/thoth/metrics_exporter/jobs\u003e`__, 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``.\n3. Register the metric method you write using the decorator ``@register_metric_job``. Here is an `example to look at \u003chttps://github.com/thoth-station/metrics-exporter/blob/a48247fc6a28ec5e2d6ac1f1703c5a8d77a711f5/thoth/metrics_exporter/jobs/pypi.py#L37\u003e`__.\n4. Set the metric variable value from ``metrics.py`` in the method that you define. More, on that here on `prometheus documentation \u003chttps://github.com/prometheus/client_python#gauge\u003e`__.\n5. Finally if you have a new class added in jobs, add it to the `init.py \u003chttps://github.com/thoth-station/metrics-exporter/blob/master/thoth/metrics_exporter/jobs/__init__.py\u003e`__.\n\nConventions\n===========\n\nFor any binary metrics the convention used is:\n\n- ``0`` all good\n\n- ``1`` alarm is required\n\nCopyright\n=========\n\nCopyright (C) 2018, 2019, 2020, 2021, 2022 Red Hat Inc.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see http://www.gnu.org/licenses/.\n\nThe GNU General Public License is provided within the file LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoth-station%2Fmetrics-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthoth-station%2Fmetrics-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoth-station%2Fmetrics-exporter/lists"}