stats: Add universal stats tag from CLI#18668
Conversation
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
|
/retest |
|
Retrying Azure Pipelines: |
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
5d5b48c to
44bc363
Compare
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
|
I am investigating the failure in the memory tests but the PR should be ready to review while I fix the failing test |
jmarantz
left a comment
There was a problem hiding this comment.
Looks fine; really just a collection of small nits.
docs/root/operations/cli.rst
Outdated
|
|
||
| .. option:: --stats-tag | ||
|
|
||
| *(optional)* This flag provides a universal tag for all stats generated by Envoy. The format is ``stat:value``. |
There was a problem hiding this comment.
Should we have restrictions about what sort of characters are allowed in stat or value here?
Obviously : cannot be allowed in stat. What about .?
Are multiple values for the same tag allowed, e.g. --stat foo:bar --stat foo:baz ? From the impl it looks like the answer is no so should we specify it here?
There was a problem hiding this comment.
Should we have restrictions about what sort of characters are allowed in stat or value here?
From what I saw in the docs for TagSpecifier there shouldn't be any limitations.
Are multiple values for the same tag allowed, e.g. --stat foo:bar --stat foo:baz ?
I need to call out explicitly that duplicates are not allowed
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
|
/wait |
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
|
/wait |
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
jmarantz
left a comment
There was a problem hiding this comment.
Nice. Looking much better. A few minor nits remain.
source/common/stats/tag_utility.cc
Outdated
| } | ||
|
|
||
| bool isTagValueValid(absl::string_view name) { | ||
| std::regex regex{Config::NAME_REGEX, std::regex::optimize}; |
There was a problem hiding this comment.
In the existing code, NAME_REGEX is evaluated by RE2, not std::regex, so if you want consistency you should. use RE2 to test it.
source/common/stats/tag_utility.cc
Outdated
| bool isTagValueValid(absl::string_view name) { | ||
| std::regex regex{Config::NAME_REGEX, std::regex::optimize}; | ||
| int cntr = 0; | ||
| for (auto i = std::regex_iterator<absl::string_view::iterator>(name.begin(), name.end(), regex); |
There was a problem hiding this comment.
rather than iterating I'd just use a regex with begin/end anchors.
source/server/options_impl.cc
Outdated
| "However, multiple stats with different values are not allowed.", | ||
| "``tag:value``. Only alphanumeric values are allowed for tag names. For tag values all " | ||
| "characters are permitted except for '.' (dot). This flag can be repeated multiple times to " | ||
| "set multiple universal tags. However, multiple stats with different values are not allowed.", |
There was a problem hiding this comment.
Maybe this is enough to establish the "envoy standard" but let's make sure @ggreenway and @snowp buy into this syntax.
I wasn't sure what you meant by the last sentence. Did you mean "multiple values for the same tag name are not allowed"?
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
|
/retest |
|
Retrying Azure Pipelines: |
|
(unrelated test issues) |
| namespace { | ||
|
|
||
| const absl::string_view NAME_REGEX = R"([^\.]+)"; | ||
|
|
There was a problem hiding this comment.
constexpr absl::string_view TAG_VALUE_REGEX = R"([^\.]+)";
and s/NAME_REGEX/TAG_VALUE_REGEX throughout?
|
|
||
| } // namespace | ||
|
|
||
| const Regex::CompiledGoogleReMatcher& validTagValue() { |
There was a problem hiding this comment.
expose a bool function rather than returning the complex interface which the caller then has to call. This also allows the freedom of changing the implementation without changing the uses.
You will still need a function that returns the interface as a private helper.
There was a problem hiding this comment.
expose a bool function rather than returning the complex interface which the caller then has to call. This also allows the freedom of changing the implementation without changing the uses.
This is basically what I am doing but the function with the bool signature is in tag_utility header. I like it there more because it seems more intuitive but not a strong opinion
There was a problem hiding this comment.
That makes sense -- and you can have an interface in tag_utility.h, which can be an inline call to a bool method exposed here.
But exposing a CompiledGoogleReMatcher& here is a thicker coupling than necessary, IMO.
| } // namespace | ||
|
|
||
| const Regex::CompiledGoogleReMatcher& validTagValue() { | ||
| CONSTRUCT_ON_FIRST_USE(Regex::CompiledGoogleReMatcher, std::string(NAME_REGEX) + "$", false); |
There was a problem hiding this comment.
absl::StrCat("^", NAME_REGEX, "$")
this includes the begin-anchor, and absl::StrCat pre-allocates the right-size string for the 3-arg concat.
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
jmarantz
left a comment
There was a problem hiding this comment.
2 tiny nits remaining. This looks great.
I think I'll ask @ggreenway to do the final review as he may have an opinion about tag syntax.
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
|
thanks for all the reviews, it indeed looks much better now @jmarantz |
ggreenway
left a comment
There was a problem hiding this comment.
Looks good overall. A few nits.
/wait
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
|
/retest |
|
Retrying Azure Pipelines: |
- as of envoyproxy/envoy#18668 `Envoy::Config::Utility::createTagProducer` now takes a new parameter `Stats::TagVector`. - removed workaround that allowed the HTTP3 integration test to pass while Envoy assumed that `--max-concurrent-streams` is always 100. This was fixed in envoyproxy/envoy#18879. - no changes in `.bazelrc`, `.bazelversion` or `ci/run_envoy_docker.sh`. Signed-off-by: Jakub Sobon <mumak@google.com>
- as of envoyproxy/envoy#18668 `Envoy::Config::Utility::createTagProducer` now takes a new parameter `Stats::TagVector`. - removed workaround that allowed the HTTP3 integration test to pass while Envoy assumed that `--max-concurrent-streams` is always 100. This was fixed in envoyproxy/envoy#18879. - updated `tools/update_cli_readme_documentation.py` to match on custom markers rather than the backtick character, since one of the flags now contains backticks in its description. Marked sections for replacement with the custom edit markers in our documents. - executed `update_cli_readme_documentation --mode fix`. - no changes in `.bazelrc`, `.bazelversion` or `ci/run_envoy_docker.sh`. Signed-off-by: Jakub Sobon <mumak@google.com>
Commit Message:
Fixes #1975
Adds a CLI parameter that can be repeated that acts as universal tags for all stats
Additional Description:
Risk Level: Low, additional parameter
Testing: Unit + integration + manual
Docs Changes: Provided
Release Notes: Pending
Platform Specific Features: N/A
Signed-off-by: Sotiris Nanopoulos sonanopo@microsoft.com