Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last / First - strange timesamp #6684

Closed
Lahorde opened this issue May 19, 2016 · 1 comment
Closed

Last / First - strange timesamp #6684

Lahorde opened this issue May 19, 2016 · 1 comment

Comments

@Lahorde
Copy link

Lahorde commented May 19, 2016

influxdb 0.12

I'm selecting first and last values from last minute from an influx db timeseries, according to doc "Last returns the newest value (determined by the timestamp) of a single field."
here are requests :

echo -e 'LAST VALUE' && \
curl -G 'http://db_address:8086/query?q=select+last(value)+from+ambient_temperature+where+time>now()+-+1m&db=home_data' && \
echo -e '\nFIRST VALUE' && \
curl -G 'http://db_address:8086/query?q=select+first(value)+from+ambient_temperature+where+time>now()+-+1m&db=home_data' && \
echo -e '\nlast values' && \
curl -G 'http://db_address:8086/query?q=select+*+from+ambient_temperature+where+time>now()+-+2m&db=home_data'

LAST VALUE
{"results":[{"series":[{"name":"ambient_temperature","columns":["time","last"],"values":[["2016-05-19T08:43:09.645833512Z",20.71875]]}]}]}
FIRST VALUE
{"results":[{"series":[{"name":"ambient_temperature","columns":["time","first"],"values":[["2016-05-19T08:43:09.700503355Z",20.71875]]}]}]}
last values
{"results":[{"series":[{"name":"ambient_temperature","columns":["time","value"],"values":[["2016-05-19T08:42:11.69Z",20.71875],["2016-05-19T08:42:13.715Z",20.71875],["2016-05-19T08:42:15.695    Z",20.71875],["2016-05-19T08:42:17.705Z",20.71875],["2016-05-19T08:42:19.714Z",20.71875],["2016-05-19T08:42:21.71Z",20.71875],["2016-05-19T08:42:23.719Z",20.71875],["2016-05-19T08:42:25.729Z    ",20.71875],["2016-05-19T08:42:27.724Z",20.71875],["2016-05-19T08:42:29.734Z",20.71875],["2016-05-19T08:42:31.788Z",20.71875],["2016-05-19T08:42:33.783Z",20.71875],["2016-05-19T08:42:35.764Z    ",20.71875],["2016-05-19T08:42:37.758Z",20.71875],["2016-05-19T08:42:39.753Z",20.71875],["2016-05-19T08:42:41.793Z",20.71875],["2016-05-19T08:42:43.772Z",20.71875],["2016-05-19T08:42:45.782Z    ",20.71875],["2016-05-19T08:42:47.777Z",20.71875],["2016-05-19T08:42:49.787Z",20.71875],["2016-05-19T08:42:51.782Z",20.71875],["2016-05-19T08:42:53.792Z",20.71875],["2016-05-19T08:42:55.846Z    ",20.71875],["2016-05-19T08:42:57.796Z",20.71875],["2016-05-19T08:42:59.807Z",20.71875],["2016-05-19T08:43:01.816Z",20.71875],["2016-05-19T08:43:03.841Z",20.71875],["2016-05-19T08:43:05.851Z    ",20.71875],["2016-05-19T08:43:07.831Z",20.71875],["2016-05-19T08:43:09.855Z",20.71875],["2016-05-19T08:43:11.865Z",20.71875],["2016-05-19T08:43:13.86Z",20.71875],["2016-05-19T08:43:15.84Z",    20.71875],["2016-05-19T08:43:17.85Z",20.71875],["2016-05-19T08:43:19.859Z",20.71875],["2016-05-19T08:43:21.869Z",20.71875],["2016-05-19T08:43:23.864Z",20.71875],["2016-05-19T08:43:25.874Z",2    0.71875],["2016-05-19T08:43:27.869Z",20.71875],["2016-05-19T08:43:29.879Z",20.71875],["2016-05-19T08:43:31.919Z",20.71875],["2016-05-19T08:43:33.883Z",20.71875],["2016-05-19T08:43:35.893Z",2    0.71875],["2016-05-19T08:43:37.903Z",20.71875],["2016-05-19T08:43:39.899Z",20.71875],["2016-05-19T08:43:41.908Z",20.71875],["2016-05-19T08:43:43.918Z",20.71875],["2016-05-19T08:43:45.913Z",2    0.71875],["2016-05-19T08:43:47.937Z",20.71875],["2016-05-19T08:43:49.932Z",20.71875],["2016-05-19T08:43:51.942Z",20.71875],["2016-05-19T08:43:53.937Z",20.71875],["2016-05-19T08:43:55.947Z",2    0.71875],["2016-05-19T08:43:57.972Z",20.71875],["2016-05-19T08:43:59.981Z",20.71875],["2016-05-19T08:44:01.976Z",20.71875],["2016-05-19T08:44:03.971Z",20.71875],["2016-05-19T08:44:05.981Z",2    0.71875],["2016-05-19T08:44:07.991Z",20.71875]]}]}]}

But I do not understand returned results, for last and first values, value is correct but I get a time that does not match any timestamp in my measurements (see last request that queries values from last 2 minutes), I should have a timestampe:

2016-05-19T08:42:11.69Z for first element
2016-05-19T08:44:07.991Z for last element

Where do first and last values time come from? Why first and last value are not correct?

@jsternberg
Copy link
Contributor

Since this is 0.12, those times represent the beginning of the interval. In 0.12, selectors were all normalized to return the beginning of the interval for every aggregate function.

We reverted that in 0.13 to allow selectors in a specific situation return the actual time value in #5890. This should work as you expect it to in 0.13, but if you use a GROUP BY time(...) clause, the time returned will be the beginning of the interval rather than the actual point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants