-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathconfig.py
More file actions
103 lines (74 loc) · 3.43 KB
/
Copy pathconfig.py
File metadata and controls
103 lines (74 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
# Copyright (C) 2022 TU Wien.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Proxy to the current stats module."""
from kombu import Exchange
from .utils import default_permission_factory
STATS_REGISTER_RECEIVERS = True
"""Enable the registration of signal receivers.
Default is ``True``.
The signal receivers are functions which will listen to the signals listed in
by the ``STATS_EVENTS`` config variable. An event will be generated for each
signal sent.
"""
STATS_EVENTS = {}
"""Enabled Events.
Each key is the name of an event. A queue will be created for each event.
If the dict of an event contains the ``signal`` key, and the config variable
``STATS_REGISTER_RECEIVERS`` is ``True``, a signal receiver will be registered.
Receiver function which will be connected on a signal and emit events. The key
is the name of the emitted event.
``signal``: Signal to which the receiver will be connected to.
``event_builders``: list of functions which will create and enhance the event.
Each function will receive the event created by the previous function and
can update it. Keep in mind that these functions will run synchronously
during the creation of the event, meaning that if the signal is sent during
a request they will increase the response time.
You can find a sampe of STATS_EVENT configuration in the `registrations.py`
"""
STATS_AGGREGATIONS = {}
STATS_QUERIES = {}
STATS_PERMISSION_FACTORY = default_permission_factory
"""Permission factory used by the statistics REST API.
This is a function which returns a permission granting or forbidding access
to a request. It is of the form ``permission_factory(query_name, params)``
where ``query_name`` is the name of the statistic requested by the user and
``params`` is a dict of parameters for this statistic. The result of the
function is a Permission.
See Invenio-access and Flask-principal for a better understanding of the
access control mechanisms.
"""
STATS_MQ_EXCHANGE = Exchange(
"events",
type="direct",
delivery_mode="transient", # in-memory queue
)
"""Default exchange used for the message queues."""
STATS_REGISTER_INDEX_TEMPLATES = False
"""Register templates as index templates.
Default behaviour will register the templates as search templates.
"""
STATS_EVENTS_UTC_DATETIME_ENABLED = False
"""Enable timezone-aware UTC datetimes for event timestamps.
When set to ``False`` (default), naive UTC datetimes are used (tzinfo is
stripped via ``datetime.replace(tzinfo=None)``). Set to ``True`` to use
timezone-aware UTC datetimes with explicit UTC timezone information.
"""
STATS_VISITOR_CLASSIFIER = None
"""Factory for the visitor classifier used by the event preprocessors.
An import path or callable ``app -> counter_robots.Classifier``. When unset, the
default factory builds the COUNTER baseline plus the extended preset (and a
datacenter resolver when ``STATS_VISITOR_ASN_DB`` is set). Point this at your own
factory to add instance-specific lists. The classifier is built once per
application, cached on the extension state.
"""
STATS_VISITOR_ASN_DB = None
"""Path to a GeoLite2-ASN mmdb, used by the default visitor-classifier factory.
Enables datacenter detection (needs the ``counter-robots[asn]`` extra). The mmdb is
provided and refreshed by the deployment; it is not shipped.
"""