Skip to content

stats: Add universal stats tag from CLI#18668

Merged
jmarantz merged 19 commits intoenvoyproxy:mainfrom
davinci26:statsPrefix
Nov 4, 2021
Merged

stats: Add universal stats tag from CLI#18668
jmarantz merged 19 commits intoenvoyproxy:mainfrom
davinci26:statsPrefix

Conversation

@davinci26
Copy link
Copy Markdown
Member

@davinci26 davinci26 commented Oct 18, 2021

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

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/envoy/.
envoyproxy/api-shepherds assignee is @markdroth
CC @envoyproxy/api-watchers: FYI only for changes made to api/envoy/.

🐱

Caused by: #18668 was opened by davinci26.

see: more, trace.

@davinci26
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #18668 (comment) was created by @davinci26.

see: more, trace.

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Sotiris Nanopoulos added 3 commits October 19, 2021 14:13
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@davinci26
Copy link
Copy Markdown
Member Author

I am investigating the failure in the memory tests but the PR should be ready to review while I fix the failing test

Copy link
Copy Markdown
Contributor

@jmarantz jmarantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine; really just a collection of small nits.


.. option:: --stats-tag

*(optional)* This flag provides a universal tag for all stats generated by Envoy. The format is ``stat:value``.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Sotiris Nanopoulos added 3 commits October 21, 2021 11:31
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@jmarantz
Copy link
Copy Markdown
Contributor

/wait

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@jmarantz
Copy link
Copy Markdown
Contributor

/wait

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @markdroth
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #18668 was synchronize by davinci26.

see: more, trace.

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Copy link
Copy Markdown
Contributor

@jmarantz jmarantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Looking much better. A few minor nits remain.

}

bool isTagValueValid(absl::string_view name) {
std::regex regex{Config::NAME_REGEX, std::regex::optimize};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than iterating I'd just use a regex with begin/end anchors.

"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.",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"?

Sotiris Nanopoulos added 2 commits November 1, 2021 19:11
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@davinci26
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #18668 (comment) was created by @davinci26.

see: more, trace.

@davinci26
Copy link
Copy Markdown
Member Author

(unrelated test issues)

namespace {

const absl::string_view NAME_REGEX = R"([^\.]+)";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constexpr absl::string_view TAG_VALUE_REGEX = R"([^\.]+)";

and s/NAME_REGEX/TAG_VALUE_REGEX throughout?


} // namespace

const Regex::CompiledGoogleReMatcher& validTagValue() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

absl::StrCat("^", NAME_REGEX, "$")

this includes the begin-anchor, and absl::StrCat pre-allocates the right-size string for the 3-arg concat.

Sotiris Nanopoulos added 2 commits November 2, 2021 11:10
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
jmarantz
jmarantz previously approved these changes Nov 2, 2021
Copy link
Copy Markdown
Contributor

@jmarantz jmarantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@davinci26
Copy link
Copy Markdown
Member Author

thanks for all the reviews, it indeed looks much better now @jmarantz

jmarantz
jmarantz previously approved these changes Nov 2, 2021
Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. A few nits.

/wait

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@davinci26
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #18668 (comment) was created by @davinci26.

see: more, trace.

@jmarantz jmarantz merged commit c75c141 into envoyproxy:main Nov 4, 2021
mum4k added a commit to mum4k/nighthawk that referenced this pull request Nov 9, 2021
- 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>
dubious90 pushed a commit to envoyproxy/nighthawk that referenced this pull request Nov 9, 2021
- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stats: add universal tag support

5 participants