-
Notifications
You must be signed in to change notification settings - Fork 852
traffic_ctl: Add --append option to append debug tags instead of replacing them. (inc ArgParser support).
#12804
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -695,12 +695,31 @@ ServerCommand::server_debug() | |
| { | ||
| // Set ATS to enable or disable debug at runtime. | ||
| const bool enable = get_parsed_arguments()->get(ENABLE_STR); | ||
| const bool append = get_parsed_arguments()->get(APPEND_STR); | ||
|
|
||
| // If the following is not passed as options then the request will ignore them as default values | ||
| // will be set. | ||
| const std::string tags = get_parsed_arguments()->get(TAGS_STR).value(); | ||
| std::string tags = get_parsed_arguments()->get(TAGS_STR).value(); | ||
| const std::string client_ip = get_parsed_arguments()->get(CLIENT_IP_STR).value(); | ||
|
|
||
| // If append mode is enabled and tags are provided, fetch current tags and combine | ||
| if (append && !tags.empty()) { | ||
| shared::rpc::RecordLookupRequest lookup_request; | ||
| lookup_request.emplace_rec("proxy.config.diags.debug.tags", shared::rpc::NOT_REGEX, shared::rpc::CONFIG_REC_TYPES); | ||
| auto lookup_response = invoke_rpc(lookup_request); | ||
|
|
||
| if (!lookup_response.is_error()) { | ||
| auto const &records = lookup_response.result.as<shared::rpc::RecordLookUpResponse>(); | ||
| if (!records.recordList.empty()) { | ||
| std::string current_tags = records.recordList[0].currentValue; | ||
| if (!current_tags.empty()) { | ||
| // Combine: current|new | ||
| tags = current_tags + "|" + tags; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+705
to
+721
|
||
|
|
||
| const SetDebugServerRequest request{enable, tags, client_ip}; | ||
| shared::rpc::JSONRPCResponse const &response = invoke_rpc(request); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.