From 8205056569e6c4a283585150f09a5da6e1b6be13 Mon Sep 17 00:00:00 2001 From: Alex Ioannidis Date: Mon, 26 Aug 2024 18:39:10 +0200 Subject: [PATCH] config: filter out robots and flag machines --- invenio_app_rdm/config.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/invenio_app_rdm/config.py b/invenio_app_rdm/config.py index d4fc63941..737801a11 100644 --- a/invenio_app_rdm/config.py +++ b/invenio_app_rdm/config.py @@ -88,7 +88,12 @@ from invenio_requests.resources.requests.config import request_error_handlers from invenio_stats.aggregations import StatAggregator from invenio_stats.contrib.event_builders import build_file_unique_id -from invenio_stats.processors import EventsIndexer, anonymize_user, flag_robots +from invenio_stats.processors import ( + EventsIndexer, + anonymize_user, + filter_robots, + flag_machines, +) from invenio_stats.queries import TermsQuery from invenio_stats.tasks import StatsAggregationTask, StatsEventTask from invenio_vocabularies.config import ( @@ -1130,6 +1135,7 @@ def github_link_render(record): # ============= # See https://invenio-stats.readthedocs.io/en/latest/configuration.html + STATS_EVENTS = { "file-download": { "templates": "invenio_rdm_records.records.stats.templates.events.file_download", @@ -1139,7 +1145,12 @@ def github_link_render(record): ], "cls": EventsIndexer, "params": { - "preprocessors": [flag_robots, anonymize_user, build_file_unique_id] + "preprocessors": [ + filter_robots, + flag_machines, + anonymize_user, + build_file_unique_id, + ] }, }, "record-view": { @@ -1151,7 +1162,12 @@ def github_link_render(record): ], "cls": EventsIndexer, "params": { - "preprocessors": [flag_robots, anonymize_user, build_record_unique_id], + "preprocessors": [ + filter_robots, + flag_machines, + anonymize_user, + build_record_unique_id, + ], }, }, }