Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: filter out robots and flag machines #2809

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions invenio_app_rdm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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",
Expand All @@ -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": {
Expand All @@ -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,
],
},
},
}
Expand Down