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

fix mutating of query start time for multiple queries #96

Merged
merged 5 commits into from
Jul 25, 2024

Conversation

MGJamJam
Copy link
Contributor

Work: Deletes mutating of grafanas interval start from object. The mutating caused inconsistent behaviour for multiple queries, as the mutating in the first query changed the interval start for all the following queries, which led to different interval Auto calculations for e.g 3 hours.
For the 3 hours interval the first query would still return correct MINUTE interval, for all the subsequent queries it would return HOUR interval as the startTime got rounded down and was the above the minuteIntervalLimit.

Comment on lines 106 to 108
// create new moment object to not mutate the original grafana object with startOf() to not change
// the grafana graph as this would change the timeframe for all the following queries
let queryFrom = moment(range!.from.valueOf());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't there a reason, why we wanted to mutate original range.from ? I remember, we discuss that for half hour+ in one of techsyncs ... otherwise we would use local let queryFrom from beginning ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the reason was to adjust the timeframe of the graph through modifying the range.from with the startOf() function to be able to display the first datapoint, otherwise it would still be there but outside the graph's boundaries.

I added the range.from() modification again, but only after all the queries were fetched and data was transformed. This way we send the starttimes for all the queries correctly but also adapt the timeframe of the graph to display the first datapoint.

@MGJamJam MGJamJam requested a review from Svarozic July 25, 2024 13:23
@MGJamJam MGJamJam merged commit b6a1fa2 into main Jul 25, 2024
3 checks passed
@MGJamJam MGJamJam deleted the feat/increase-minute-interval-limit branch July 25, 2024 14:36
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

Successfully merging this pull request may close these issues.

2 participants