-
Notifications
You must be signed in to change notification settings - Fork 5.3k
stats: Add universal stats tag from CLI #18668
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
44bc363
Fixes #1975
fe4dc28
fix remaining compilation issues
47213a7
fix formatting
01af8ae
fix benchmark test
36f26c7
Address comments part 1
6593ad3
change to use Stats::TagVector, verifying format
3786950
formating and reverting changes in tests
08fe30b
fix order in includes
da5398b
fix all comments. Still using walnum
7db7ea5
proposed limitation to only . and whitespace characters
4f0dd6f
use absl version of isspace
2db3169
improve the checks for tag values/names
76a51de
fix whitespace change
0511d8a
avoid static variables and use re2
9185f89
remove commented out code
b50bef6
make the interface depend on bool values rather than regex impl
1fd046a
format
1c12312
fix two nits
efd3b5a
switch to string split instead of find
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,8 @@ namespace Config { | |
|
|
||
| namespace { | ||
|
|
||
| const absl::string_view TAG_VALUE_REGEX = R"([^\.]+)"; | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and s/NAME_REGEX/TAG_VALUE_REGEX throughout? |
||
| // To allow for more readable regular expressions to be declared below, and to | ||
| // reduce duplication, define a few common pattern substitutions for regex | ||
| // segments. | ||
|
|
@@ -18,14 +20,23 @@ std::string expandRegex(const std::string& regex) { | |
| // underscores. | ||
| {"<CIPHER>", R"([\w-]+)"}, | ||
| // A generic name can contain any character except dots. | ||
| {"<NAME>", R"([^\.]+)"}, | ||
| {"<TAG_VALUE>", TAG_VALUE_REGEX}, | ||
| // Route names may contain dots in addition to alphanumerics and | ||
| // dashes with underscores. | ||
| {"<ROUTE_CONFIG_NAME>", R"([\w-\.]+)"}}); | ||
| } | ||
|
|
||
| const Regex::CompiledGoogleReMatcher& validTagValueRegex() { | ||
davinci26 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| CONSTRUCT_ON_FIRST_USE(Regex::CompiledGoogleReMatcher, absl::StrCat("^", TAG_VALUE_REGEX, "$"), | ||
| false); | ||
| } | ||
|
|
||
| } // namespace | ||
|
|
||
| bool doesTagNameValueMatchInvalidCharRegex(absl::string_view name) { | ||
| return validTagValueRegex().match(name); | ||
| } | ||
|
|
||
| TagNameValues::TagNameValues() { | ||
| // Note: the default regexes are defined below in the order that they will typically be matched | ||
| // (see the TagExtractor class definition for an explanation of the iterative matching process). | ||
|
|
@@ -53,22 +64,25 @@ TagNameValues::TagNameValues() { | |
| addRe2(RESPONSE_CODE_CLASS, R"(_rq_((\d))xx$)", "_rq_"); | ||
|
|
||
| // http.[<stat_prefix>.]dynamodb.table.[<table_name>.]capacity.[<operation_name>.](__partition_id=<last_seven_characters_from_partition_id>) | ||
| addRe2(DYNAMO_PARTITION_ID, | ||
| R"(^http\.<NAME>\.dynamodb\.table\.<NAME>\.capacity\.<NAME>(\.__partition_id=(\w{7}))$)", | ||
| ".dynamodb.table."); | ||
| addRe2( | ||
| DYNAMO_PARTITION_ID, | ||
| R"(^http\.<TAG_VALUE>\.dynamodb\.table\.<TAG_VALUE>\.capacity\.<TAG_VALUE>(\.__partition_id=(\w{7}))$)", | ||
| ".dynamodb.table."); | ||
|
|
||
| // http.[<stat_prefix>.]dynamodb.operation.(<operation_name>.)* or | ||
| // http.[<stat_prefix>.]dynamodb.table.[<table_name>.]capacity.(<operation_name>.)[<partition_id>] | ||
| addRe2(DYNAMO_OPERATION, | ||
| R"(^http\.<NAME>\.dynamodb.(?:operation|table\.<NAME>\.capacity)(\.(<NAME>))(?:\.|$))", | ||
| ".dynamodb."); | ||
| addRe2( | ||
| DYNAMO_OPERATION, | ||
| R"(^http\.<TAG_VALUE>\.dynamodb.(?:operation|table\.<TAG_VALUE>\.capacity)(\.(<TAG_VALUE>))(?:\.|$))", | ||
| ".dynamodb."); | ||
|
|
||
| // mongo.[<stat_prefix>.]collection.[<collection>.]callsite.(<callsite>.)query.* | ||
| addTokenized(MONGO_CALLSITE, "mongo.*.collection.*.callsite.$.query.**"); | ||
|
|
||
| // http.[<stat_prefix>.]dynamodb.table.(<table_name>.)* or | ||
| // http.[<stat_prefix>.]dynamodb.error.(<table_name>.)* | ||
| addRe2(DYNAMO_TABLE, R"(^http\.<NAME>\.dynamodb.(?:table|error)\.((<NAME>)\.))", ".dynamodb."); | ||
| addRe2(DYNAMO_TABLE, R"(^http\.<TAG_VALUE>\.dynamodb.(?:table|error)\.((<TAG_VALUE>)\.))", | ||
| ".dynamodb."); | ||
|
|
||
| // mongo.[<stat_prefix>.]collection.(<collection>.)query.* | ||
| addTokenized(MONGO_COLLECTION, "mongo.*.collection.$.**.query.*"); | ||
|
|
@@ -92,7 +106,8 @@ TagNameValues::TagNameValues() { | |
| addRe2(SSL_CIPHER, R"(^listener\..*?\.ssl\.cipher(\.(<CIPHER>))$)"); | ||
|
|
||
| // cluster.[<cluster_name>.]ssl.ciphers.(<cipher>) | ||
| addRe2(SSL_CIPHER_SUITE, R"(^cluster\.<NAME>\.ssl\.ciphers(\.(<CIPHER>))$)", ".ssl.ciphers."); | ||
| addRe2(SSL_CIPHER_SUITE, R"(^cluster\.<TAG_VALUE>\.ssl\.ciphers(\.(<CIPHER>))$)", | ||
| ".ssl.ciphers."); | ||
|
|
||
| // cluster.[<route_target_cluster>.]grpc.(<grpc_service>.)* | ||
| addTokenized(GRPC_BRIDGE_SERVICE, "cluster.*.grpc.$.**"); | ||
|
|
@@ -115,7 +130,7 @@ TagNameValues::TagNameValues() { | |
| // listener.[<address>.]http.(<stat_prefix>.)* | ||
| // The <address> part can be anything here (.*?) for the sake of a simpler | ||
| // internal state of the regex which performs better. | ||
| addRe2(HTTP_CONN_MANAGER_PREFIX, R"(^listener\..*?\.http\.((<NAME>)\.))", ".http."); | ||
| addRe2(HTTP_CONN_MANAGER_PREFIX, R"(^listener\..*?\.http\.((<TAG_VALUE>)\.))", ".http."); | ||
|
|
||
| // http.(<stat_prefix>.)* | ||
| addTokenized(HTTP_CONN_MANAGER_PREFIX, "http.$.**"); | ||
|
|
@@ -132,7 +147,7 @@ TagNameValues::TagNameValues() { | |
| // http.[<stat_prefix>.]rds.(<route_config_name>.)<base_stat> | ||
| // Note: <route_config_name> can contain dots thus we have to maintain full | ||
| // match. | ||
| addRe2(RDS_ROUTE_CONFIG, R"(^http\.<NAME>\.rds\.((<ROUTE_CONFIG_NAME>)\.)\w+?$)", ".rds."); | ||
| addRe2(RDS_ROUTE_CONFIG, R"(^http\.<TAG_VALUE>\.rds\.((<ROUTE_CONFIG_NAME>)\.)\w+?$)", ".rds."); | ||
|
|
||
| // listener_manager.(worker_<id>.)* | ||
| addRe2(WORKER_ID, R"(^listener_manager\.((worker_\d+)\.))", "listener_manager.worker_"); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.