2018-10-09 19:46:31 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
|
|
const CHEAT_SHEET_ITEMS = [
|
|
|
|
|
{
|
|
|
|
|
title: 'Request Rate',
|
|
|
|
|
expression: 'rate(http_request_total[5m])',
|
|
|
|
|
label:
|
|
|
|
|
'Given an HTTP request counter, this query calculates the per-second average request rate over the last 5 minutes.',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '95th Percentile of Request Latencies',
|
|
|
|
|
expression: 'histogram_quantile(0.95, sum(rate(prometheus_http_request_duration_seconds_bucket[5m])) by (le))',
|
|
|
|
|
label: 'Calculates the 95th percentile of HTTP request rate over 5 minute windows.',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Alerts Firing',
|
|
|
|
|
expression: 'sort_desc(sum(sum_over_time(ALERTS{alertstate="firing"}[24h])) by (alertname))',
|
|
|
|
|
label: 'Sums up the alerts that have been firing over the last 24 hours.',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export default (props: any) => (
|
|
|
|
|
<div>
|
2018-12-04 12:59:24 +01:00
|
|
|
<h2>PromQL Cheat Sheet</h2>
|
2018-10-09 19:46:31 +02:00
|
|
|
{CHEAT_SHEET_ITEMS.map(item => (
|
|
|
|
|
<div className="cheat-sheet-item" key={item.expression}>
|
|
|
|
|
<div className="cheat-sheet-item__title">{item.title}</div>
|
2018-11-21 14:45:57 +01:00
|
|
|
<div
|
|
|
|
|
className="cheat-sheet-item__expression"
|
2019-05-10 14:00:39 +02:00
|
|
|
onClick={e => props.onClickExample({ refId: 'A', expr: item.expression })}
|
2018-11-21 14:45:57 +01:00
|
|
|
>
|
2018-10-09 19:46:31 +02:00
|
|
|
<code>{item.expression}</code>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="cheat-sheet-item__label">{item.label}</div>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
);
|