-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat(filter,cli): add remove future metrics in cli and discarding metrics written into the future #1012
feat(filter,cli): add remove future metrics in cli and discarding metrics written into the future #1012
Changes from 8 commits
640cc13
99b7372
32ef3cd
2ae3bba
579d20a
25406f9
a5e13ea
959e096
4c8004d
dacd49e
75533f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,14 +46,15 @@ var plotting = flag.Bool("plotting", false, "enable images in all notifications" | |
var removeSubscriptions = flag.String("remove-subscriptions", "", "Remove given subscriptions separated by semicolons.") | ||
|
||
var ( | ||
cleanupUsers = flag.Bool("cleanup-users", false, "Disable/delete contacts and subscriptions of missing users") | ||
cleanupLastChecks = flag.Bool("cleanup-last-checks", false, "Delete abandoned triggers last checks.") | ||
cleanupTags = flag.Bool("cleanup-tags", false, "Delete abandoned tags.") | ||
cleanupMetrics = flag.Bool("cleanup-metrics", false, "Delete outdated metrics.") | ||
cleanupRetentions = flag.Bool("cleanup-retentions", false, "Delete abandoned retentions.") | ||
userDel = flag.String("user-del", "", "Delete all contacts and subscriptions for a user") | ||
fromUser = flag.String("from-user", "", "Transfer subscriptions and contacts from user.") | ||
toUser = flag.String("to-user", "", "Transfer subscriptions and contacts to user.") | ||
cleanupUsers = flag.Bool("cleanup-users", false, "Disable/delete contacts and subscriptions of missing users") | ||
cleanupLastChecks = flag.Bool("cleanup-last-checks", false, "Delete abandoned triggers last checks.") | ||
cleanupTags = flag.Bool("cleanup-tags", false, "Delete abandoned tags.") | ||
cleanupMetrics = flag.Bool("cleanup-metrics", false, "Delete outdated metrics.") | ||
cleanupFutureMetrics = flag.Bool("cleanup-future-metrics", false, "Delete metrics from the database written to the future.") | ||
cleanupRetentions = flag.Bool("cleanup-retentions", false, "Delete abandoned retentions.") | ||
userDel = flag.String("user-del", "", "Delete all contacts and subscriptions for a user") | ||
fromUser = flag.String("from-user", "", "Transfer subscriptions and contacts from user.") | ||
toUser = flag.String("to-user", "", "Transfer subscriptions and contacts to user.") | ||
) | ||
|
||
var ( | ||
|
@@ -231,8 +232,8 @@ func main() { //nolint | |
log := logger.String(moira.LogFieldNameContext, "cleanup-metrics") | ||
|
||
log.Info().Msg("Cleanup of outdated metrics started") | ||
err := handleCleanUpOutdatedMetrics(confCleanup, database) | ||
if err != nil { | ||
|
||
if err := handleCleanUpOutdatedMetrics(confCleanup, database); err != nil { | ||
log.Error(). | ||
Error(err). | ||
Msg("Failed to cleanup outdated metrics") | ||
|
@@ -252,6 +253,20 @@ func main() { //nolint | |
log.Info().Msg("Cleanup of outdated metrics finished") | ||
} | ||
|
||
if *cleanupFutureMetrics { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. тоже спрошу, не хотим ли мы все это сразу в отчистку метрик добавить, чтобы не плодить ключики? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Мне кажется, это не нужно, тк операция удаления метрик в будущее довольно тяжелая, тк требует прохода по всем метрикам, в идеале 1 раз удалить метрики, уже записанные, а все новые, пишущиеcя в будущее, и так будут откидываться |
||
log := logger.String(moira.LogFieldNameContext, "cleanup-future-metrics") | ||
|
||
log.Info().Msg("Cleanup of future metrics started") | ||
|
||
if err := handleCleanUpFutureMetrics(confCleanup, database); err != nil { | ||
log.Error(). | ||
Error(err). | ||
Msg("Failed to cleanup future metrics") | ||
} | ||
|
||
log.Info().Msg("Cleanup of future metrics finished") | ||
} | ||
|
||
if *cleanupLastChecks { | ||
log := logger.String(moira.LogFieldNameContext, "cleanup-last-checks") | ||
|
||
|
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.
Мне кажется, сейчас неконсистентно с хелпами по другим ключам
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.
Поправил