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

Add warning message for implicit meta endorsement policy failure #897

Closed
wants to merge 1 commit into from
Closed

Add warning message for implicit meta endorsement policy failure #897

wants to merge 1 commit into from

Conversation

denyeart
Copy link
Contributor

Type of change

  • Improvement to logging

Description

Many users are unable to troubleshoot endorsement policy failures.

This change shifts a debug message to a warning message so that peer
will log the reason for the endorsement policy failure.

E.g. the following warning message will now help users troubleshoot the
reason for the failure:

"Evaluation Failed: Only 0 policies were satisfied,
but needed 2 of [ Org2MSP/Endorsement Org1MSP/Endorsement ]"

Also, the policy name is now added to associated error messages,
so that users know where to change the policy.

Signed-off-by: David Enyeart enyeart@us.ibm.com

Many users are unable to troubleshoot endorsement policy failures.

This change shifts a debug message to a warning message so that peer
will log the reason for the endorsement policy failure.

E.g. the following warning message will now help users troubleshoot the
reason for the failure:

"Evaluation Failed: Only 0 policies were satisfied,
but needed 2 of [ Org2MSP/Endorsement Org1MSP/Endorsement ]"

Also, the policy name is now added to associated error messages,
so that users know where to change the policy.

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
@denyeart denyeart requested a review from a team as a code owner March 22, 2020 15:33
Copy link
Contributor

@jyellick jyellick left a comment

Choose a reason for hiding this comment

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

-2

Have you actually looked at logs with this tracing enabled? In particular, look at an orderer log. I expect you will see this warning spewed constantly, even when there are no policy failures.

The meta-policy concept is that result of the policy is a combination of the results of the sub-policies. So, for something like the /Channel/Writers policy, which evaluates the /Channel/Orderer/Writers policy and the /Channel/Application/Writers policy, it's expected that usually, one of these policy evaluations will fail. So, with every transaction in the log, you will see a warning message.

This is fixable, but requires a much more invasive change. The correct way to fix this, is to build up the log message during the evaluations, but not evaluate it unless the top-level policy fails. Essentially, pass back the "If I fail" log message each time, and eventually, once the caller (who is the only one who is aware whether the policy evaluation actually failed) can emit a message at an appropriate log level.

@denyeart
Copy link
Contributor Author

Ok, it just looked so good in my single org channel logs :-)

@denyeart denyeart closed this Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants