summaryrefslogtreecommitdiff
path: root/searx/templates/oscar/stats.html
blob: 49c776ea8a3eb022758e5fd4e9656d109d35db26 (plain)
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
{% extends 'oscar/base.html' %}
{% from '__common__/new_issue.html' import new_issue %}

{% block title %}{{ _('stats') }} - {% if selected_engine_name %} {{ selected_engine_name }} - {% endif %}{% endblock %}

{%- macro th_sort(column_order, column_name) -%}
    {%- if selected_engine_name -%}
        {{ column_name }}
    {%- elif column_order==sort_order -%}
        {{ column_name }} {{ icon('arrow-dropdown') }}
    {%- else -%}
        <a href="{{ url_for('stats', sort=column_order) }}">{{ column_name }}</a>
    {%- endif -%}
{%- endmacro -%}

{% block content %}
<div class="container-fluid">
    <h1>{{ _('Engine stats') }}{% if selected_engine_name %} - {{ selected_engine_name }}{% endif %}</h1>
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <div class="table-responsive">
                {% if not engine_stats.get('time') %}
                    <div class="col-sm-12 col-md-12">
                        {% include 'oscar/messages/no_data_available.html' %}
                    </div>
                {% else %}
                    <table class="table table-hover table-condensed table-striped">
                        <tr>
                            <th scope="col" style="width:20rem;">{{ th_sort('name', _("Engine name")) }}</th>
                            <th scope="col" style="width:7rem; text-align: right;">{{ th_sort('score', _('Scores')) }}</th>
                            <th scope="col">{{ th_sort('result_count', _('Result count')) }}</th>
                            <th scope="col">{{ th_sort('time', _('Response time')) }}</th>
                            <th scope="col" style="text-align: right;">{{ th_sort('reliability', _('Reliability')) }}</th>
                        </tr>
                        {% for engine_stat in engine_stats.get('time', []) %}
                        <tr>
                            <td><a href="{{ url_for('stats', engine=engine_stat.name|e) }}">{{ engine_stat.name }}</a></td>
                            <td style="text-align: right;">
                                {%- if engine_stat.score -%}
                                <span aria-labelledby="{{engine_stat.name}}_score" >{{ engine_stat.score|round(1) }}</span>
                                <div class="engine-tooltip text-left" role="tooltip" id="{{engine_stat.name}}_score">{{- "" -}}
                                    <p>{{ _('Scores per result') }}: {{ engine_stat.score_per_result | round(3) }}</p>
                                </div>
                                {%- endif -%}
                            </td>
                            <td>
                                {%- if engine_stat.result_count -%}
                                <span class="stacked-bar-chart-value">{{- engine_stat.result_count | int -}}</span>{{- "" -}}
                                <span class="stacked-bar-chart" aria-hidden="true">{{- "" -}}
                                    <span style="width: calc(max(2px, 100%*{{ (engine_stat.result_count / engine_stats.max_result_count )|round(3) }}))" class="stacked-bar-chart-serie1"></span>{{- "" -}}
                                </span>
                                {%- endif -%}
                            </td>
                            <td>
                                {%- if engine_stat.total -%}
                                <span class="stacked-bar-chart-value">{{- engine_stat.total | round(1) -}}</span>{{- "" -}}
                                <span class="stacked-bar-chart" aria-labelledby="{{engine_stat.name}}_time" aria-hidden="true">{{- "" -}}
                                    <span style="width: calc(max(2px, 100%*{{ (engine_stat.http / engine_stats.max_time )|round(3) }}))" class="stacked-bar-chart-serie1"></span>{{- "" -}}
                                    <span style="width: calc(100%*{{ engine_stat.processing / engine_stats.max_time |round(3) }})" class="stacked-bar-chart-serie2"></span>{{- "" -}}
                                </span>{{- "" -}}
                                <div class="engine-tooltip text-left" role="tooltip" id="{{engine_stat.name}}_time">{{- "" -}}
                                    <table class="table table-striped">
                                        <tr>
                                            <th scope="col"></th>
                                            <th scope="col">{{ _('Total') }}</th>
                                            <th scope="col">{{ _('HTTP') }}</th>
                                            <th scope="col">{{ _('Processing') }}</th>
                                        </tr>
                                        <tr>
                                            <th scope="col">{{ _('Median') }}</th>
                                            <td>{{ engine_stat.total }}</td>
                                            <td>{{ engine_stat.http }}</td>
                                            <td>{{ engine_stat.processing }}</td>
                                        </tr>
                                        <tr>
                                            <th scope="col">{{ _('P80') }}</th>
                                            <td>{{ engine_stat.total_p80 }}</td>
                                            <td>{{ engine_stat.http_p80 }}</td>
                                            <td>{{ engine_stat.processing_p80 }}</td>
                                        </tr>
                                        <tr>
                                            <th scope="col">{{ _('P95') }}</th>
                                            <td>{{ engine_stat.total_p95 }}</td>
                                            <td>{{ engine_stat.http_p95 }}</td>
                                            <td>{{ engine_stat.processing_p95 }}</td>
                                        </tr>
                                    </table>
                                </div>
                                {%- endif -%}
                            </td>
                            <td style="text-align: right;"> {{ engine_reliabilities.get(engine_stat.name, {}).get('reliablity') }}</td>
                        </tr>
                        {% endfor %}
                    </table>
                {% endif %}
            </div>
        </div>
        <div class="col-xs-12 col-sm-12 col-md-12">
        {% if selected_engine_name %}
            {% for secondary in [False, True] %}
                {% set ns = namespace(first=true) %}
                {% for error in engine_reliabilities[selected_engine_name].errors %}
                    {% if secondary == error.secondary %}
                        {% if ns.first %}
                            {% set ns.first = false %}
                            <h3>{% if secondary %}{{ _('Warnings') }}{% else %}{{ _('Errors and exceptions') }}{% endif %}</h3>
                        {% endif %}
                        <table class="table table-striped table-bordered">
                            <tbody style="padding-top: 1rem;">
                                <tr>
                                    {%- if error.exception_classname -%}
                                        <th scope="row" style="width: 10rem">{{ _('Exception') }}</th><td>{{ error.exception_classname }}</td>
                                    {%- elif error.log_message -%}
                                        <th scope="row" style="width: 10rem">{{ _('Message') }}</th><td>{{ error.log_message }}</td>
                                    {%- endif -%}
                                    <th scope="row" style="width: 10rem">{{ _('Percentage') }}</th><td style="width: 10rem">{{ error.percentage }}</td>
                                </tr>
                                {% if error.log_parameters and error.log_parameters != (None, None, None) %}<tr><th scope="row">{{ _('Parameter') }}</th>{{- '' -}}
                                    <td colspan="3">
                                        {%- for param in error.log_parameters -%}
                                            <span style="border-right: 1px solid gray; padding: 0 1rem 0 0; margin: 0 0 0 0.5rem;">{{ param }}</span>
                                        {%- endfor -%}
                                    </td>
                                </tr>
                                {% endif %}
                                <tr><th scope="row">{{ _('Filename') }}</th><td colspan="3">{{ error.filename }}:{{ error.line_no }}</td></tr>
                                <tr><th scope="row">{{ _('Function') }}</th><td colspan="3">{{ error.function }}</td></tr>
                                <tr><th scope="row">{{ _('Code') }}</th><td colspan="3">{{ error.code }}</td></tr>
                            </tbody>
                        </table>
                    {% endif %}
                {% endfor %}
            {% endfor %}
            {% if engine_reliabilities[selected_engine_name].checker %}
                <h3>{{ _('Checker') }}</h3>
                <table class="table table-striped table-bordered">
                    <tr>
                        <th scope="col" style="width: 10rem">{{ _('Failed test') }}</th>
                        <th scope="col">{{ _('Comment(s)') }}</th>
                    </tr>
                    {% for test_name, results in engine_reliabilities[selected_engine_name].checker.items() %}
                    <tr>
                        <td>{{ test_name }}</td>
                        <td>
                            {% for r in results %}<p>{{ r }}</p>{% endfor %}
                        </td>
                    </tr>
                    {% endfor %}
                </table>
            {% endif %}
            {{ new_issue(brand.NEW_ISSUE_URL, selected_engine_name, engine_reliabilities[selected_engine_name]) }}
        {% endif %}
        </div>
    </div>
</div>

{% endblock %}