{{ctrl.lastQueryMeta.sql}}
Time series:
- return column named time (in UTC), as a unix time stamp or any sql native date data type. You can use the macros below.
- optional: return column named metric to represent the series names.
- any other columns returned will be the time point values.
- if multiple value columns are present and a metric column is provided. the series name will be the combination of "MetricName - ValueColumnName".
Table:
- return any set of columns
Macros:
- $__time(column) -> 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
- $__timeFilter(column) -> column > DATEADD(s, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01') AND column < DATEADD(s, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01')
- $__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 fillValue of NULL 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:
- $__timeFrom() -> DATEADD(second, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01')
- $__timeTo() -> DATEADD(second, 1492750877+DATEDIFF(second, GETUTCDATE(), GETDATE()), '1970-01-01')
- $__unixEpochFrom() -> 1492750877
- $__unixEpochTo() -> 1492750877
{{ctrl.lastQueryError}}