1
0
mirror of https://github.com/Lunik/gitea_prometheus_exporter.git synced 2025-04-18 11:04:02 +03:00

Fix commit count

Signed-off-by: Lunik <lunik@tiwabbit.fr>
This commit is contained in:
Lunik 2021-01-23 18:59:17 +01:00
parent f5d5d13634
commit 034d758bb2
No known key found for this signature in database
GPG Key ID: 5FC70E40703682E7
2 changed files with 7 additions and 2 deletions

4
.gitignore vendored
View File

@ -4,4 +4,6 @@ config.yml
__pycache__/
*.pyc
*.pyc
*.crt

View File

@ -5,7 +5,10 @@ def get_repo_commit_count(gitea, repo):
response = gitea.requests.get(gitea.url + "/api/v1" + page_endpoint + "?limit=1", headers=gitea.headers, params={})
return int(response.headers.get('X-Total'))
if 'X-Total' in response.headers:
return int(response.headers.get('X-Total'))
else:
return 0
def gitea_export(app):
metrics = dict()