-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[stats] lazyinit ClusterInfo::trafficStats() #23921
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 141 commits
230b570
4c1a076
aba2717
9b51c85
e370c84
2a45ccf
eebc322
8d3f6bd
2aed8eb
1c039f6
96662a9
b4cb848
fc425ca
4b5536d
7214c3b
a20e235
d9f8f03
f367929
1901847
db04639
a4d993f
73b5141
505104e
53b0a20
7bd6b96
56ccf5a
0a0e1e0
385a47d
8a9b2b8
229006e
49056da
359ca2a
e4dc4e1
f40a716
9eba33c
c9da4f3
b29c422
1c0fbea
f36ffc0
0587cf4
5b2ea43
c7f120e
56cf103
58ab4d8
9b9962f
4d3ed73
55e8947
19386ba
e94d69e
ceb5f23
ce96feb
2923d2b
53d7498
3d01fe3
0774ce8
d249fd5
67d75e2
ed5af28
1c50e6e
efb2ab6
bd13097
a9627e8
24a9e33
988d83b
d48e0f5
3b74ba9
9083ede
6c8b41a
b2a7b12
c46e22f
4e9c102
11c7b44
de935dc
3becaf9
b23b659
c503108
f210a74
2830373
24fb842
4416b0e
a2454c1
895d8c5
9097fbe
98fa391
efc2c40
f004644
43e292f
8962752
7570a6a
bbc8544
350ac35
4dbfd2d
b1a497b
c624ab9
0a96db9
a0e7f35
10f48eb
91de71c
9d72f38
672ab39
afeda1b
486f8dc
0b38e5c
ac3d927
f2b1a9b
bae41bf
e2da82f
51a0a7f
0e84bee
015efb5
c644062
f64674f
5734d86
fe40f03
5ae7ade
96aac87
09c2548
702cddf
f6d768b
bece44a
6d6a6b5
599b80b
ad0c574
6b2e242
5a505c3
13b857f
c292a7c
3260c03
0aa105c
d4233bd
a705e5e
cb35d0b
a1c27f6
0cd5310
f92b25c
0f6fa2c
d460779
b1dd791
a648867
4b294f7
35165b0
0745231
b52578b
88d5a63
505bb18
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 |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ | |
| #include "source/common/router/config_utility.h" | ||
| #include "source/common/runtime/runtime_features.h" | ||
| #include "source/common/runtime/runtime_impl.h" | ||
| #include "source/common/stats/deferred_creation.h" | ||
| #include "source/common/upstream/cluster_factory_impl.h" | ||
| #include "source/common/upstream/health_checker_impl.h" | ||
| #include "source/extensions/filters/network/http_connection_manager/config.h" | ||
|
|
@@ -853,9 +854,11 @@ void MainPrioritySetImpl::updateCrossPriorityHostMap(const HostVector& hosts_add | |
| } | ||
| } | ||
|
|
||
| LazyClusterTrafficStats ClusterInfoImpl::generateStats(Stats::Scope& scope, | ||
| const ClusterTrafficStatNames& stat_names) { | ||
| return std::make_unique<ClusterTrafficStats>(stat_names, scope); | ||
| DeferredCreationCompatibleClusterTrafficStats | ||
| ClusterInfoImpl::generateStats(Stats::ScopeSharedPtr scope, | ||
| const ClusterTrafficStatNames& stat_names, bool deferred_creation) { | ||
| return Stats::createDeferredCompatibleStats<ClusterTrafficStats>(scope, stat_names, | ||
| deferred_creation); | ||
|
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. nit: s/deferred_creation/defer_creation/ as this applies to something that will happen when the function is called, not something that already happened.
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. Done |
||
| } | ||
|
|
||
| ClusterRequestResponseSizeStats ClusterInfoImpl::generateRequestResponseSizeStats( | ||
|
|
@@ -1032,8 +1035,9 @@ ClusterInfoImpl::ClusterInfoImpl( | |
| peekahead_ratio_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(config.preconnect_policy(), | ||
| predictive_preconnect_ratio, 0)), | ||
| socket_matcher_(std::move(socket_matcher)), stats_scope_(std::move(stats_scope)), | ||
| traffic_stats_( | ||
| generateStats(*stats_scope_, factory_context.clusterManager().clusterStatNames())), | ||
| traffic_stats_(generateStats(stats_scope_, | ||
| factory_context.clusterManager().clusterStatNames(), | ||
| server_context.statsConfig().enableDeferredCreationStats())), | ||
| config_update_stats_(factory_context.clusterManager().clusterConfigUpdateStatNames(), | ||
| *stats_scope_), | ||
| lb_stats_(factory_context.clusterManager().clusterLbStatNames(), *stats_scope_), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove empty line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done