-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[logging] Centralize configuration for trace flags #36576
base: master
Are you sure you want to change the base?
Conversation
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.
Pretty close now!
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 looks fantastic!
@drfloob : Please can you let me know approximately when this PR will be submitted. I will avoid editing the files in the PR for some time to avoid more merge conflicts for both of us. |
test/core/handshake/client_ssl.cc
Outdated
LOG(INFO) << absl::StrFormat("%20.20s - %30.30s - %5.10s", msg, | ||
SSL_state_string_long(ssl), | ||
SSL_state_string(ssl)); | ||
if (where & flag) { |
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.
I'd prefer (where & flag) != 0
here, for the same reasons we usually write != nullptr
for pointers -- this is an int not a bool.
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.
+1 -- but don't need the parens.
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.
Fixed. It does require parens though, !=
has higher precedence than &
. http://go/cppref/cpp/language/operator_precedence
@tanvi-jagtap Thanks. I'll try to wrap it up this week, I have a bit of codegen work to do. |
All TraceFlags are now configured in
src/core/lib/debug/trace_flags.yaml
. The format is:To regenerate the trace flag source code, run
tools/codegen/core/gen_trace_flags.py
(requires mako). This script is also run when sanity checking.This PR also adds two new features:
Glob-based flag configuration
Trace flag configuration now supports
?
(single wildcard character) and*
(one or more wildcard characters). For example, usingGRPC_TRACE='event_engine*'
will enable all flags that match that glob. It expands to:A cleaner trace-logging macro in abseil logging format
If your goal is only to add log statements when the
fault_injection_filter
trace flag is enabled, you can use the macro:When the trace flag is enabled, the the log will show something like this:
Note: just like with the gpr_log to abseil logging conversion, the pre-existing trace logging usages can be replaced with the new tracing macro across multiple PRs.