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

Strangeness with timestamp() #6219

Open
lapo-luchini opened this issue May 2, 2024 · 3 comments
Open

Strangeness with timestamp() #6219

lapo-luchini opened this issue May 2, 2024 · 3 comments
Assignees
Labels
metricsql question The question issue

Comments

@lapo-luchini
Copy link
Contributor

Describe the bug

If I use this I get all the results:

vm_app_version{job="vmagent"}

but when I do this I get a varying amount of records:

timestamp(vm_app_version{job="vmagent"})

I use this kind of rule to detect when a remote vmagent stopped responding, but I am now getting false positives.

I noticed that this happened when I upgraded vmagent from 1.93.x to 1.100.1, and not when (previously) I upgraded victoria-metrics di 1.100.1.

To Reproduce

timestamp

Version

victoria-metrics-20240411-091522-tags-v1.100.1-0-g9ee51e3

Logs

No response

Screenshots

No response

Used command-line flags

No response

Additional information

No response

@lapo-luchini lapo-luchini added the bug Something isn't working label May 2, 2024
@lapo-luchini
Copy link
Contributor Author

lapo-luchini commented May 6, 2024

Seems to be fixed in v1.101.0… ?
(works with Grafana Explore, but the VMUI interface is broken — might be an issue with the fact that I built it myself though, I didn't check in deeper yet)

@hagen1778
Copy link
Collaborator

hagen1778 commented May 13, 2024

Hello @lapo-luchini!
timestamp function checks for the last timestamp over specified look-behind window timestamp(foo[5m]). If look-behind window is omitted timestamp(foo), then it uses step param instead. On the screenshot you have step 5s, so result is likely depends on whether you had a successful scrape during last 5s + latency_offset (30s), or not.
Grafana Explore probably doesn't send step param, so it defaults to 5m when omitted. Does it make sense?

@lapo-luchini
Copy link
Contributor Author

Grafana Explore probably doesn't send step param, so it defaults to 5m when omitted. Does it make sense?

It does! Originally I noticed the problem in vmalert rules, tough, not using vmui.
It had a lot of false negatives in latest updates that didn't happen before.
Might have been a change… but explanation makes sense, I'll add an explicit look-behind window to the rule.

@hagen1778 hagen1778 added question The question issue and removed bug Something isn't working need more info labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
metricsql question The question issue
Projects
None yet
Development

No branches or pull requests

2 participants