mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Docs: Add SQL region annotation examples (#23268)
Add region annotation examples for SQL data sources in docs. Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
parent
263dcb1452
commit
8b2bdd807b
@ -381,7 +381,7 @@ Read more about variable formatting options in the [Variables]({{< relref "../..
|
||||
Name | Description
|
||||
------------ | -------------
|
||||
time | The name of the date/time field. Could be a column with a native SQL date/time data type or epoch value.
|
||||
timeend | Optional name of the end date/time field. Could be a column with a native SQL date/time data type or epoch value.
|
||||
timeend | Optional name of the end date/time field. Could be a column with a native SQL date/time data type or epoch value. (Grafana v6.6+)
|
||||
text | Event description field.
|
||||
tags | Optional field name to use for event tags as a comma separated string.
|
||||
|
||||
@ -411,6 +411,23 @@ WHERE
|
||||
ORDER BY 1
|
||||
```
|
||||
|
||||
**Example region query using time and timeend columns with epoch values:**
|
||||
|
||||
> Only available in Grafana v6.6+.
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
time_sec as time,
|
||||
time_end_sec as timeend,
|
||||
description as [text],
|
||||
tags
|
||||
FROM
|
||||
[events]
|
||||
WHERE
|
||||
$__unixEpochFilter(time_sec)
|
||||
ORDER BY 1
|
||||
```
|
||||
|
||||
**Example query using time column of native SQL date/time data type:**
|
||||
|
||||
```sql
|
||||
|
@ -350,6 +350,22 @@ WHERE
|
||||
$__unixEpochFilter(epoch_time)
|
||||
```
|
||||
|
||||
**Example region query using time and timeend columns with epoch values:**
|
||||
|
||||
> Only available in Grafana v6.6+.
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
epoch_time as time,
|
||||
epoch_timeend as timeend,
|
||||
metric1 as text,
|
||||
CONCAT(tag1, ',', tag2) as tags
|
||||
FROM
|
||||
public.test_data
|
||||
WHERE
|
||||
$__unixEpochFilter(epoch_time)
|
||||
```
|
||||
|
||||
**Example query using time column of native SQL date/time data type:**
|
||||
|
||||
```sql
|
||||
@ -366,7 +382,7 @@ WHERE
|
||||
Name | Description
|
||||
------------ | -------------
|
||||
time | The name of the date/time field. Could be a column with a native SQL date/time data type or epoch value.
|
||||
timeend | Optional name of the end date/time field. Could be a column with a native SQL date/time data type or epoch value.
|
||||
timeend | Optional name of the end date/time field. Could be a column with a native SQL date/time data type or epoch value. (Grafana v6.6+)
|
||||
text | Event description field.
|
||||
tags | Optional field name to use for event tags as a comma separated string.
|
||||
|
||||
|
@ -354,6 +354,22 @@ WHERE
|
||||
$__unixEpochFilter(epoch_time)
|
||||
```
|
||||
|
||||
**Example region query using time and timeend columns with epoch values:**
|
||||
|
||||
> Only available in Grafana v6.6+.
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
epoch_time as time,
|
||||
epoch_time_end as timeend,
|
||||
metric1 as text,
|
||||
concat_ws(', ', metric1::text, metric2::text) as tags
|
||||
FROM
|
||||
public.test_data
|
||||
WHERE
|
||||
$__unixEpochFilter(epoch_time)
|
||||
```
|
||||
|
||||
**Example query using time column of native SQL date/time data type:**
|
||||
|
||||
```sql
|
||||
@ -370,7 +386,7 @@ WHERE
|
||||
Name | Description
|
||||
------------ | -------------
|
||||
time | The name of the date/time field. Could be a column with a native SQL date/time data type or epoch value.
|
||||
timeend | Optional name of the time end field, needs to be date/time data type. If set, then annotations are marked as regions between time and time-end.
|
||||
timeend | Optional name of the time end field, needs to be date/time data type. If set, then annotations are marked as regions between time and time-end. (Grafana v6.6+)
|
||||
text | Event description field.
|
||||
tags | Optional field name to use for event tags as a comma separated string.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user