diff --git a/src/components/AnnotationEditor.tsx b/src/components/AnnotationEditor.tsx index 2a26b4d..8c11bed 100644 --- a/src/components/AnnotationEditor.tsx +++ b/src/components/AnnotationEditor.tsx @@ -34,7 +34,8 @@ export function AnnotationEditor({query, onChange, onRunQuery}: Props) { const {queryText, queryParamStart, queryParamStop,queryTimeField} = query; const labelWidth = 16, fieldWidth = 20; - const defaultQuery = `SELECT + const defaultQuery = +`SELECT e._event_time, CASE WHEN e.message IS NOT NULL THEN e.message @@ -45,9 +46,10 @@ FROM commons._events e WHERE e._event_time > :startTime AND - e._event_time < :stopTime + e._event_time < :stopTime AND + e.type = 'ERROR' ORDER BY - time DESC` + e. _event_time DESC` return ( <> diff --git a/src/components/VariableQueryEditor.tsx b/src/components/VariableQueryEditor.tsx index 367fbf8..8ac1d0c 100644 --- a/src/components/VariableQueryEditor.tsx +++ b/src/components/VariableQueryEditor.tsx @@ -16,14 +16,21 @@ export function VariableQueryEditor({query, onChange, onRunQuery}: Props) { const labelWidth = 16; const defaultQuery = -`select - e.kind -from - commons._events e -group by - kind +`SELECT + TIME_BUCKET(MINUTES(5), e._event_time) AS _event_time, + COUNT(e.type) AS count, + e.kind AS label +FROM + commons._events e +WHERE + e._event_time > :startTime + AND e._event_time < :stopTime + AND e.kind LIKE '$kind' +GROUP BY + e._event_time, + e.label ORDER BY - kind` + e._event_time DESC` return (
diff --git a/src/types.ts b/src/types.ts index be20c23..c150a4f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -26,7 +26,7 @@ GROUP BY _event_time, label ORDER BY - _event_time`, + _event_time DESC`, queryParamStart: ':startTime', queryParamStop: ':stopTime', queryTimeField: '_event_time',