-
Notifications
You must be signed in to change notification settings - Fork 5.5k
thrift_proxy: add upstream cluster metrics for MessageType #15668
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
Changes from 4 commits
7c451ec
883d49d
184da4a
c95e02f
f0029da
ba64634
53b6585
3890169
815bdf8
b1aa2ce
862e49c
9c50d3f
d442712
a81f07f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -164,7 +164,13 @@ class RouteMatcher { | |
| COUNTER(route_missing) \ | ||
| COUNTER(unknown_cluster) \ | ||
| COUNTER(upstream_rq_maintenance_mode) \ | ||
| COUNTER(no_healthy_upstream) | ||
| COUNTER(no_healthy_upstream) \ | ||
| COUNTER(request_call) \ | ||
| COUNTER(request_oneway) \ | ||
| COUNTER(request_invalid_type) \ | ||
| COUNTER(response_reply) \ | ||
| COUNTER(response_exception) \ | ||
| COUNTER(response_invalid_type) | ||
|
Member
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. while we are here, do we also want to bytes per request/response?
Contributor
Author
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. I can do that in a follow-up PR, I just want to cover messageTypes for now (as we don't have any per-upstream metrics to begin with).
williamsfu99 marked this conversation as resolved.
Outdated
|
||
|
|
||
| struct RouterStats { | ||
| ALL_THRIFT_ROUTER_STATS(GENERATE_COUNTER_STRUCT, GENERATE_GAUGE_STRUCT, GENERATE_HISTOGRAM_STRUCT) | ||
|
|
@@ -179,6 +185,13 @@ class Router : public Tcp::ConnectionPool::UpstreamCallbacks, | |
| Router(Upstream::ClusterManager& cluster_manager, const std::string& stat_prefix, | ||
| Stats::Scope& scope) | ||
| : cluster_manager_(cluster_manager), stats_(generateStats(stat_prefix, scope)), | ||
| stat_name_set_(scope.symbolTable().makeSet("thrift_proxy")), | ||
| request_call_(stat_name_set_->add("request_call")), | ||
| request_oneway_(stat_name_set_->add("request_oneway")), | ||
| request_invalid_type_(stat_name_set_->add("request_invalid_type")), | ||
| response_reply_(stat_name_set_->add("response_reply")), | ||
| response_exception_(stat_name_set_->add("response_exception")), | ||
| response_invalid_type_(stat_name_set_->add("response_invalid_type")), | ||
| passthrough_supported_(false) {} | ||
|
|
||
| ~Router() override = default; | ||
|
|
@@ -188,6 +201,11 @@ class Router : public Tcp::ConnectionPool::UpstreamCallbacks, | |
| void setDecoderFilterCallbacks(ThriftFilters::DecoderFilterCallbacks& callbacks) override; | ||
| bool passthroughSupported() const override { return passthrough_supported_; } | ||
|
|
||
| // Stats | ||
| void incClusterScopeCounter(Stats::StatName name) { | ||
| cluster_->statsScope().counterFromStatName(name).inc(); | ||
| } | ||
|
|
||
| // ProtocolConverter | ||
| FilterStatus transportBegin(MessageMetadataSharedPtr metadata) override; | ||
| FilterStatus transportEnd() override; | ||
|
|
@@ -259,6 +277,13 @@ class Router : public Tcp::ConnectionPool::UpstreamCallbacks, | |
|
|
||
| Upstream::ClusterManager& cluster_manager_; | ||
| RouterStats stats_; | ||
| Stats::StatNameSetPtr stat_name_set_; | ||
| const Stats::StatName request_call_; | ||
| const Stats::StatName request_oneway_; | ||
| const Stats::StatName request_invalid_type_; | ||
| const Stats::StatName response_reply_; | ||
| const Stats::StatName response_exception_; | ||
| const Stats::StatName response_invalid_type_; | ||
|
|
||
| ThriftFilters::DecoderFilterCallbacks* callbacks_{}; | ||
| RouteConstSharedPtr route_{}; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.