I have some metrics data, this metrics data generated under differents testing “scenario(s)” and I need to compare metrics data from differents “scenarios” on single graph. Due each data records for each “scenario(s)” have it own unique timestamp (and differences between them may be days or weeks, this is reason why timeshift option is can not be used), I created simple query, that generate timestamp for each “scenario(s)” starting from now() and each next records under it will have now()+1 minute. This query working correctly in MySQL Workbench, but on grafana all records always have same timestamp.
Is right now Grafana do not support such queries or I should add / update something to make it work correctly?
Below can be found query and some screenshots.
MySQL query:
SELECT
UNIX_TIMESTAMP(STR_TO_DATE(CASE PERFORMANCE_SCENARIO.name
WHEN @currencyScenario THEN @currentRecordTimestamp:=@currentRecordTimestamp + interval 1 minute
ELSE @currentRecordTimestamp:=TIMESTAMP(CURDATE())
END, ‘%Y-%m-%d %H:%i:%s’)) AS time_sec,
CASE PERFORMANCE_SCENARIO.name
WHEN @currencyScenario THEN @currentRecordTimestamp:=@currentRecordTimestamp + interval 1 minute
ELSE @currentRecordTimestamp:=TIMESTAMP(CURDATE())
END as generated_timestamp,
PERFORMANCE_AUDIT_RECORD.runtime as value,
@currencyScenario:=PERFORMANCE_SCENARIO.name AS metric
FROM
PERFORMANCE_AUDIT
INNER JOIN
PERFORMANCE_SCENARIO ON styx.PERFORMANCE_SCENARIO.id = PERFORMANCE_AUDIT.scenario_id
INNER JOIN
PERFORMANCE_AUDIT_RECORD ON PERFORMANCE_AUDIT_RECORD.performance_audit_id = PERFORMANCE_AUDIT.id
WHERE
PERFORMANCE_SCENARIO.id IN (478 , 438)
MySQL query results on workbench:
Grafana query results: