-
Notifications
You must be signed in to change notification settings - Fork 436
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
TOOLS/INFO: Optional name filter for config dump #10469
base: master
Are you sure you want to change the base?
Conversation
@@ -113,9 +114,9 @@ Christophe Harle | |||
Christopher Lamb | |||
Craig Stunkel | |||
Cydney Ewald Stevens | |||
Davide Rossetti | |||
Davide Rossetti |
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.
no need to remove trailing spaces in this PR, can be done separately
return; | ||
} | ||
|
||
if ((flags & UCS_CONFIG_PRINT_HEADER) && (*printed == 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.
we could check ucs_config_parser_is_filtered before calling ucs_config_parser_print_field, so that ucs_config_parser_print_field would not have to be made responsible for printing the header
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.
Right, I was undecided on this, however keeping the responsibility of printing the header in ucs_config_parser_print_opts()
means that it has to know in advance whether ucs_config_parser_print_opts_recurs()
will print anything via ucs_config_parse_print_field()
, and that seemed even more of a hassle. Did I miss something?
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.
What if ucs_config_parser_print_opts checked the filter before calling ucs_config_parser_print_field?
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.
Hm, but ucs_config_parser_print_opts()
calls ucs_config_parser_print_opts_recurs()
, which in turn calls both ucs_config_parser_print_opts_recurs()
and ucs_config_parser_print_field()
, possibly multiple times ... it seems that there is no shortcut to determine from the outside whether the top call to ucs_config_parser_print_opts_recurs()
will eventually lead to something being printed. Did I miss something?
src/ucs/config/parser.c
Outdated
char name_buf[128] = {0}; | ||
char value_buf[128] = {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.
char name_buf[128] = {0}; | |
char value_buf[128] = {0}; | |
char name_buf[128] = {0}; | |
char value_buf[128] = {0}; |
test/gtest/ucs/test_config.cc
Outdated
@@ -428,7 +428,7 @@ class test_config : public ucs::test { | |||
FILE *file = open_memstream(&dump_data, &dump_size); | |||
ucs_config_parser_print_opts(file, "", *opts, car_opts_table, | |||
prefix, UCS_DEFAULT_ENV_PREFIX, | |||
(ucs_config_print_flags_t)flags); | |||
(ucs_config_print_flags_t)flags, NULL); |
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.
you used nullptr in the other method above
test/gtest/ucs/test_config.cc
Outdated
const std::string dump1 = opts.dump(UCS_CONFIG_PRINT_CONFIG); | ||
const char filter[] = "TIME_"; | ||
const std::string dump2 = opts.dump(UCS_CONFIG_PRINT_CONFIG, filter); |
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.
const std::string dump1 = opts.dump(UCS_CONFIG_PRINT_CONFIG); | |
const char filter[] = "TIME_"; | |
const std::string dump2 = opts.dump(UCS_CONFIG_PRINT_CONFIG, filter); | |
const std::string dump1 = opts.dump(UCS_CONFIG_PRINT_CONFIG); | |
const char filter[] = "TIME_"; | |
const std::string dump2 = opts.dump(UCS_CONFIG_PRINT_CONFIG, filter); |
What?
Add optional filters for
ucx_info -c
anducx_info -f
to select which config parameters are printed.All additional command line arguments toucx_info -c
anducx_info -f
are used as disjunctive substring filter, e.g.ucx_info -c TCP LOG
will only print config parameters that containTCP
and/orLOG
.When
-F string
is passed in addition to-c
and/or-f
then only config parameters whose name containsstring
are printed.