-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
rbac: add some debug logging. #3744
Conversation
Signed-off-by: Yangmin Zhu <ymzhu@google.com>
Signed-off-by: Yangmin Zhu <ymzhu@google.com>
It seems the coverage test is running at debug level which caused the test fail:
I changed the test to not to check exactly called times. The better way probably should to increase the expect_times by 1 when in debug mode, but not sure if this is a common way in Envoy. |
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.
Thanks, some small comments.
address_ = Envoy::Network::Utility::parseInternetAddress("1.2.3.4", port, false); | ||
auto& expect = EXPECT_CALL(connection_, localAddress()); | ||
if (times > 0) { | ||
expect.Times(times); | ||
if (at_most_times > 0) { |
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.
This isn't a useful expectation. Please just make this an ON_CALL(...).WillByDefault(...)
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.
Done
@@ -65,13 +65,30 @@ RoleBasedAccessControlRouteSpecificFilterConfig::RoleBasedAccessControlRouteSpec | |||
|
|||
Http::FilterHeadersStatus RoleBasedAccessControlFilter::decodeHeaders(Http::HeaderMap& headers, | |||
bool) { | |||
ENVOY_LOG( | |||
debug, | |||
"checking request:\n" |
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.
Debug lines in general should be single line. Please remove the newlines.
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.
Done
@@ -65,13 +65,30 @@ RoleBasedAccessControlRouteSpecificFilterConfig::RoleBasedAccessControlRouteSpec | |||
|
|||
Http::FilterHeadersStatus RoleBasedAccessControlFilter::decodeHeaders(Http::HeaderMap& headers, | |||
bool) { | |||
ENVOY_LOG( | |||
debug, | |||
"checking request:\n" |
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.
"checking request" isn't a very descriptive message. Either make a new "rbac" log type, or prefix all of the messages you added with "rbac: " (or something similar).
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.
Thanks for the suggestion, I added a new "rbac" log type.
Signed-off-by: Yangmin Zhu <ymzhu@google.com>
source/common/common/logger.h
Outdated
@@ -45,7 +45,8 @@ namespace Logger { | |||
FUNCTION(upstream) \ | |||
FUNCTION(grpc) \ | |||
FUNCTION(stats) \ | |||
FUNCTION(thrift) | |||
FUNCTION(thrift) \ | |||
FUNCTION(rbac) |
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.
please alpha order
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.
Done.
Signed-off-by: Yangmin Zhu <ymzhu@google.com>
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.
Nice, thanks
Signed-off-by: Yangmin Zhu ymzhu@google.com
Description: Added some log for help debugging
Risk Level: Low
Testing: n/a
Docs Changes: n/a
Release Notes: n/a
@lizan @mattklein123 @rodaine
Thank you!