Skip to content

Commit

Permalink
stats: Shared cluster isolated stats (#8118)
Browse files Browse the repository at this point in the history
* shared the main symbol-table with the isolated stats used for cluster info.

Signed-off-by: Joshua Marantz <jmarantz@google.com>
  • Loading branch information
jmarantz authored Sep 3, 2019
1 parent 0ef3137 commit cf55298
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion source/common/upstream/upstream_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ ClusterInfoImpl::ClusterInfoImpl(
per_connection_buffer_limit_bytes_(
PROTOBUF_GET_WRAPPED_OR_DEFAULT(config, per_connection_buffer_limit_bytes, 1024 * 1024)),
transport_socket_factory_(std::move(socket_factory)), stats_scope_(std::move(stats_scope)),
stats_(generateStats(*stats_scope_)),
stats_(generateStats(*stats_scope_)), load_report_stats_store_(stats_scope_->symbolTable()),
load_report_stats_(generateLoadReportStats(load_report_stats_store_)),
features_(parseFeatures(config)),
http2_settings_(Http::Utility::parseHttp2Settings(config.http2_protocol_options())),
Expand Down
4 changes: 3 additions & 1 deletion source/common/upstream/upstream_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ class HostDescriptionImpl : virtual public HostDescription {
.bool_value()),
metadata_(std::make_shared<envoy::api::v2::core::Metadata>(metadata)), locality_(locality),
locality_zone_stat_name_(locality.zone(), cluster->statsScope().symbolTable()),
stats_{ALL_HOST_STATS(POOL_COUNTER(stats_store_), POOL_GAUGE(stats_store_))},
stats_store_(cluster->statsScope().symbolTable()), stats_{ALL_HOST_STATS(
POOL_COUNTER(stats_store_),
POOL_GAUGE(stats_store_))},
priority_(priority) {
if (health_check_config.port_value() != 0 &&
dest_address->type() != Network::Address::Type::Ip) {
Expand Down
6 changes: 4 additions & 2 deletions test/integration/stats_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ TEST_P(ClusterMemoryTestRunner, MemoryLargeClusterSizeWithFakeSymbolTable) {
// 2019/07/15 7555 42806 43000 static link libstdc++ in tests
// 2019/07/24 7503 43030 44000 add upstream filters to clusters
// 2019/08/13 7877 42838 44000 skip EdfScheduler creation if all host weights equal
// 2019/09/02 8118 42830 43000 Share symbol-tables in cluster/host stats.

// Note: when adjusting this value: EXPECT_MEMORY_EQ is active only in CI
// 'release' builds, where we control the platform and tool-chain. So you
Expand All @@ -234,7 +235,7 @@ TEST_P(ClusterMemoryTestRunner, MemoryLargeClusterSizeWithFakeSymbolTable) {
// On a local clang8/libstdc++/linux flow, the memory usage was observed in
// June 2019 to be 64 bytes higher than it is in CI/release. Your mileage may
// vary.
EXPECT_MEMORY_EQ(m_per_cluster, 42838); // 104 bytes higher than a debug build.
EXPECT_MEMORY_EQ(m_per_cluster, 42830); // 104 bytes higher than a debug build.
EXPECT_MEMORY_LE(m_per_cluster, 44000);
}

Expand All @@ -260,6 +261,7 @@ TEST_P(ClusterMemoryTestRunner, MemoryLargeClusterSizeWithRealSymbolTable) {
// exact upper-bound
// ---------- ----- ----------------- -----
// 2019/08/09 7882 35489 36000 Initial version
// 2019/09/02 8118 34585 34500 Share symbol-tables in cluster/host stats.

// Note: when adjusting this value: EXPECT_MEMORY_EQ is active only in CI
// 'release' builds, where we control the platform and tool-chain. So you
Expand All @@ -269,7 +271,7 @@ TEST_P(ClusterMemoryTestRunner, MemoryLargeClusterSizeWithRealSymbolTable) {
// On a local clang8/libstdc++/linux flow, the memory usage was observed in
// June 2019 to be 64 bytes higher than it is in CI/release. Your mileage may
// vary.
EXPECT_MEMORY_EQ(m_per_cluster, 35489); // 104 bytes higher than a debug build.
EXPECT_MEMORY_EQ(m_per_cluster, 34585); // 104 bytes higher than a debug build.
EXPECT_MEMORY_LE(m_per_cluster, 36000);
}

Expand Down

0 comments on commit cf55298

Please sign in to comment.