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

Pods upgrade: log a summary of failed predicates #2128

Merged
merged 3 commits into from
Nov 20, 2019

Conversation

barkbay
Copy link
Contributor

@barkbay barkbay commented Nov 18, 2019

Follow up of #2099

This pr reduces the verbosity of the logs when nodes can't be restarted because of some failing predicates:

before:

{"level":"info","@timestamp":"2019-11-18T13:36:45.996Z","logger":"elasticsearch-controller","message":"Starting reconciliation run","ver":"1.0.0-beta1-16b253de","iteration":7,"namespace":"default","name":"elasticsearch-sample"}
{"level":"info","@timestamp":"2019-11-18T13:36:46.282Z","logger":"kibana-association-controller","message":"Ending reconciliation run","ver":"1.0.0-beta1-16b253de","iteration":6,"namespace":"default","name":"kibana-sample","took":0.287476481}
{"level":"info","@timestamp":"2019-11-18T13:36:46.810Z","logger":"zen2","message":"Ensuring no voting exclusions are set","ver":"1.0.0-beta1-16b253de","namespace":"default","es_name":"elasticsearch-sample"}
{"level":"info","@timestamp":"2019-11-18T13:36:46.875Z","logger":"driver","message":"Predicate failed","ver":"1.0.0-beta1-16b253de","pod_name":"elasticsearch-sample-es-default-7","predicate_name":"do_not_restart_healthy_node_if_not_green"}
{"level":"info","@timestamp":"2019-11-18T13:36:46.875Z","logger":"driver","message":"Predicate failed","ver":"1.0.0-beta1-16b253de","pod_name":"elasticsearch-sample-es-default-6","predicate_name":"do_not_restart_healthy_node_if_not_green"}
{"level":"info","@timestamp":"2019-11-18T13:36:46.875Z","logger":"driver","message":"Predicate failed","ver":"1.0.0-beta1-16b253de","pod_name":"elasticsearch-sample-es-default-5","predicate_name":"do_not_restart_healthy_node_if_not_green"}
{"level":"info","@timestamp":"2019-11-18T13:36:46.875Z","logger":"driver","message":"Predicate failed","ver":"1.0.0-beta1-16b253de","pod_name":"elasticsearch-sample-es-default-4","predicate_name":"do_not_restart_healthy_node_if_not_green"}
{"level":"info","@timestamp":"2019-11-18T13:36:46.875Z","logger":"driver","message":"Predicate failed","ver":"1.0.0-beta1-16b253de","pod_name":"elasticsearch-sample-es-default-3","predicate_name":"do_not_restart_healthy_node_if_not_green"}
{"level":"info","@timestamp":"2019-11-18T13:36:46.875Z","logger":"driver","message":"Predicate failed","ver":"1.0.0-beta1-16b253de","pod_name":"elasticsearch-sample-es-default-2","predicate_name":"do_not_restart_healthy_node_if_not_green"}
{"level":"info","@timestamp":"2019-11-18T13:36:46.875Z","logger":"driver","message":"Predicate failed","ver":"1.0.0-beta1-16b253de","pod_name":"elasticsearch-sample-es-default-1","predicate_name":"do_not_restart_healthy_node_if_not_green"}
{"level":"info","@timestamp":"2019-11-18T13:36:46.875Z","logger":"driver","message":"Predicate failed","ver":"1.0.0-beta1-16b253de","pod_name":"elasticsearch-sample-es-default-0","predicate_name":"do_not_restart_healthy_node_if_not_green"}
{"level":"info","@timestamp":"2019-11-18T13:36:46.891Z","logger":"elasticsearch-controller","message":"Updating status","ver":"1.0.0-beta1-16b253de","iteration":7,"namespace":"default","es_name":"elasticsearch-sample"}
{"level":"info","@timestamp":"2019-11-18T13:36:46.891Z","logger":"elasticsearch-controller","message":"Ending reconciliation run","ver":"1.0.0-beta1-16b253de","iteration":7,"namespace":"default","name":"elasticsearch-sample","took":0.895109087}

with the pr:

{"level":"info","@timestamp":"2019-11-18T13:46:14.841Z","logger":"elasticsearch-controller","message":"Starting reconciliation run","ver":"1.0.0-beta1-7c26b998","iteration":30,"namespace":"default","name":"elasticsearch-sample"}
{"level":"info","@timestamp":"2019-11-18T13:46:15.501Z","logger":"zen2","message":"Ensuring no voting exclusions are set","ver":"1.0.0-beta1-7c26b998","namespace":"default","es_name":"elasticsearch-sample"}
{"level":"info","@timestamp":"2019-11-18T13:46:15.549Z","logger":"driver","message":"Nodes can't be upgraded","ver":"1.0.0-beta1-7c26b998","namespace":"default","es_name":"elasticsearch-sample","failedPredicates":{"do_not_restart_healthy_node_if_not_green":["elasticsearch-sample-es-default-7","elasticsearch-sample-es-default-6","elasticsearch-sample-es-default-5","elasticsearch-sample-es-default-4","elasticsearch-sample-es-default-3","elasticsearch-sample-es-default-2","elasticsearch-sample-es-default-1","elasticsearch-sample-es-default-0"]}}
{"level":"info","@timestamp":"2019-11-18T13:46:15.552Z","logger":"elasticsearch-controller","message":"Updating status","ver":"1.0.0-beta1-7c26b998","iteration":30,"namespace":"default","es_name":"elasticsearch-sample"}
{"level":"info","@timestamp":"2019-11-18T13:46:15.552Z","logger":"elasticsearch-controller","message":"Ending reconciliation run","ver":"1.0.0-beta1-7c26b998","iteration":30,"namespace":"default","name":"elasticsearch-sample","took":0.711200508}

"Nodes can't be upgraded",
"namespace", ctx.es.Namespace,
"es_name", ctx.es.Name,
"failedPredicates", groupByPredicates(failedPredicates))
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: maybe stay in snake case to be consistent with the other fields: failed_predicates.

Copy link
Contributor

@thbkrkr thbkrkr left a comment

Choose a reason for hiding this comment

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

LGTM

// the user to understand why.
if len(failedPredicates) > 0 {
log.Info(
"Nodes can't be upgraded",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we rephrase this? Something like "Cannot proceed with upgrade of some nodes at this time" Something that makes it sound less final?

predicate string
}

func newFailedPredicate(pod, predicate string) *failedPredicate {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if the non-exported constructor on a non-exported trivial struct adds much?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry for the drive-by comments!

@barkbay barkbay merged commit 134f48c into elastic:master Nov 20, 2019
@barkbay barkbay deleted the predicate-one-summary branch November 20, 2019 08:05
@barkbay barkbay added v1.0.0 >enhancement Enhancement of existing functionality labels Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants