-
Notifications
You must be signed in to change notification settings - Fork 1
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
Adjust the from value before getting series arg in hitcount #135
Conversation
Go coverage report: Click to expand.
Go lint report: No issues found. 😎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Small suggestion: I didn't know about the helper.AlignStartToInterval
helper. Can we use it in expr.Metrics
too so it's consistent?
carbonapi/pkg/parser/parser.go
Lines 234 to 243 in 5ba3820
start := r[i].From | |
for _, v := range []int64{86400, 3600, 60} { | |
if interval >= v { | |
start -= start % v | |
break | |
} | |
} | |
r[i].From = start | |
} |
I tried using it in expr.Metrics(), but importing the helper folder caused an import cycle. But I do want to separate it into a function that can be called from both places |
This PR fixes an issue in hitcount. If alignToInterval is set to true, then the from value needs to be adjusted to the new start time before the call to getSeriesArg; otherwise, the from is set to the pre-adjusted value. This is similar to how it is done in other functions with adjusted start times, such as timeShift, where an offset is added to the from value before calling getSeriesArg.