Skip to content

Conversation

ostromart
Copy link
Contributor

First batch of errors restructured to use the error dictionary where appropriate.

@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 9, 2020
@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Aug 9, 2020
@ostromart ostromart requested a review from richardwxn August 9, 2020 21:43
OperatorFailedToRemoveFinalizer = &structured.Error{
MoreInfo: "This error occurred because the finalizer set by the operator controller could not be removed " +
"when the IstioOperator CR was deleted.",
Impact: "The error indicates that the IstioOperator CR can not be removed by the operator controller.",
Copy link
Member

Choose a reason for hiding this comment

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

meta comment: do we want to be so verbose/wordy? ie do we want

impact=IstioOperator CR can not be removed by the operator controller

or

impact=The error indicates that the IstioOperator CR can not be removed by the operator controller.

IMO if we want to use plain english proper sentences we should have an arbitrary blob (ie old log.Errorf but write good messages). If we are going to use structured logging lets make use of the fields instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, yes on reflection i think the wordiness doesn't help much with the actual error and just adds more text. the same can probably be said of go comment style and i've probably been brainwashed by writing too much go. let's make the guideline to be comprehensible but minimal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed, ptal.

ActionIfErrPersistsContactSupport = "If this error persists, " + ActionContactSupport
ActionIfErrSureCorrectConfigContactSupport = "If you are sure your configuration is correct, " + ActionContactSupport
ActionContactSupport = "contact support if using managed Istio. Otherwise check if the issue is already fixed in " +
"another version of Istio at https://github.com/istio/istio/issues, raise an issue, or ask for help in " +
Copy link
Member

Choose a reason for hiding this comment

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

nit: do we want to just like to some like like https://istio.io/latest/about/bugs/ so this isn't so verbose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good suggestion, thanks, done.

@@ -380,7 +384,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
if err != nil {
return err
}
log.Info("Controller added")
scope.Info("Controller added.")
Copy link
Member

Choose a reason for hiding this comment

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

by some poor grep, I think that <1% of logs are ending with a period today, nor are kubernetes or envoy logs. Should we be consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

where things get weird is when we have multiple sentences. period after the first but not the last?
i agree about consistency but this one may be a bit of a grey area that i'd be happy to leave to individual discretion.

var jwtPolicy util.JWTPolicy
if jwtPolicy, err = util.DetectSupportedJWTPolicy(r.config); err != nil {
log.Warnf("Failed to detect third-party JWT support: %v", err)
// TODO: add to dictionary. {status=New, assignee=}
Copy link
Member

Choose a reason for hiding this comment

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

What is {status=New, assignee=}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

assignee=howardjohn :-)
i want to have some annotation to keep track of log entries that need fixing but also want to capture WontFix type of resolution if the assignee things the status quo is fine. how about this instead:

TODO(): add to dictionary. When resolved, replace this sentence with Done or WontFix.

return reconcile.Result{}, nil
}
log.Errorf("Failed to update IstioOperator with finalizer, %v", err)
scope.Errorf(errdict.OperatorFailedToAddFinalizer, "Failed to add finalizer to IstioOperator CR %s: %s", iopName, err)
Copy link
Member

Choose a reason for hiding this comment

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

So this will log:

Failed to add finalizer to IstioOperator CR foobar: some error message moreInfo=This error occurred because a finalizer could not be added to the IstioOperator CR. The controller uses the finalizer to temporarily prevent the CR from being deleted while the Istio control plane is being deleted. impact=The error indicates that when the IstioOperator CR is deleted, the Istio control plane may not be fully removed. action=Delete and re-add the IstioOperator CR. If this error persists, contact support if using managed Istio. Otherwise check if the issue is already fixed in another version of Istio at https://github.com/istio/istio/issues, raise an issue, or ask for help in discuss.istio.io. likelyCause=a problem with the k8s API server

Did we need 112 words to express this? It seems a bit repetative

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i agree, per your other comments i'm trimming things back. but keep in mind that this is an error which should be an exceptional condition. if it's spamming repeatedly, that should be fixed. otherwise i haven't ever heard users complaining that an error message was too verbose :-)

@ostromart
Copy link
Contributor Author

thanks for the detailed review @howardjohn. addressed comments, ptal.

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Aug 20, 2020
@istio-testing istio-testing removed the needs-rebase Indicates a PR needs to be rebased before being merged label Aug 29, 2020
var jwtPolicy util.JWTPolicy
if jwtPolicy, err = util.DetectSupportedJWTPolicy(r.config); err != nil {
log.Warnf("Failed to detect third-party JWT support: %v", err)
// TODO(howardjohn): add to dictionary. When resolved, replace this sentence with Done or WontFix - if WontFix, add reason.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is a good idea.. do we expect every single log to have a comment with Done or WontFix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

only temporarily, once we've scrubbed/fixed the logs i'll remove all these.
i couldn't think of a better way to track which messages have been cleaned up but i'm open to suggestions.

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Aug 31, 2020
@istio-testing istio-testing removed the needs-rebase Indicates a PR needs to be rebased before being merged label Sep 2, 2020
@istio-testing
Copy link
Collaborator

@ostromart: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
release-notes_istio 6de81fb link /test release-notes_istio

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@istio-testing istio-testing merged commit 2d39303 into istio:master Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants