rhythm: fix block time range adjustment#4746
Conversation
| if end.Before(start) { | ||
| warn = true | ||
| end = start | ||
| } |
There was a problem hiding this comment.
This is just wrong data, no? I don't think we have to fix it, or at least it's not related to ingestion slack.
There was a problem hiding this comment.
Did you mean end.Before(startOfRange) instead?
| if end.Before(start) { | |
| warn = true | |
| end = start | |
| } | |
| if end.Before(startOfRange) { | |
| warn = true | |
| end = start | |
| } |
There was a problem hiding this comment.
Not wrong data, old data. Imagine someone wants to add old spans into Tempo
I did a very similar fix a time ago:
#3954
We need to correct the end date or the block will be wrong
There was a problem hiding this comment.
using start instead of startOfRange makes sense to me because it addresses both scenarios. If the start is before the startOfRange it has been already adjusted. In the edge case where end < startOfRange < start it fixes it as well
There was a problem hiding this comment.
In the edge case where end < startOfRange < start it fixes it as well
This is what I meant by wrong data, end < start is logically incorrect.
There was a problem hiding this comment.
Internally during a test block builders flushed several blocks in a row with meta.start==meta.end. I'm not sure that this change is the fix, because the only related change is the case end after endOfRange. Previously it was set to start and now it's endOfRange. For this to be the issue it would have to mean that every trace in the block was a long-running one that exceeds the buffer s.startTime.Add(s.slackDuration + s.cycleDuration). I'd like to dig more and see if there is another explanation.
mapno
left a comment
There was a problem hiding this comment.
LGTM. I think end.Before(start) is safe but feels a bit strange.
| if end.Before(start) { | ||
| warn = true | ||
| end = start | ||
| } |
There was a problem hiding this comment.
In the edge case where end < startOfRange < start it fixes it as well
This is what I meant by wrong data, end < start is logically incorrect.
What this PR does:
This fixes the previous behavior, where the end date was always set to the start time. This was a translation of our behavior in the ingesters, where the start and end dates are set to now() if they are outside the time range.
How it works now:
It checks independently the start and the end.
If the end is before the start it will set it to the start
If the end is after the end range it will set it to the end range
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]