-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
access_log: refactored SubstitutionFormatParser::parseCommand #16121
Conversation
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
/retest |
Retrying Azure Pipelines: |
/retest |
Retrying Azure Pipelines: |
Thanks, this looks really good. Could you add some negative tests as well, i.e. when command is malformed to test parsing error handling, please? |
/wait |
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
@yanavlasov Thanks for reviewing and merging. |
…roxy#16121) Signed-off-by: Christoph Pakulski <[email protected]> Signed-off-by: Gokul Nair <[email protected]>
…roxy#16121) Signed-off-by: Christoph Pakulski <[email protected]> Signed-off-by: Gokul Nair <[email protected]>
FYI this broke our internal formatter extensions:
Not a huge deal, but something to take in account code that might be relied upon by extensions... |
@rgs1 I apologize for that. I could probably leave original methods with original signatures and map it to the new ones. |
@cpakulski no worries at all, the change was easy. Mostly just posted for visibility, since eventually formatter extensions might become more popular (I suspect they are not heavily used right now). |
This PR addresses several issues: 1. MetadataFormatter base class takes a pointer to a function to access specific type of metadata. All other methods operating on internals of metadata structure are moved to base class. This simplified adding new types of metadata. 2. new type of access_log METADATA tag is introduced to handle all types of metadata. It is implemented as formatter extension. It handles existing tags DYNAMIC_METADATA and CLUSTER_METADATA, so two ways of accessing dynamic and cluster metadata are allowed now. Maybe we should obsolete DYNAMIC_METADATA and CLUSTER_METADATA in the future? 3. Adds handler for ROUTE metadata. See issue #3006. Follow up to #16121 Risk Level: Low Testing: Unit tests. Docs Changes: Yes. Release Notes: Yes. Platform Specific Features: No Signed-off-by: Christoph Pakulski <[email protected]>
This PR addresses several issues: 1. MetadataFormatter base class takes a pointer to a function to access specific type of metadata. All other methods operating on internals of metadata structure are moved to base class. This simplified adding new types of metadata. 2. new type of access_log METADATA tag is introduced to handle all types of metadata. It is implemented as formatter extension. It handles existing tags DYNAMIC_METADATA and CLUSTER_METADATA, so two ways of accessing dynamic and cluster metadata are allowed now. Maybe we should obsolete DYNAMIC_METADATA and CLUSTER_METADATA in the future? 3. Adds handler for ROUTE metadata. See issue envoyproxy#3006. Follow up to envoyproxy#16121 Risk Level: Low Testing: Unit tests. Docs Changes: Yes. Release Notes: Yes. Platform Specific Features: No Signed-off-by: Christoph Pakulski <[email protected]>
Commit Message:
refactored SubstitutionFormatParser::parseCommand
Additional Description:
This PR addresses few items:
SubstitutionFormatParser::parseCommand
method is around 40% faster. Microbenchmark reports the following results:Benchmark Time CPU Iterations
BM_FormatterCommandParsingOld 2194 ns 2194 ns 319163
BM_FormatterCommandParsingNew 1260 ns 1260 ns 554762
SubstitutionFormatParser::parseCommand
has been implemented using variadic template. This is done in preparation for issue access_log: support for logging route/listener/cluster metadata #3006. The idea has been proposed on envoy-dev slack on April 14th 2021. In a nutshell, there will be one tag for all metadata in formMETADATA(TYPE:NAMESPACE:KEY):Z
. Notice that there is additional tagTYPE
. Using Variadic template for parsing commands will automatically address the presence of extra tag.Risk Level: Low
Testing: Added new unit tests and microbenchmark
Docs Changes: Not required
Release Notes: Not required
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]