-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
enhancementNew feature or requestNew feature or requestquestionGeneral question about project or functionality.General question about project or functionality.
Description
Hi
Very small time period can miss data points, due to the data source rounding up the from time in getPrometheusTime(). E.g. for a range requested as from=2025-04-14T17:41:49.517Z&to=2025-04-14T17:41:50.503Z can look like:
Using the prometheus data source doesn't exhibit the same behaviour, though I haven't looked in to why (not sure if it sends sub-second timestamps, or rounds differently).
Anyway, a trivial fix still using seconds is to use ceil/floor as appropriate:
getPrometheusTime(date: string | DateTime, roundUp: boolean) {
if (typeof date === 'string') {
date = dateMath.parse(date, roundUp)!;
}
if (roundUp) {
return Math.ceil(date.valueOf() / 1000);
} else {
return Math.floor(date.valueOf() / 1000);
}
}Which looks better:
Happy to make a PR but I've no idea if this is the best approach. It was just an obviously quick workaround once I realised where the rounding was happening.
Thanks!
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestquestionGeneral question about project or functionality.General question about project or functionality.

