{% extends "skeleton.html" %}
{% block page_title %}Instances{% endblock %}

{% block page_head %}
  <style type="text/css">{% include "servers.css" %}</style>
{% endblock %}

{% block body %}
<div id="servers">
<h3>Instances</h3>
  <table id="ae-servers" class="ae-table">
    <thead>
      <tr>
        <th></th>
        <th>Latency (ms)</th>
        <th>QPS</th>
        <th>Total Requests</th>
      </tr>
    </thead>
    <tbody>
      {% for server in servers|sort(attribute='name') %}
      <tr>
        <th colspan=4>
          <a href="//{{ server.balanced_address }}" target="_blank">
            {{ server.name }}</a>
        </th>
      </tr>
      {% for instance in server.instances|sort(attribute='instance_id') %}
      <tr class="instance">
        <td class="instance-id">
          {% if server.supports_individually_addressable_instances %}
          <a href="//{{ server.get_instance_address(instance.instance_id) }}"
            target="_blank">
          {% endif %}
          {{ instance.instance_id }}
          {% if server.supports_individually_addressable_instances %}
          </a>
          {% endif %}
        </td>
        <td>
          {{ '%0.1f'|format(instance.get_latency_60s() * 1000) }}
        </td>
        <td>
          {{ '%0.2f'|format(instance.get_qps_60s()) }}
        </td>
        <td>
          {{ instance.total_requests }}
        </td>
      </tr>
      {% endfor %}
      {% endfor %}
    </tbody>
  </table>
</div>
{% endblock %}
