thrift_proxy: refactor thrift router stats to create named stats/stat names once#18586
Merged
mattklein123 merged 3 commits intoenvoyproxy:mainfrom Oct 13, 2021
Merged
Conversation
… names once Signed-off-by: James Fish <jfish@pinterest.com>
Signed-off-by: James Fish <jfish@pinterest.com>
Member
|
cc: @jmarantz in case there are other places where we could do this too. |
Contributor
Author
|
Unrelated CI failure: |
rgs1
approved these changes
Oct 12, 2021
Member
rgs1
left a comment
There was a problem hiding this comment.
Looks great, thanks! Just one nit about saving an extra const ref when we can just get it from parent, but not blocking on that.
cc: @davinci26 if you are up for another review + merge.
source/extensions/filters/network/thrift_proxy/router/upstream_request.h
Show resolved
Hide resolved
Contributor
|
Thanks for the heads up, @rgs1 -- this looks like a good refactor. I'm not aware of any that remain at this point, but then I was not aware of this one :) Probably there is still some low-hanging fruit in other extensions. |
Signed-off-by: James Fish <jfish@pinterest.com>
Contributor
Author
|
I merged upstream/main to give CI another go :/ |
rgs1
approved these changes
Oct 12, 2021
Member
rgs1
left a comment
There was a problem hiding this comment.
Over to @davinci26 for merging once CI is happy.
Member
|
/assign davinci26 |
mattklein123
approved these changes
Oct 13, 2021
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Commit Message: thrift_proxy: refactor thrift router stats to create named stats/stat names once
Additional Description: The Router::RequestOwner constructor is called once per upstream request. The constructor creates stats and adds stat names to symbol tables. These are always the same named counters/histograms and stat names. When using payload passthrough and only the router filter the RequestOwner constructor is 20% +/- 1.5% of the time spent in the ThriftProxy namespace. Therefore refactor the stats out to their own class and create in the filter factory, and pass a constant reference to the router filter and through to other router classes' constructors.
perf flamegraph where
Envoy::Extensions::NetworkFilters::ThriftProxy::Routon the wide left tower is the Router and RequestOwner constructors.Risk Level: low
Testing: unit tests
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A