stats.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. {% extends 'oscar/base.html' %}
  2. {% from '__common__/new_issue.html' import new_issue with context %}
  3. {% block title %}{{ _('stats') }} - {% if selected_engine_name %} {{ selected_engine_name }} - {% endif %}{% endblock %}
  4. {%- macro th_sort(column_order, column_name) -%}
  5. {%- if selected_engine_name -%}
  6. {{ column_name }}
  7. {%- elif column_order==sort_order -%}
  8. {{ column_name }} {{ icon('arrow-dropdown') }}
  9. {%- else -%}
  10. <a href="{{ url_for('stats', sort=column_order) }}">{{ column_name }}</a>
  11. {%- endif -%}
  12. {%- endmacro -%}
  13. {% block content %}
  14. <div class="container-fluid">
  15. <h1>{% if selected_engine_name %}<a href="{{ url_for('stats') }}">{% endif %}{{ _('Engine stats') }}{% if selected_engine_name %}</a> - {{ selected_engine_name }}{% endif %}</h1>
  16. <div class="row">
  17. <div class="col-xs-12 col-sm-12 col-md-12">
  18. <div class="table-responsive">
  19. {% if not engine_stats.get('time') %}
  20. <div class="col-sm-12 col-md-12">
  21. {% include 'oscar/messages/no_data_available.html' %}
  22. </div>
  23. {% else %}
  24. <table class="table table-hover table-condensed table-striped engine-stats">
  25. <tr>
  26. <th scope="col" class="engine-name">{{ th_sort('name', _("Engine name")) }}</th>
  27. <th scope="col" class="engine-score">{{ th_sort('score', _('Scores')) }}</th>
  28. <th scope="col" class="result-count">{{ th_sort('result_count', _('Result count')) }}</th>
  29. <th scope="col" class="response-time">{{ th_sort('time', _('Response time')) }}</th>
  30. <th scope="col" class="engine-reliability">{{ th_sort('reliability', _('Reliability')) }}</th>
  31. </tr>
  32. {% for engine_stat in engine_stats.get('time', []) %}
  33. <tr>
  34. <td class="engine-name"><a href="{{ url_for('stats', engine=engine_stat.name|e) }}">{{ engine_stat.name }}</a></td>
  35. <td class="engine-score">
  36. {%- if engine_stat.score -%}
  37. <span aria-labelledby="{{engine_stat.name}}_score" >{{ engine_stat.score|round(1) }}</span>
  38. <div class="engine-tooltip text-left" role="tooltip" id="{{engine_stat.name}}_score">{{- "" -}}
  39. <p>{{ _('Scores per result') }}: {{ engine_stat.score_per_result | round(3) }}</p>
  40. </div>
  41. {%- endif -%}
  42. </td>
  43. <td class="result-count">
  44. {%- if engine_stat.result_count -%}
  45. <div class="bar-chart-value">{{- engine_stat.result_count | int -}}</div>{{- "" -}}
  46. <div class="bar-chart-graph" aria-hidden="true">{{- "" -}}
  47. <div class="bar-chart-bar bar{{ (100 * engine_stat.result_count / engine_stats.max_result_count)|round }}"></div>{{- "" -}}
  48. </div>
  49. {%- endif -%}
  50. </td>
  51. <td class="response-time">
  52. {%- if engine_stat.total is not none -%}
  53. <div class="bar-chart-value">{{- engine_stat.total | round(1) -}}</div>{{- "" -}}
  54. <div class="bar-chart-graph" aria-labelledby="{{engine_stat.name}}_time" aria-hidden="true">{{- "" -}}
  55. {% if engine_stat.http is not none and engine_stats.max_time %}<div class="bar-chart-serie1 bar{{ (100 * engine_stat.http / engine_stats.max_time)|round }}"></div>{%- endif -%}
  56. {% if engine_stat.processing is not none and engine_stats.max_time %}<div class="bar-chart-serie2 bar{{ (100 * engine_stat.processing / engine_stats.max_time)|round }}"></div>{%- endif -%}
  57. </div>
  58. <div class="engine-tooltip text-left" role="tooltip" id="{{engine_stat.name}}_time">{{- "" -}}
  59. <table class="table table-striped">
  60. <tr>
  61. <th scope="col"></th>
  62. <th scope="col">{{ _('Total') }}</th>
  63. <th scope="col">{{ _('HTTP') }}</th>
  64. <th scope="col">{{ _('Processing') }}</th>
  65. </tr>
  66. <tr>
  67. <th scope="col">{{ _('Median') }}</th>
  68. <td>{{ engine_stat.total }}</td>
  69. <td>{{ engine_stat.http or '' }}</td>
  70. <td>{{ engine_stat.processing }}</td>
  71. </tr>
  72. <tr>
  73. <th scope="col">{{ _('P80') }}</th>
  74. <td>{{ engine_stat.total_p80 }}</td>
  75. <td>{{ engine_stat.http_p80 or '' }}</td>
  76. <td>{{ engine_stat.processing_p80 }}</td>
  77. </tr>
  78. <tr>
  79. <th scope="col">{{ _('P95') }}</th>
  80. <td>{{ engine_stat.total_p95 }}</td>
  81. <td>{{ engine_stat.http_p95 or '' }}</td>
  82. <td>{{ engine_stat.processing_p95 }}</td>
  83. </tr>
  84. </table>
  85. </div>
  86. {%- endif -%}
  87. </td>
  88. <td class="engine-reliability"> {{ engine_reliabilities.get(engine_stat.name, {}).get('reliablity') }}</td>
  89. </tr>
  90. {% endfor %}
  91. </table>
  92. {% endif %}
  93. </div>
  94. </div>
  95. <div class="col-xs-12 col-sm-12 col-md-12">
  96. {% if selected_engine_name %}
  97. {% for secondary in [False, True] %}
  98. {% set ns = namespace(first=true) %}
  99. {% for error in engine_reliabilities[selected_engine_name].errors %}
  100. {% if secondary == error.secondary %}
  101. {% if ns.first %}
  102. {% set ns.first = false %}
  103. <h3>{% if secondary %}{{ _('Warnings') }}{% else %}{{ _('Errors and exceptions') }}{% endif %}</h3>
  104. {% endif %}
  105. <table class="table table-striped table-bordered engine-error">
  106. <tbody>
  107. <tr>
  108. {%- if error.exception_classname -%}
  109. <th scope="row" class="engine-error-type">{{ _('Exception') }}</th><td>{{ error.exception_classname }}</td>
  110. {%- elif error.log_message -%}
  111. <th scope="row" class="engine-error-type">{{ _('Message') }}</th><td>{{ error.log_message }}</td>
  112. {%- endif -%}
  113. <th scope="row" class="engine-error-type">{{ _('Percentage') }}</th><td class="engine-error-type">{{ error.percentage }}</td>
  114. </tr>
  115. {% if error.log_parameters and error.log_parameters != (None, None, None) %}<tr><th scope="row">{{ _('Parameter') }}</th>{{- '' -}}
  116. <td colspan="3">
  117. {%- for param in error.log_parameters -%}
  118. <span class="log_parameters">{{ param }}</span>
  119. {%- endfor -%}
  120. </td>
  121. </tr>
  122. {% endif %}
  123. <tr><th scope="row">{{ _('Filename') }}</th><td colspan="3">{{ error.filename }}:{{ error.line_no }}</td></tr>
  124. <tr><th scope="row">{{ _('Function') }}</th><td colspan="3">{{ error.function }}</td></tr>
  125. <tr><th scope="row">{{ _('Code') }}</th><td colspan="3">{{ error.code }}</td></tr>
  126. </tbody>
  127. </table>
  128. {% endif %}
  129. {% endfor %}
  130. {% endfor %}
  131. {% if engine_reliabilities[selected_engine_name].checker %}
  132. <h3>{{ _('Checker') }}</h3>
  133. <table class="table table-striped table-bordered">
  134. <tr>
  135. <th scope="col" class="failed-test">{{ _('Failed test') }}</th>
  136. <th scope="col">{{ _('Comment(s)') }}</th>
  137. </tr>
  138. {% for test_name, results in engine_reliabilities[selected_engine_name].checker.items() %}
  139. <tr>
  140. <td>{{ test_name }}</td>
  141. <td>
  142. {% for r in results %}<p>{{ r }}</p>{% endfor %}
  143. </td>
  144. </tr>
  145. {% endfor %}
  146. </table>
  147. {% endif %}
  148. {{ new_issue(selected_engine_name, engine_reliabilities[selected_engine_name]) }}
  149. {% endif %}
  150. </div>
  151. </div>
  152. </div>
  153. {% endblock %}