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

ref(crons): new merge/aggregate status functions without MonitorBucketEnvMapping #82566

Merged
merged 3 commits into from
Dec 26, 2024

Conversation

ameliahsu
Copy link
Member

introducing new functions to replace:

  • getAggregateStatus
  • getAggregateStatusFromMultipleBuckets
  • mergeEnvMappings

since checkinTimeline doesn't need to know anything about environment, we want to change these functions to take in StatsBucket instead of MonitorBucketEnvMapping types

replacing usage + deleting old functions will come in following PRs

@ameliahsu ameliahsu requested a review from a team as a code owner December 26, 2024 19:46
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Dec 26, 2024
Comment on lines 28 to 43
/**
* Given multiple stats buckets [{ok: 1, ...}, {ok: 0, ...}]
* returns the aggregate status across all buckets
*/
export function getAggregateStatusFromMultipleStatsBuckets(statsArr: StatsBucket[]) {
return statsArr
.map(getAggregateStatusFromStatsBucket)
.reduce(
(aggregateStatus, currentStatus) =>
CHECKIN_STATUS_PRECEDENT.indexOf(currentStatus) >
CHECKIN_STATUS_PRECEDENT.indexOf(aggregateStatus)
? currentStatus
: aggregateStatus,
CHECKIN_STATUS_PRECEDENT[0]
);
}
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to see better examples in the comments here, but not blocking on this.

@ameliahsu ameliahsu merged commit c11f4c0 into master Dec 26, 2024
42 checks passed
@ameliahsu ameliahsu deleted the mia/monitors/timeline-env branch December 26, 2024 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants