-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Query and Precompute Non-Contiguous Segments in the Activity Log #15352
Conversation
Co-authored-by: Chris Capurso <1036769+ccapurso@users.noreply.github.com>
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.
Looks good, thanks for taking the time to answer my questions!
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.
it looks like this got merged while i was reviewing, but overall i think it looks good. here were the comments i was in the process of leaving
endTime := time.Unix(val, 0).UTC() | ||
s.logger.Trace("end time in consideration is", "end time", endTime, "end time bound", endTimeBound) | ||
if endTime.After(maxEndTime) && !endTime.After(endTimeBound) { | ||
s.logger.Trace("end time has been updated") |
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.
do you still want this in here?
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.
probably applies to some of the other Trace()
logs too
s.logger.Trace("end time has been updated") | ||
maxEndTime = endTime | ||
} | ||
|
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.
nit: did you want this newline in here?
closestStartTime := time.Time{} | ||
closestEndTime := time.Time{} | ||
maxTimeDifference := time.Duration(0) | ||
for i := len(filteredList) - 1; i >= 0; i-- { |
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.
all nits
-
is there a reason why we're doing a reverse for loop? i think it might be a bit easier to read with a range loop
-
do you think it makes sense to break this off into its own separate function? it might make it a bit easier to test this logic, and it also might make it more understandable for future engineers
i only ask these things because activity log is growing fairly hard to dive into and understand for those less familiar
@@ -483,6 +483,23 @@ func (a *ActivityLog) getMostRecentActivityLogSegment(ctx context.Context) ([]ti | |||
return timeutil.GetMostRecentContiguousMonths(logTimes), nil | |||
} | |||
|
|||
// getMostRecentActivityLogSegment gets the times (in UTC) associated with the most recent |
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.
love the UTC callout!
@@ -483,6 +483,23 @@ func (a *ActivityLog) getMostRecentActivityLogSegment(ctx context.Context) ([]ti | |||
return timeutil.GetMostRecentContiguousMonths(logTimes), nil | |||
} | |||
|
|||
// getMostRecentActivityLogSegment gets the times (in UTC) associated with the most recent | |||
// contiguous set of activity logs, sorted in decreasing order (latest to earliest) |
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.
does latest to earliest
== most to least recent
?
…hicorp#15352) * query and precompute non-contiguous segments in the activity log * changelog * newline formatting * make fmt * report listener and storage types as found keys * report listener and storage types as found keys * Update vault/activity_log_test.go Co-authored-by: Chris Capurso <1036769+ccapurso@users.noreply.github.com> * review comments * merge conflict * merge conflict * merge conflict * fix unchecked merge conflict Co-authored-by: Chris Capurso <1036769+ccapurso@users.noreply.github.com>
This PR: