Skip to content

Commit

Permalink
metrics: suggested changes/minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yashlamba committed Sep 18, 2023
1 parent 86436df commit 7e9ef4c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion invenio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ by installer are included here.

from copy import deepcopy

from celery.schedules import timedelta
from invenio_administration.permissions import administration_permission
from invenio_app_rdm.config import CELERY_BEAT_SCHEDULE, APP_RDM_ROUTES, APP_RDM_DEPOSIT_FORM_DEFAULTS as DEPOSIT_FORM_DEFAULTS
from invenio_i18n import lazy_gettext as _
Expand Down
5 changes: 4 additions & 1 deletion site/zenodo_rdm/metrics/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def get_data_transfer():
download_volume = result.get("download_volume", {}).get("value", 0)

search = (
Search(using=current_search_client, index=build_alias_name("rdmrecords"))
Search(
using=current_search_client,
index=build_alias_name("rdmrecords-records"),
)
.filter("range", created=time_range)
.params(request_timeout=120)
)
Expand Down
2 changes: 1 addition & 1 deletion site/zenodo_rdm/metrics/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, app=None):
def init_config(app):
"""Initialize configuration."""
for k in dir(config):
if k.startswith("METRICS"):
if k.startswith("METRICS_"):
app.config.setdefault(k, getattr(config, k))

def init_app(self, app):
Expand Down
5 changes: 2 additions & 3 deletions site/zenodo_rdm/metrics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ def formatted_response(metrics):
response = ""
for metric in metrics:
response += (
"# HELP {name} {help}\n# TYPE {name} {type}\n{name} "
"{value}\n".format(**metric)
)
"# HELP {name} {help}\n# TYPE {name} {type}\n{name} " "{value}\n"
).format(**metric)

return response

0 comments on commit 7e9ef4c

Please sign in to comment.