An annotation is an event that is overlayed on top of graphs. The query can have up to four columns per row, the <b>time</b> column is mandatory. Annotation rendering is expensive so it is important to limit the number of rows returned.
An annotation is an event that is overlayed on top of graphs. The query can have up to three columns per row, the <b>time</b> column is mandatory. Annotation rendering is expensive so it is important to limit the number of rows returned.
- column with alias: <b>time</b> for the annotation event time (in UTC), as a unix time stamp or any sql native date datatype.
- column with alias: <b>time</b> for the annotation event time (in UTC). Use unix timestamp in seconds or any native date data type.
- column with alias: <b>text</b> for the annotation text
- column with alias: <b>text</b> for the annotation text.
- column with alias: <b>tags</b> for annotation tags. This is a comma separated string of tags e.g. 'tag1,tag2'
- column with alias: <b>tags</b> for annotation tags. This is a comma separated string of tags e.g. 'tag1,tag2'.
Macros:
Macros:
- $__time(column) -> column AS time
- $__time(column) -> column AS time
- $__utcTime(column) -> DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), column) AS time
- $__utcTime(column) -> DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), column) AS time
- $__timeEpoch(column) -> DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second,GETDATE(),GETUTCDATE()), column) ) AS time
- $__timeEpoch(column) -> DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), column) ) AS time
Grafana does not validate that queries are safe so queries can contain any SQL statement. For example, statements
Grafana does not validate that queries are safe so queries can contain any SQL statement. For example, statements
like <code>USE otherdb;</code> and <code>DROP TABLE user;</code> would be executed. To protect against this we
like <code>USE otherdb;</code> and <code>DROP TABLE user;</code> would be executed. To protect against this we
<strong>Highly</strong> recommmend you create a specific MSSQL user with restricted permissions.
<strong>Highly</strong> recommmend you create a specific MSSQL user with restricted permissions.
Checkout the <aclass="external-link"target="_blank"href="http://docs.grafana.org/features/datasources/mssql/">MSSQL Data Source Docs</a> for more information.
- $__unixEpochFilter(column) -> column > 1492750877 AND column < 1492750877
- $__unixEpochFilter(column) -> column > 1492750877 AND column < 1492750877
- $__timeGroup(column, '5m'[, fillvalue]) -> cast(cast(DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), column))/300 as int)*300 as int). Providing a <i>fillValue</i> of <i>NULL</i> or floating value will automatically fill empty series in timerange with that value.
- $__timeGroup(column, '5m'[, fillvalue]) -> cast(cast(DATEDIFF(second, {d '1970-01-01'}, DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), column))/300 as int)*300 as int). Providing a <i>fillValue</i> of <i>NULL</i> or floating value will automatically fill empty series in timerange with that value.
Or build your own conditionals using these macros which just return the values:
Or build your own conditionals using these macros which just return the values: