Hiya,
I am running into issues with Influxql and the time field. I tried to make a subquery using the time field, but I’ve run into errors (because time cannot be selected as a scalar?).
I am using the JMeter influx driver to capture data. I would like to display the two most recent benchmarks runs for an application in a single grafana window. I would like to filter using an input variable for the application name. I tried creating an influxql statement with a subquery, but I have only run into errors.
There are two measurements event and jmeter. The event measurement denotes a benchmark start and stop time. I was hoping to use the events to filter the jmeter measurement. But I cannot get time as a scalar value in a subquery.
SELECT * FROM "events" ORDER BY "time" DESC LIMIT 2
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ index ┃ time ┃ application ┃ tags ┃ text ┃ title ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━┫
┃ 1┃ 1729700490540000000.0000000000┃APP1 ┃version=v2.1.0 ┃APP1-r1000000-t10-g1-l100000-d10-m100001 ended ┃ApacheJMeter ┃
┃ 2┃ 1729699890484000000.0000000000┃APP1 ┃version=v2.1.0 ┃APP1-r1000000-t10-g1-l100000-d10-m100001 started ┃ApacheJMeter ┃
┣━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━┫
Most recent benchmark for APP1
How can I query the latest benchmark results for a given application?
SELECT "jmeter".*
FROM "jmeter"
WHERE
time >= (
SELECT time
FROM "events"
WHERE "text" =~ /started$/
AND "application" = 'APP1'
ORDER BY time DESC
LIMIT 1
)
AND
time <= (
SELECT time
FROM "events"
WHERE "text" =~ /ended$/
AND "application" = 'APP1'
ORDER BY time DESC
LIMIT 1
)
Previous benchmark for APP1
How can I query the previous benchmark results for a given application?
SELECT "jmeter".*
FROM "jmeter"
WHERE
time >= (
SELECT time
FROM "events"
WHERE "text" =~ /started$/
AND "application" = 'APP1'
ORDER BY time DESC
OFFSET 1
LIMIT 1
)
AND
time <= (
SELECT time
FROM "events"
WHERE "text" =~ /ended$/
AND "application" = 'APP1'
ORDER BY time DESC
OFFSET 1
LIMIT 1
)