Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust default queries #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/components/AnnotationEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 (
<>
Expand Down
21 changes: 14 additions & 7 deletions src/components/VariableQueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GROUP BY
_event_time,
label
ORDER BY
_event_time`,
_event_time DESC`,
queryParamStart: ':startTime',
queryParamStop: ':stopTime',
queryTimeField: '_event_time',
Expand Down
Loading