-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Cannot use row time as start/end query parameter #597
Comments
This is expected behaviour, we expect you to add a nanosecond to the previous timestamp for the results. |
@gouthamve ok, that makes sense (ignored JS precision when doing calculations). But what about the second situation, where a log line that happened before the original one was included? |
That might be a bug. We should parse the timestamp from docker if I am not wrong. /cc @slim-bean @Kuqd |
yes we are now ! |
I've been playing with the log context a little bit more, and seems like the problem still occurs, see image for details: All logs in the "after" context happened before actually. The timestamp of the original log row, for which the context is shown is 1558451701326000000ns, (2019-05-21T15:15:01.3269129Z) The request payload I'm sending to retrieve the "after" context for that log is:
The response is:
I assume this might be related to precision loss in Explore when we convert log's timestamp to ms, which is later converted to ns when requesting context: 1558451701326000000ns !== 2019-05-21T15:15:01.3269129Z, isn't it? cc @davkal |
Grafana is using the row Can we change the query API to be able to use ISO date strings for |
Looking at the code, it should be possible for Loki to support both ns and string. It can first attempt integer conversion and if that fails to fallback to string (or vice versa). The string format should be in RFC3339Nano format. |
@dprokop We've merged the new iso string parameter. Does that fix the issue ? |
@dprokop gentle bump :) |
@Kuqd thanks, haven't checked yet, we haven't prioritized the fix yet. @hugohaggmark is on it today, so let's see ltr. |
@Kuqd so I'm a complete newb as to the Loki API but I think I still can find a discrepancy. The following request to the Loki API:
Returns the following data:
Notice how there is no entry with the When I instead do this request:
Returns the following data:
Notice that the first entry has As a newb I expect the API to either return the |
@hugohaggmark yes this is normal, the end is exclusive but the start is inclusive. You don't have to feel like a newb this is not documented properly. Does that make sense ? let's keep that issue open to improve the doc around that behaviour. |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Is this still true? Trying some requests and what I see: request with start=1579792992203968000
Same request just start=1579792992203967000 (minus 1us)
This returned data with ts = 1579792992203968000 which is the start time of the first request |
Describe the bug
When querying logs with a given
start
timestamp, the response contains log lines preceding the timestamp or duplicates of the original log line.Expected behaviour
Response should contain logs with
timestamp > start
Screenshots, promtail config, or terminal output
Here I have requested logs with a start parameter = timestamp of the log line at the bottom. See the log lines in the result
Same situation as described above. The result contains the original log line and the log that preceded it:
The text was updated successfully, but these errors were encountered: