{{ template "head" . }}

{{ template "prom_right_table_head" }}
  <tr><th colspan="2">{{ .Params.frontend }}</th></tr>
  <tr>
    <td>Requests</td>
    <td>{{ template "prom_query_drilldown" (args (printf "sum(irate(haproxy_frontend_http_requests_total{job='haproxy',frontend='%s'}[5m]))" .Params.frontend) "/s" "humanizeNoSmallPrefix") }}</td>
  </tr>
  <tr>
    <td>Requests Denied</td>
    <td>{{ template "prom_query_drilldown" (args (printf "sum(irate(haproxy_frontend_requests_denied_total{job='haproxy',frontend='%s'}[5m]))" .Params.frontend) "/s" "humanizeNoSmallPrefix") }}</td>
  </tr>
  <tr>
    <td>Data In</td>
    <td>{{ template "prom_query_drilldown" (args (printf "sum(irate(haproxy_frontend_bytes_in_total{job='haproxy',frontend='%s'}[5m]))" .Params.frontend) "B/s" "humanize") }}</td>
  </tr>
  <tr>
    <td>Data Out</td>
    <td>{{ template "prom_query_drilldown" (args (printf "sum(irate(haproxy_frontend_bytes_out_total{job='haproxy',frontend='%s'}[5m]))" .Params.frontend) "B/s" "humanize") }}</td>
  </tr>
  <tr>
    <td>Current Sessions</td>
    <td>{{ template "prom_query_drilldown" (args (printf "sum(haproxy_frontend_current_sessions{job='haproxy',frontend='%s'})" .Params.frontend) "" "humanize") }}</td>
  </tr>
{{ template "prom_right_table_tail" }}

{{ template "prom_content_head" . }}
  <h1>HAProxy Frontend - {{ .Params.frontend }}</h1>

  <h3>Responses</h3>
  <div id="responsesGraph"></div>
  <script>
  new PromConsole.Graph({
    node: document.querySelector("#responsesGraph"),
    expr: "sum by (code)(irate(haproxy_frontend_http_responses_total{job='haproxy',frontend='{{ .Params.frontend }}'}[5m]))",
    renderer: 'area',
    yTitle: 'Queries',
    yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
    yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
    yUnits: ' /s'
  })
  </script>
{{ template "prom_content_tail" . }}

{{ template "tail" }}
