Reputation: 1955
I am currently trying to set up a query in Grafana to display a graph. I have data in the database and my query returns the results I expect, but the graph seems to only display the smallest result.
Table [test_statements]
| ID | ReportTime | LapTime |
| 1 | 2018-03-29 13:02:06 | 2700 |
| 2 | 2018-03-29 13:03:06 | 2725 |
| 3 | 2018-03-29 13:04:06 | 1645 |
| 4 | 2018-03-29 13:05:06 | 2900 |
| 5 | 2018-03-29 13:06:06 | 3101 |
The template is structured as:
SELECT UNIX_TIMESTAMP(<time_column>) as time_sec,
<value column> as value,
<series name column> as metric
FROM <table name>
WHERE $__timeFilter(time_column)
ORDER BY <time_column> ASC
Current Query
SELECT
UNIX_TIMESTAMP(ReportTime) as time_sec,
LapTime as value,
'ReportTime' as metric
FROM test_statements
WHERE ReportTime > 0
ORDER BY ReportTime ASC
I can see the ReportTime results are correct, but the graph is wrong.
Not sure what i'm doing wrong but a point in the correct direction would be helpful. Thanks.
Upvotes: 0
Views: 915
Reputation: 1500
Since there are no time scale labels on x-axis in screenshot
most likely you have Format as
in graph editor's Metrics tab set to Series
or Table
instead of Time series
.
Thus, what you see as y-axis value is the total (sum) of your individual datapoint values (approx. 7 * 2.7K) which is the default setting for series aggregation function. And x-axis is labeled with time series name(metric).
Upvotes: 2