{{ template "head" . }}

{{ template "prom_right_table_head" }}
{{ template "prom_right_table_job_head" "cassandra" }}
<tr>
  <td>Queries</td>
  <td>{{ template "prom_query_drilldown" (args "sum by (job)(irate(cassandra_clientrequest_latency{job='cassandra'}[5m]))" "/s" "humanizeNoSmallPrefix") }}</td>
</tr>
<tr>
  <td>Timeout Ratio</td>
  <td>{{ template "prom_query_drilldown" (args "sum by (job)(irate(cassandra_clientrequest_timeouts{job='cassandra'}[5m])) / sum by (job)(rate(cassandra_clientrequest_latency{job='cassandra'}[5m]))" "" "humanizeNoSmallPrefix") }}</td>
</tr>
<tr>
  <td>Unavailable Ratio</td>
  <td>{{ template "prom_query_drilldown" (args "sum by (job)(irate(cassandra_clientrequest_unavailables{job='cassandra'}[5m])) / sum by (job)(rate(cassandra_clientrequest_latency{job='cassandra'}[5m]))" "" "humanizeNoSmallPrefix") }}</td>
</tr>
<tr><th colspan="2">Internals</th></tr>
<tr>
  <td>Hints Inprogress</td>
  <td>{{ template "prom_query_drilldown" (args "sum by (job)(cassandra_storage_totalhintsinprogress{job='cassandra'})" "" "humanize") }}</td>
</tr>
<tr>
  <td>Blocked Tasks</td>
  <td>{{ template "prom_query_drilldown" (args "sum by (job)(cassandra_threadpools_currentlyblockedtasks{job='cassandra'})" "" "humanize") }}</td>
</tr>
<tr><th colspan="2">Average Node Disk</th></tr>
<tr>
  <td>Compacted</td>
  <td>{{ template "prom_query_drilldown" (args "avg by (job)(irate(cassandra_compaction_bytescompacted{job='cassandra'}[5m]))" "B/s" "humanize1024") }}</td>
</tr>
<tr>
  <td>Live CF</td>
  <td>{{ template "prom_query_drilldown" (args "avg by (job)(sum by (job, instance)(cassandra_columnfamily_totaldiskspaceused{job='cassandra'}))" "B" "humanize1024") }}</td>
</tr>
<tr>
  <td>Total CF</td>
  <td>{{ template "prom_query_drilldown" (args "avg by (job)(sum by (job, instance)(cassandra_columnfamily_totaldiskspaceused{job='cassandra'}))" "B" "humanize1024") }}</td>
</tr>
<tr>
  <td>Commit Log</td>
  <td>{{ template "prom_query_drilldown" (args "avg by (job)(cassandra_commitlog_totalcommitlogsize{job='cassandra'})" "B" "humanize1024") }}</td>
</tr>
{{ template "prom_right_table_tail" }}

{{ template "prom_content_head" .}}
<h1>Cassandra</h1>

<h3>Client Queries</h3>
<div id="queryGraph"></div>
<script>
new PromConsole.Graph({
  node: document.querySelector("#queryGraph"),
  expr: "sum by (job, clientrequest)(irate(cassandra_clientrequest_latency{job='cassandra'}[5m]))",
  name: "[[clientrequest]]",
  yAxisFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
  yHoverFormatter: PromConsole.NumberFormatter.humanizeNoSmallPrefix,
  yUnits: "/s",
  yTitle: "Queries"
})
</script>

<h3>Client Latency</h3>
<div id="latencyGraph"></div>
<script>
new PromConsole.Graph({
  node: document.querySelector("#latencyGraph"),
  expr: "sum by (job, clientrequest)(irate(cassandra_clientrequest_totallatency{job='cassandra'}[5m])) / sum by (job, clientrequest)(rate(cassandra_clientrequest_latency{job='cassandra'}[5m])) / 1000000",
  name: "[[clientrequest]]",
  yAxisFormatter: PromConsole.NumberFormatter.humanize,
  yHoverFormatter: PromConsole.NumberFormatter.humanize,
  yUnits: "s",
  yTitle: "Latency"
})
</script>
{{ template "prom_content_tail" . }}

{{ template "tail" }}
