Shabar
Shabar

Reputation: 2823

Add custom values in the query for timeFilter

I have below query and need to replace varibale with hard coded values.

Below query works fine when given the time range from the dashboard filter

SELECT mean("count") / $send_interval FROM "$measurement_name" WHERE ("transaction" = 'all' AND "application" =~ /^$application$/) AND $timeFilter GROUP BY time($__interval) fill(null)

I eneterd same time range (2022-05-05 12:46:00 - 2022-05-05 12:53:00) in millisecon as below, However can't see the data in the graph

SELECT mean("count") / $send_interval FROM "$measurement_name" WHERE ("transaction" = 'all' AND "application" =~ /^$application$/) AND time > 1651718760000 AND time < 1651719180000 GROUP BY time($__interval) fill(null)

My version:

Grafana v6.4.1
Influxdb 1.7.7

enter image description here

Upvotes: 1

Views: 1658

Answers (1)

Ian M
Ian M

Reputation: 731

You should use timestamp format, specified here: https://docs.influxdata.com/influxdb/v1.7/query_language/spec/#dates--times

The date and time literal format is not specified in EBNF like the rest of this document. It is specified using Go’s date / time parsing format, which is a reference date written in the format required by InfluxQL. The reference date time is:

InfluxQL reference date time: January 2nd, 2006 at 3:04:05 PM

time_lit            = "2006-01-02 15:04:05.999999" | "2006-01-02"

Alternatively you would likely need to use epoch time in nanoseconds, since influx is stored in ns.

Upvotes: 2

Related Questions