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:
parent
f5d5d13634
commit
034d758bb2
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,4 +4,6 @@ config.yml
|
||||
|
||||
__pycache__/
|
||||
|
||||
*.pyc
|
||||
*.pyc
|
||||
|
||||
*.crt
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user