- Moved code of the wrapper functions to to methods of class HistogramStorage
and class CounterStorage.
- Renamed global histogram and counter objects to HISTOGRAM_STORAGE and
COUNTER_STORAGE.
- The imports of names from the metrics module in the application code has been
reduced to:
from searx import metrics
By this convention the wrapper functions can be replaced by the globals from:
metrics.HISTOGRAM_STORAGE
metrics.COUNTER_STORAGE
- comment out the context manager from searx.metrics.histogram_observe_time / we
do not have a usage of this context manager.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
* allow not to record metrics (response time, etc...)
* this commit doesn't change the UI. If the metrics are disabled
/stats and /stats/errors will return empty response.
in /preferences, the columns response time and reliability will be empty.
httpx.RequestError (subclass of httpx.HTTPError) has a property request.
This property raises a RuntimeError if the attributes _request is None.
To avoid a cascade of errors, this commit reads directly the _request attribute.
- init stat values by None
- drop round_or_none
- don't try to get percentage if base is 'None'
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Some error won't stop the engine:
* additional HTTP redirects for example
* some invalid results
secondary=True allows to flag these errors as not important.