From dfac8eb5005504bf194b65f253e1cf2462920049 Mon Sep 17 00:00:00 2001 From: Joshua Marantz Date: Wed, 2 Feb 2022 21:18:45 -0500 Subject: [PATCH 1/7] change Stats::Scope usage to shared_ptr, eliminating ScopePtr as a defined type. Signed-off-by: Joshua Marantz --- .../filters/network/source/config.cc | 2 +- envoy/server/admin.h | 2 +- envoy/stats/scope.h | 27 ++++++- source/common/filter/config_discovery_impl.h | 2 +- source/common/router/config_impl.h | 8 +- source/common/router/rds_impl.h | 2 +- source/common/router/scoped_rds.h | 2 +- source/common/router/vhds.h | 2 +- source/common/runtime/runtime_impl.h | 2 +- source/common/secret/sds_api.h | 2 +- source/common/stats/isolated_store_impl.cc | 13 ++-- source/common/stats/isolated_store_impl.h | 9 ++- source/common/stats/scope_prefixer.cc | 6 +- source/common/stats/scope_prefixer.h | 4 +- source/common/stats/stat_merger.h | 2 +- source/common/stats/thread_local_store.cc | 4 +- source/common/stats/thread_local_store.h | 10 +-- source/common/stats/utility.cc | 2 +- source/common/stats/utility.h | 2 +- source/common/tcp_proxy/tcp_proxy.h | 2 +- source/common/upstream/cds_api_impl.h | 2 +- .../common/upstream/cluster_factory_impl.cc | 4 +- source/common/upstream/cluster_factory_impl.h | 6 +- source/common/upstream/eds.cc | 4 +- source/common/upstream/eds.h | 4 +- .../upstream/health_discovery_service.cc | 2 +- source/common/upstream/leds.h | 2 +- source/common/upstream/logical_dns_cluster.cc | 4 +- source/common/upstream/logical_dns_cluster.h | 4 +- source/common/upstream/maglev_lb.h | 2 +- .../common/upstream/original_dst_cluster.cc | 4 +- source/common/upstream/original_dst_cluster.h | 4 +- source/common/upstream/ring_hash_lb.h | 2 +- source/common/upstream/static_cluster.cc | 4 +- source/common/upstream/static_cluster.h | 4 +- source/common/upstream/strict_dns_cluster.cc | 4 +- source/common/upstream/strict_dns_cluster.h | 4 +- source/common/upstream/upstream_impl.cc | 6 +- source/common/upstream/upstream_impl.h | 6 +- .../extensions/clusters/aggregate/cluster.cc | 4 +- .../extensions/clusters/aggregate/cluster.h | 4 +- .../clusters/dynamic_forward_proxy/cluster.cc | 4 +- .../clusters/dynamic_forward_proxy/cluster.h | 4 +- .../clusters/redis/redis_cluster.cc | 4 +- .../extensions/clusters/redis/redis_cluster.h | 4 +- .../dynamic_forward_proxy/dns_cache_impl.h | 2 +- .../filters/network/redis_proxy/config.cc | 2 +- .../network/redis_proxy/conn_pool_impl.cc | 2 +- .../network/redis_proxy/conn_pool_impl.h | 2 +- .../dns_resolver/apple/apple_dns_impl.h | 2 +- source/server/admin/admin.cc | 2 +- source/server/admin/admin.h | 6 +- source/server/api_listener_impl.h | 4 +- source/server/config_validation/admin.cc | 2 +- source/server/config_validation/admin.h | 2 +- source/server/filter_chain_manager_impl.h | 4 +- source/server/lds_api.h | 2 +- source/server/listener_impl.h | 4 +- source/server/listener_manager_impl.h | 2 +- source/server/server.h | 2 +- .../grpc/async_client_manager_impl_test.cc | 1 + test/common/stats/isolated_store_impl_test.cc | 24 +++--- test/common/stats/thread_local_store_test.cc | 50 ++++++------ test/common/stats/utility_fuzz_test.cc | 2 +- test/common/stats/utility_test.cc | 10 +-- .../upstream/cluster_factory_impl_test.cc | 2 +- test/common/upstream/eds_speed_test.cc | 2 +- test/common/upstream/eds_test.cc | 2 +- test/common/upstream/hds_test.cc | 4 +- test/common/upstream/leds_test.cc | 2 +- .../upstream/logical_dns_cluster_test.cc | 2 +- .../upstream/original_dst_cluster_test.cc | 2 +- test/common/upstream/subset_lb_test.cc | 2 +- .../upstream/transport_socket_matcher_test.cc | 2 +- test/common/upstream/upstream_impl_test.cc | 78 +++++++++---------- .../bootstrap/wasm/wasm_speed_test.cc | 2 +- .../clusters/aggregate/cluster_test.cc | 2 +- .../dynamic_forward_proxy/cluster_test.cc | 2 +- .../clusters/redis/redis_cluster_test.cc | 4 +- .../extensions/common/wasm/wasm_speed_test.cc | 2 +- test/extensions/common/wasm/wasm_test.cc | 40 +++++----- test/extensions/common/wasm/wasm_vm_test.cc | 4 +- .../network/common/redis/client_impl_test.cc | 2 +- .../clusters/custom_static_cluster.h | 4 +- test/integration/fake_upstream.h | 2 +- test/integration/server.h | 20 ++--- test/mocks/server/admin.h | 2 +- test/mocks/stats/mocks.h | 6 +- test/mocks/upstream/cluster_info.h | 2 +- test/test_common/wasm_base.h | 2 +- 90 files changed, 274 insertions(+), 248 deletions(-) diff --git a/contrib/sip_proxy/filters/network/source/config.cc b/contrib/sip_proxy/filters/network/source/config.cc index dace041c2fcef..4b22a9c596eb0 100644 --- a/contrib/sip_proxy/filters/network/source/config.cc +++ b/contrib/sip_proxy/filters/network/source/config.cc @@ -61,7 +61,7 @@ Network::FilterFactoryCb SipProxyFilterConfigFactory::createFilterFactoryFromPro */ auto transaction_infos = std::make_shared(); for (auto& cluster : unique_clusters) { - Stats::ScopePtr stats_scope = + Stats::ScopeSharedPtr stats_scope = context.scope().createScope(fmt::format("cluster.{}.sip_cluster", cluster)); auto transaction_info_ptr = std::make_shared( cluster, context.threadLocal(), diff --git a/envoy/server/admin.h b/envoy/server/admin.h index 477bde02f175f..eb47f0e9a1359 100644 --- a/envoy/server/admin.h +++ b/envoy/server/admin.h @@ -131,7 +131,7 @@ class Admin { const std::string& address_out_path, Network::Address::InstanceConstSharedPtr address, const Network::Socket::OptionsSharedPtr& socket_options, - Stats::ScopePtr&& listener_scope) PURE; + Stats::ScopeSharedPtr&& listener_scope) PURE; /** * Executes an admin request with the specified query params. Note: this must diff --git a/envoy/stats/scope.h b/envoy/stats/scope.h index 7271883314ad9..f132090d636c1 100644 --- a/envoy/stats/scope.h +++ b/envoy/stats/scope.h @@ -25,7 +25,7 @@ using CounterOptConstRef = absl::optional> using GaugeOptConstRef = absl::optional>; using HistogramOptConstRef = absl::optional>; using TextReadoutOptConstRef = absl::optional>; -using ScopePtr = std::unique_ptr; +using ConstScopeSharedPtr = std::shared_ptr; using ScopeSharedPtr = std::shared_ptr; template using IterateFn = std::function&)>; @@ -33,11 +33,30 @@ template using IterateFn = std::function exist in the Wasm extension and would need + * to be rewritten to allow for RefcountPtr. + * * the main advantage of RefcountPtr is it's smaller per instance by (IIRC) 16 + * bytes, but there are not typically enough scopes that the extra per-scope + * overhead would matter. + * * It's a little less coding to use enable_shared_from_this compared to adding + * a ref_count to the scope object, for each of its implementations. */ -class Scope { +class Scope : public std::enable_shared_from_this { public: virtual ~Scope() = default; + /** @return a shared_ptr for this */ + ScopeSharedPtr makeShared() { return shared_from_this(); } + /** @return a const shared_ptr for this */ + ConstScopeSharedPtr makeConstShared() const { return shared_from_this(); } + /** * Allocate a new scope. NOTE: The implementation should correctly handle overlapping scopes * that point to the same reference counted backing stats. This allows a new scope to be @@ -47,7 +66,7 @@ class Scope { * * @param name supplies the scope's namespace prefix. */ - virtual ScopePtr createScope(const std::string& name) PURE; + virtual ScopeSharedPtr createScope(const std::string& name) PURE; /** * Allocate a new scope. NOTE: The implementation should correctly handle overlapping scopes @@ -56,7 +75,7 @@ class Scope { * * @param name supplies the scope's namespace prefix. */ - virtual ScopePtr scopeFromStatName(StatName name) PURE; + virtual ScopeSharedPtr scopeFromStatName(StatName name) PURE; /** * Deliver an individual histogram value to all registered sinks. diff --git a/source/common/filter/config_discovery_impl.h b/source/common/filter/config_discovery_impl.h index 3d708adaa75a4..ff8bc0a5f3e78 100644 --- a/source/common/filter/config_discovery_impl.h +++ b/source/common/filter/config_discovery_impl.h @@ -204,7 +204,7 @@ class FilterConfigSubscription Init::SharedTargetImpl init_target_; bool started_{false}; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; const std::string stat_prefix_; ExtensionConfigDiscoveryStats stats_; diff --git a/source/common/router/config_impl.h b/source/common/router/config_impl.h index 3a2c683fd44e1..f19b07eb5f380 100644 --- a/source/common/router/config_impl.h +++ b/source/common/router/config_impl.h @@ -237,7 +237,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable struct VirtualClusterBase : public VirtualCluster { public: VirtualClusterBase(const absl::optional& name, Stats::StatName stat_name, - Stats::ScopePtr&& scope, const VirtualClusterStatNames& stat_names) + Stats::ScopeSharedPtr&& scope, const VirtualClusterStatNames& stat_names) : name_(name), stat_name_(stat_name), scope_(std::move(scope)), stats_(generateStats(*scope_, stat_names)) {} @@ -251,7 +251,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable private: const absl::optional name_; const Stats::StatName stat_name_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; mutable VirtualClusterStats stats_; }; @@ -270,7 +270,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable static const std::shared_ptr SSL_REDIRECT_ROUTE; const Stats::StatNameManagedStorage stat_name_storage_; - Stats::ScopePtr vcluster_scope_; + Stats::ScopeSharedPtr vcluster_scope_; std::vector routes_; std::vector virtual_clusters_; SslRequirements ssl_requirements_; @@ -1155,7 +1155,7 @@ class RouteMatcher { const WildcardVirtualHosts& wildcard_virtual_hosts, SubstringFunction substring_function) const; - Stats::ScopePtr vhost_scope_; + Stats::ScopeSharedPtr vhost_scope_; absl::node_hash_map virtual_hosts_; // std::greater as a minor optimization to iterate from more to less specific // diff --git a/source/common/router/rds_impl.h b/source/common/router/rds_impl.h index b6820b0576564..5baa3337c4bae 100644 --- a/source/common/router/rds_impl.h +++ b/source/common/router/rds_impl.h @@ -150,7 +150,7 @@ class RdsRouteConfigSubscription const std::string route_config_name_; // This scope must outlive the subscription_ below as the subscription has derived stats. - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; Envoy::Config::SubscriptionPtr subscription_; Server::Configuration::ServerFactoryContext& factory_context_; diff --git a/source/common/router/scoped_rds.h b/source/common/router/scoped_rds.h index eb53c8b57fe89..eec17eb1fa4bb 100644 --- a/source/common/router/scoped_rds.h +++ b/source/common/router/scoped_rds.h @@ -227,7 +227,7 @@ class ScopedRdsConfigSubscription Server::Configuration::ServerFactoryContext& factory_context_; const std::string name_; // Stats must outlive subscription. - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; ScopedRdsStats stats_; Envoy::Config::SubscriptionPtr subscription_; const envoy::extensions::filters::network::http_connection_manager::v3::ScopedRoutes:: diff --git a/source/common/router/vhds.h b/source/common/router/vhds.h index a16259e2257ca..baef9c6ff2e32 100644 --- a/source/common/router/vhds.h +++ b/source/common/router/vhds.h @@ -66,7 +66,7 @@ class VhdsSubscription : Envoy::Config::SubscriptionBase("", *this)) {} -ScopePtr IsolatedStoreImpl::createScope(const std::string& name) { - return std::make_unique(name, *this); +IsolatedStoreImpl::~IsolatedStoreImpl() = default; + +ScopeSharedPtr IsolatedStoreImpl::createScope(const std::string& name) { + return std::make_shared(name, *this); } -ScopePtr IsolatedStoreImpl::scopeFromStatName(StatName name) { - return std::make_unique(name, *this); +ScopeSharedPtr IsolatedStoreImpl::scopeFromStatName(StatName name) { + return std::make_shared(name, *this); } } // namespace Stats diff --git a/source/common/stats/isolated_store_impl.h b/source/common/stats/isolated_store_impl.h index 879648189977d..5a133e7975340 100644 --- a/source/common/stats/isolated_store_impl.h +++ b/source/common/stats/isolated_store_impl.h @@ -132,6 +132,7 @@ class IsolatedStoreImpl : public StoreImpl { public: IsolatedStoreImpl(); explicit IsolatedStoreImpl(SymbolTable& symbol_table); + ~IsolatedStoreImpl() override; // Stats::Scope Counter& counterFromStatNameWithTags(const StatName& name, @@ -140,8 +141,8 @@ class IsolatedStoreImpl : public StoreImpl { Counter& counter = counters_.get(joiner.nameWithTags()); return counter; } - ScopePtr createScope(const std::string& name) override; - ScopePtr scopeFromStatName(StatName name) override; + ScopeSharedPtr createScope(const std::string& name) override; + ScopeSharedPtr scopeFromStatName(StatName name) override; void deliverHistogramToSinks(const Histogram&, uint64_t) override {} Gauge& gaugeFromStatNameWithTags(const StatName& name, StatNameTagVectorOptConstRef tags, Gauge::ImportMode import_mode) override { @@ -236,8 +237,7 @@ class IsolatedStoreImpl : public StoreImpl { if (f_size != nullptr) { f_size(1); } - const Scope& scope = *this; - f_stat(scope); + f_stat(*default_scope_); } Stats::StatName prefix() const override { return StatName(); } @@ -265,6 +265,7 @@ class IsolatedStoreImpl : public StoreImpl { IsolatedStatsCache text_readouts_; RefcountPtr null_counter_; RefcountPtr null_gauge_; + ScopeSharedPtr default_scope_; }; } // namespace Stats diff --git a/source/common/stats/scope_prefixer.cc b/source/common/stats/scope_prefixer.cc index cbe4c3b1c45e6..29fecdcb17ad2 100644 --- a/source/common/stats/scope_prefixer.cc +++ b/source/common/stats/scope_prefixer.cc @@ -16,12 +16,12 @@ ScopePrefixer::ScopePrefixer(StatName prefix, Scope& scope) ScopePrefixer::~ScopePrefixer() { prefix_.free(symbolTable()); } -ScopePtr ScopePrefixer::scopeFromStatName(StatName name) { +ScopeSharedPtr ScopePrefixer::scopeFromStatName(StatName name) { SymbolTable::StoragePtr joined = symbolTable().join({prefix_.statName(), name}); - return std::make_unique(StatName(joined.get()), scope_); + return std::make_shared(StatName(joined.get()), scope_); } -ScopePtr ScopePrefixer::createScope(const std::string& name) { +ScopeSharedPtr ScopePrefixer::createScope(const std::string& name) { StatNameManagedStorage stat_name_storage(Utility::sanitizeStatsName(name), symbolTable()); return scopeFromStatName(stat_name_storage.statName()); } diff --git a/source/common/stats/scope_prefixer.h b/source/common/stats/scope_prefixer.h index 8d4f6ee19cc6d..8218788ea97d7 100644 --- a/source/common/stats/scope_prefixer.h +++ b/source/common/stats/scope_prefixer.h @@ -16,8 +16,8 @@ class ScopePrefixer : public Scope { ~ScopePrefixer() override; // Scope - ScopePtr createScope(const std::string& name) override; - ScopePtr scopeFromStatName(StatName name) override; + ScopeSharedPtr createScope(const std::string& name) override; + ScopeSharedPtr scopeFromStatName(StatName name) override; Counter& counterFromStatNameWithTags(const StatName& name, StatNameTagVectorOptConstRef tags) override; Gauge& gaugeFromStatNameWithTags(const StatName& name, StatNameTagVectorOptConstRef tags, diff --git a/source/common/stats/stat_merger.h b/source/common/stats/stat_merger.h index 3a9fb6c3093fd..cf2815227981e 100644 --- a/source/common/stats/stat_merger.h +++ b/source/common/stats/stat_merger.h @@ -96,7 +96,7 @@ class StatMerger { // preserve all stats throughout the hot restart. Then, when the restart completes, dropping // the scope will drop exactly those stats whose names have not already been accessed through // another store/scope. - ScopePtr temp_scope_; + ScopeSharedPtr temp_scope_; }; } // namespace Stats diff --git a/source/common/stats/thread_local_store.cc b/source/common/stats/thread_local_store.cc index 6bc37b85f3bc0..66fc63c260aec 100644 --- a/source/common/stats/thread_local_store.cc +++ b/source/common/stats/thread_local_store.cc @@ -144,12 +144,12 @@ std::vector ThreadLocalStoreImpl::counters() const { return ret; } -ScopePtr ThreadLocalStoreImpl::createScope(const std::string& name) { +ScopeSharedPtr ThreadLocalStoreImpl::createScope(const std::string& name) { StatNameManagedStorage stat_name_storage(Utility::sanitizeStatsName(name), alloc_.symbolTable()); return scopeFromStatName(stat_name_storage.statName()); } -ScopePtr ThreadLocalStoreImpl::scopeFromStatName(StatName name) { +ScopeSharedPtr ThreadLocalStoreImpl::scopeFromStatName(StatName name) { auto new_scope = std::make_unique(*this, name); Thread::LockGuard lock(lock_); scopes_.emplace(new_scope.get()); diff --git a/source/common/stats/thread_local_store.h b/source/common/stats/thread_local_store.h index e7e973cd6acc7..65383cca95181 100644 --- a/source/common/stats/thread_local_store.h +++ b/source/common/stats/thread_local_store.h @@ -158,8 +158,8 @@ class ThreadLocalStoreImpl : Logger::Loggable, public StoreRo Counter& counterFromString(const std::string& name) override { return default_scope_->counterFromString(name); } - ScopePtr createScope(const std::string& name) override; - ScopePtr scopeFromStatName(StatName name) override; + ScopeSharedPtr createScope(const std::string& name) override; + ScopeSharedPtr scopeFromStatName(StatName name) override; void deliverHistogramToSinks(const Histogram& histogram, uint64_t value) override { return default_scope_->deliverHistogramToSinks(histogram, value); } @@ -348,10 +348,10 @@ class ThreadLocalStoreImpl : Logger::Loggable, public StoreRo Histogram::Unit unit) override; TextReadout& textReadoutFromStatNameWithTags(const StatName& name, StatNameTagVectorOptConstRef tags) override; - ScopePtr createScope(const std::string& name) override { + ScopeSharedPtr createScope(const std::string& name) override { return parent_.createScope(symbolTable().toString(prefix_.statName()) + "." + name); } - ScopePtr scopeFromStatName(StatName name) override { + ScopeSharedPtr scopeFromStatName(StatName name) override { SymbolTable::StoragePtr joined = symbolTable().join({prefix_.statName(), name}); return parent_.scopeFromStatName(StatName(joined.get())); } @@ -520,7 +520,7 @@ class ThreadLocalStoreImpl : Logger::Loggable, public StoreRo ThreadLocal::TypedSlotPtr tls_cache_; mutable Thread::MutexBasicLockable lock_; absl::flat_hash_set scopes_ ABSL_GUARDED_BY(lock_); - ScopePtr default_scope_; + ScopeSharedPtr default_scope_; std::list> timer_sinks_; TagProducerPtr tag_producer_; StatsMatcherPtr stats_matcher_; diff --git a/source/common/stats/utility.cc b/source/common/stats/utility.cc index 69fe60d516ba1..8f780b4c228e6 100644 --- a/source/common/stats/utility.cc +++ b/source/common/stats/utility.cc @@ -68,7 +68,7 @@ struct ElementVisitor { namespace Utility { -ScopePtr scopeFromStatNames(Scope& scope, const StatNameVec& elements) { +ScopeSharedPtr scopeFromStatNames(Scope& scope, const StatNameVec& elements) { SymbolTable::StoragePtr joined = scope.symbolTable().join(elements); return scope.scopeFromStatName(StatName(joined.get())); } diff --git a/source/common/stats/utility.h b/source/common/stats/utility.h index 5ada272e3bb45..fb022326f5134 100644 --- a/source/common/stats/utility.h +++ b/source/common/stats/utility.h @@ -92,7 +92,7 @@ absl::optional findTag(const Metric& metric, StatName find_tag_name); * @param elements The vector of mixed DynamicName and StatName * @return A scope named using the joined elements. */ -ScopePtr scopeFromStatNames(Scope& scope, const StatNameVec& names); +ScopeSharedPtr scopeFromStatNames(Scope& scope, const StatNameVec& names); /** * Creates a counter from a vector of tokens which are used to create the diff --git a/source/common/tcp_proxy/tcp_proxy.h b/source/common/tcp_proxy/tcp_proxy.h index 22a49739c4ebe..7bb640c908721 100644 --- a/source/common/tcp_proxy/tcp_proxy.h +++ b/source/common/tcp_proxy/tcp_proxy.h @@ -117,7 +117,7 @@ class Config { // Hold a Scope for the lifetime of the configuration because connections in // the UpstreamDrainManager can live longer than the listener. - const Stats::ScopePtr stats_scope_; + const Stats::ScopeSharedPtr stats_scope_; const TcpProxyStats stats_; absl::optional idle_timeout_; diff --git a/source/common/upstream/cds_api_impl.h b/source/common/upstream/cds_api_impl.h index 63ca584eb06db..b38c6686c40aa 100644 --- a/source/common/upstream/cds_api_impl.h +++ b/source/common/upstream/cds_api_impl.h @@ -53,7 +53,7 @@ class CdsApiImpl : public CdsApi, CdsApiHelper helper_; ClusterManager& cm_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; Config::SubscriptionPtr subscription_; std::function initialize_callback_; }; diff --git a/source/common/upstream/cluster_factory_impl.cc b/source/common/upstream/cluster_factory_impl.cc index 5b6b13a89207c..a274ac5e2e982 100644 --- a/source/common/upstream/cluster_factory_impl.cc +++ b/source/common/upstream/cluster_factory_impl.cc @@ -16,8 +16,8 @@ namespace Upstream { namespace { -Stats::ScopePtr generateStatsScope(const envoy::config::cluster::v3::Cluster& config, - Stats::Store& stats) { +Stats::ScopeSharedPtr generateStatsScope(const envoy::config::cluster::v3::Cluster& config, + Stats::Store& stats) { return stats.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); } diff --git a/source/common/upstream/cluster_factory_impl.h b/source/common/upstream/cluster_factory_impl.h index 1ff81b8503285..50a0cfdb4c341 100644 --- a/source/common/upstream/cluster_factory_impl.h +++ b/source/common/upstream/cluster_factory_impl.h @@ -150,7 +150,7 @@ class ClusterFactoryImplBase : public ClusterFactory { virtual std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) PURE; + Stats::ScopeSharedPtr&& stats_scope) PURE; const std::string name_; }; @@ -174,7 +174,7 @@ template class ConfigurableClusterFactoryBase : public Clust std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override { + Stats::ScopeSharedPtr&& stats_scope) override { ProtobufTypes::MessagePtr config = createEmptyConfigProto(); Config::Utility::translateOpaqueConfig(cluster.cluster_type().typed_config(), socket_factory_context.messageValidationVisitor(), @@ -189,7 +189,7 @@ template class ConfigurableClusterFactoryBase : public Clust const envoy::config::cluster::v3::Cluster& cluster, const ConfigProto& proto_config, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) PURE; + Stats::ScopeSharedPtr&& stats_scope) PURE; }; } // namespace Upstream diff --git a/source/common/upstream/eds.cc b/source/common/upstream/eds.cc index 8460a0ef8b829..9005d8ec4ecb6 100644 --- a/source/common/upstream/eds.cc +++ b/source/common/upstream/eds.cc @@ -16,7 +16,7 @@ namespace Upstream { EdsClusterImpl::EdsClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) : BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), Envoy::Config::SubscriptionBase( @@ -378,7 +378,7 @@ std::pair EdsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) { + Stats::ScopeSharedPtr&& stats_scope) { if (!cluster.has_eds_cluster_config()) { throw EnvoyException("cannot create an EDS cluster without an EDS config"); } diff --git a/source/common/upstream/eds.h b/source/common/upstream/eds.h index 476e783a32a58..4d25a888f0b06 100644 --- a/source/common/upstream/eds.h +++ b/source/common/upstream/eds.h @@ -32,7 +32,7 @@ class EdsClusterImpl public: EdsClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return initialize_phase_; } @@ -115,7 +115,7 @@ class EdsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/health_discovery_service.cc b/source/common/upstream/health_discovery_service.cc index 7bac0901a01ac..3e59df12f0eee 100644 --- a/source/common/upstream/health_discovery_service.cc +++ b/source/common/upstream/health_discovery_service.cc @@ -520,7 +520,7 @@ ClusterSharedPtr HdsCluster::create() { return nullptr; } ClusterInfoConstSharedPtr ProdClusterInfoFactory::createClusterInfo(const CreateClusterInfoParams& params) { - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/source/common/upstream/leds.h b/source/common/upstream/leds.h index a58f31baa0f4d..d3893f5da184e 100644 --- a/source/common/upstream/leds.h +++ b/source/common/upstream/leds.h @@ -65,7 +65,7 @@ class LedsSubscription const LocalInfo::LocalInfo& local_info_; const std::string cluster_name_; // LEDS stats scope must outlive the subscription. - Stats::ScopePtr stats_scope_; + Stats::ScopeSharedPtr stats_scope_; LedsStats stats_; // A map between a LEDS resource name to the LbEndpoint data. LbEndpointsMap endpoints_map_; diff --git a/source/common/upstream/logical_dns_cluster.cc b/source/common/upstream/logical_dns_cluster.cc index 6e34bbb8fab91..54290881a3fe3 100644 --- a/source/common/upstream/logical_dns_cluster.cc +++ b/source/common/upstream/logical_dns_cluster.cc @@ -48,7 +48,7 @@ LogicalDnsCluster::LogicalDnsCluster( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) : ClusterImplBase(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), dns_resolver_(dns_resolver), @@ -182,7 +182,7 @@ std::pair LogicalDnsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) { + Stats::ScopeSharedPtr&& stats_scope) { auto selected_dns_resolver = selectDnsResolver(cluster, context); return std::make_pair(std::make_shared( diff --git a/source/common/upstream/logical_dns_cluster.h b/source/common/upstream/logical_dns_cluster.h index 233244d03bbdf..e30942df7e720 100644 --- a/source/common/upstream/logical_dns_cluster.h +++ b/source/common/upstream/logical_dns_cluster.h @@ -36,7 +36,7 @@ class LogicalDnsCluster : public ClusterImplBase { LogicalDnsCluster(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); ~LogicalDnsCluster() override; @@ -85,7 +85,7 @@ class LogicalDnsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; DECLARE_FACTORY(LogicalDnsClusterFactory); diff --git a/source/common/upstream/maglev_lb.h b/source/common/upstream/maglev_lb.h index d2c4ed58109bd..0d1c6fc5f71e1 100644 --- a/source/common/upstream/maglev_lb.h +++ b/source/common/upstream/maglev_lb.h @@ -99,7 +99,7 @@ class MaglevLoadBalancer : public ThreadAwareLoadBalancerBase, static MaglevLoadBalancerStats generateStats(Stats::Scope& scope); - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; MaglevLoadBalancerStats stats_; const uint64_t table_size_; const bool use_hostname_for_hashing_; diff --git a/source/common/upstream/original_dst_cluster.cc b/source/common/upstream/original_dst_cluster.cc index 00561a544a165..c60e977cd1524 100644 --- a/source/common/upstream/original_dst_cluster.cc +++ b/source/common/upstream/original_dst_cluster.cc @@ -108,7 +108,7 @@ OriginalDstCluster::LoadBalancer::requestOverrideHost(LoadBalancerContext* conte OriginalDstCluster::OriginalDstCluster( const envoy::config::cluster::v3::Cluster& config, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) : ClusterImplBase(config, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), dispatcher_(factory_context.mainThreadDispatcher()), @@ -182,7 +182,7 @@ std::pair OriginalDstClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) { + Stats::ScopeSharedPtr&& stats_scope) { if (cluster.lb_policy() != envoy::config::cluster::v3::Cluster::CLUSTER_PROVIDED) { throw EnvoyException( fmt::format("cluster: LB policy {} is not valid for Cluster type {}. Only " diff --git a/source/common/upstream/original_dst_cluster.h b/source/common/upstream/original_dst_cluster.h index 589991eb612f7..a9cd8741c4d30 100644 --- a/source/common/upstream/original_dst_cluster.h +++ b/source/common/upstream/original_dst_cluster.h @@ -31,7 +31,7 @@ class OriginalDstCluster : public ClusterImplBase { public: OriginalDstCluster(const envoy::config::cluster::v3::Cluster& config, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -135,7 +135,7 @@ class OriginalDstClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/ring_hash_lb.h b/source/common/upstream/ring_hash_lb.h index 3369a7ba635a1..aa861eb9fb92c 100644 --- a/source/common/upstream/ring_hash_lb.h +++ b/source/common/upstream/ring_hash_lb.h @@ -87,7 +87,7 @@ class RingHashLoadBalancer : public ThreadAwareLoadBalancerBase, static RingHashLoadBalancerStats generateStats(Stats::Scope& scope); - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; RingHashLoadBalancerStats stats_; static const uint64_t DefaultMinRingSize = 1024; diff --git a/source/common/upstream/static_cluster.cc b/source/common/upstream/static_cluster.cc index b1656fe2ee698..4fdd3f9f7df34 100644 --- a/source/common/upstream/static_cluster.cc +++ b/source/common/upstream/static_cluster.cc @@ -10,7 +10,7 @@ namespace Upstream { StaticClusterImpl::StaticClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) : ClusterImplBase(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), priority_state_manager_( @@ -65,7 +65,7 @@ std::pair StaticClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) { + Stats::ScopeSharedPtr&& stats_scope) { return std::make_pair( std::make_shared(cluster, context.runtime(), socket_factory_context, std::move(stats_scope), context.addedViaApi()), diff --git a/source/common/upstream/static_cluster.h b/source/common/upstream/static_cluster.h index a6c710ac6aec6..9ad812505aa5f 100644 --- a/source/common/upstream/static_cluster.h +++ b/source/common/upstream/static_cluster.h @@ -16,7 +16,7 @@ class StaticClusterImpl : public ClusterImplBase { public: StaticClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -40,7 +40,7 @@ class StaticClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; DECLARE_FACTORY(StaticClusterFactory); diff --git a/source/common/upstream/strict_dns_cluster.cc b/source/common/upstream/strict_dns_cluster.cc index d641c31e781d9..2c26424ff6e73 100644 --- a/source/common/upstream/strict_dns_cluster.cc +++ b/source/common/upstream/strict_dns_cluster.cc @@ -12,7 +12,7 @@ StrictDnsClusterImpl::StrictDnsClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) : BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), load_assignment_(cluster.load_assignment()), local_info_(factory_context.localInfo()), @@ -198,7 +198,7 @@ std::pair StrictDnsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) { + Stats::ScopeSharedPtr&& stats_scope) { auto selected_dns_resolver = selectDnsResolver(cluster, context); return std::make_pair(std::make_shared( diff --git a/source/common/upstream/strict_dns_cluster.h b/source/common/upstream/strict_dns_cluster.h index 70c3040414524..d04fb5e833180 100644 --- a/source/common/upstream/strict_dns_cluster.h +++ b/source/common/upstream/strict_dns_cluster.h @@ -18,7 +18,7 @@ class StrictDnsClusterImpl : public BaseDynamicClusterImpl { StrictDnsClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -83,7 +83,7 @@ class StrictDnsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/upstream_impl.cc b/source/common/upstream/upstream_impl.cc index d35d436c4a509..d68fd829cf53f 100644 --- a/source/common/upstream/upstream_impl.cc +++ b/source/common/upstream/upstream_impl.cc @@ -783,8 +783,8 @@ createOptions(const envoy::config::cluster::v3::Cluster& config, ClusterInfoImpl::ClusterInfoImpl( const envoy::config::cluster::v3::Cluster& config, const envoy::config::core::v3::BindConfig& bind_config, Runtime::Loader& runtime, - TransportSocketMatcherPtr&& socket_matcher, Stats::ScopePtr&& stats_scope, bool added_via_api, - Server::Configuration::TransportSocketFactoryContext& factory_context) + TransportSocketMatcherPtr&& socket_matcher, Stats::ScopeSharedPtr&& stats_scope, + bool added_via_api, Server::Configuration::TransportSocketFactoryContext& factory_context) : runtime_(runtime), name_(config.name()), observability_name_(PROTOBUF_GET_STRING_OR_DEFAULT(config, alt_stat_name, name_)), type_(config.type()), @@ -1050,7 +1050,7 @@ ClusterInfoImpl::upstreamHttpProtocol(absl::optional downstream_ ClusterImplBase::ClusterImplBase( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api, TimeSource& time_source) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, TimeSource& time_source) : init_manager_(fmt::format("Cluster {}", cluster.name())), init_watcher_("ClusterImplBase", [this]() { onInitDone(); }), runtime_(runtime), wait_for_warm_on_init_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(cluster, wait_for_warm_on_init, true)), diff --git a/source/common/upstream/upstream_impl.h b/source/common/upstream/upstream_impl.h index f54559954d7bc..802483a615e8f 100644 --- a/source/common/upstream/upstream_impl.h +++ b/source/common/upstream/upstream_impl.h @@ -598,7 +598,7 @@ class ClusterInfoImpl : public ClusterInfo, Envoy::Extensions::Upstreams::Http::ProtocolOptionsConfigImpl; ClusterInfoImpl(const envoy::config::cluster::v3::Cluster& config, const envoy::config::core::v3::BindConfig& bind_config, Runtime::Loader& runtime, - TransportSocketMatcherPtr&& socket_matcher, Stats::ScopePtr&& stats_scope, + TransportSocketMatcherPtr&& socket_matcher, Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, Server::Configuration::TransportSocketFactoryContext&); static ClusterStats generateStats(Stats::Scope& scope, @@ -793,7 +793,7 @@ class ClusterInfoImpl : public ClusterInfo, const float peekahead_ratio_; const uint32_t per_connection_buffer_limit_bytes_; TransportSocketMatcherPtr socket_matcher_; - Stats::ScopePtr stats_scope_; + Stats::ScopeSharedPtr stats_scope_; mutable ClusterStats stats_; Stats::IsolatedStoreImpl load_report_stats_store_; mutable ClusterLoadReportStats load_report_stats_; @@ -905,7 +905,7 @@ class ClusterImplBase : public Cluster, protected Logger::Loggable(cluster, proto_config, context.clusterManager(), context.runtime(), context.api().randomGenerator(), socket_factory_context, diff --git a/source/extensions/clusters/aggregate/cluster.h b/source/extensions/clusters/aggregate/cluster.h index 6d961fd2e0f36..592a4ae34b7cd 100644 --- a/source/extensions/clusters/aggregate/cluster.h +++ b/source/extensions/clusters/aggregate/cluster.h @@ -44,7 +44,7 @@ class Cluster : public Upstream::ClusterImplBase { Upstream::ClusterManager& cluster_manager, Runtime::Loader& runtime, Random::RandomGenerator& random, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); // Upstream::Cluster Upstream::Cluster::InitializePhase initializePhase() const override { @@ -174,7 +174,7 @@ class ClusterFactory : public Upstream::ConfigurableClusterFactoryBase< const envoy::extensions::clusters::aggregate::v3::ClusterConfig& proto_config, Upstream::ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; DECLARE_FACTORY(ClusterFactory); diff --git a/source/extensions/clusters/dynamic_forward_proxy/cluster.cc b/source/extensions/clusters/dynamic_forward_proxy/cluster.cc index b00a2d3399583..6d3cfde175c20 100644 --- a/source/extensions/clusters/dynamic_forward_proxy/cluster.cc +++ b/source/extensions/clusters/dynamic_forward_proxy/cluster.cc @@ -24,7 +24,7 @@ Cluster::Cluster( Extensions::Common::DynamicForwardProxy::DnsCacheManagerFactory& cache_manager_factory, const LocalInfo::LocalInfo& local_info, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) : Upstream::BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), @@ -248,7 +248,7 @@ ClusterFactory::createClusterWithConfig( const envoy::extensions::clusters::dynamic_forward_proxy::v3::ClusterConfig& proto_config, Upstream::ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) { + Stats::ScopeSharedPtr&& stats_scope) { Extensions::Common::DynamicForwardProxy::DnsCacheManagerFactoryImpl cache_manager_factory( context); envoy::config::cluster::v3::Cluster cluster_config = cluster; diff --git a/source/extensions/clusters/dynamic_forward_proxy/cluster.h b/source/extensions/clusters/dynamic_forward_proxy/cluster.h index bea82bdd93ba0..c634d854c0f50 100644 --- a/source/extensions/clusters/dynamic_forward_proxy/cluster.h +++ b/source/extensions/clusters/dynamic_forward_proxy/cluster.h @@ -24,7 +24,7 @@ class Cluster : public Upstream::BaseDynamicClusterImpl, Extensions::Common::DynamicForwardProxy::DnsCacheManagerFactory& cache_manager_factory, const LocalInfo::LocalInfo& local_info, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); // Upstream::Cluster Upstream::Cluster::InitializePhase initializePhase() const override { @@ -167,7 +167,7 @@ class ClusterFactory : public Upstream::ConfigurableClusterFactoryBase< const envoy::extensions::clusters::dynamic_forward_proxy::v3::ClusterConfig& proto_config, Upstream::ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; DECLARE_FACTORY(ClusterFactory); diff --git a/source/extensions/clusters/redis/redis_cluster.cc b/source/extensions/clusters/redis/redis_cluster.cc index 9a64b58050a08..567a94ef049ee 100644 --- a/source/extensions/clusters/redis/redis_cluster.cc +++ b/source/extensions/clusters/redis/redis_cluster.cc @@ -22,7 +22,7 @@ RedisCluster::RedisCluster( Upstream::ClusterManager& cluster_manager, Runtime::Loader& runtime, Api::Api& api, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api, + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, ClusterSlotUpdateCallBackSharedPtr lb_factory) : Upstream::BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, @@ -401,7 +401,7 @@ RedisClusterFactory::createClusterWithConfig( const envoy::extensions::clusters::redis::v3::RedisClusterConfig& proto_config, Upstream::ClusterFactoryContext& context, Envoy::Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Envoy::Stats::ScopePtr&& stats_scope) { + Envoy::Stats::ScopeSharedPtr&& stats_scope) { if (!cluster.has_cluster_type() || cluster.cluster_type().name() != "envoy.clusters.redis") { throw EnvoyException("Redis cluster can only created with redis cluster type."); } diff --git a/source/extensions/clusters/redis/redis_cluster.h b/source/extensions/clusters/redis/redis_cluster.h index ae8553b2effa9..125ab9ecf0f76 100644 --- a/source/extensions/clusters/redis/redis_cluster.h +++ b/source/extensions/clusters/redis/redis_cluster.h @@ -96,7 +96,7 @@ class RedisCluster : public Upstream::BaseDynamicClusterImpl { Upstream::ClusterManager& cluster_manager, Runtime::Loader& runtime, Api::Api& api, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api, + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, ClusterSlotUpdateCallBackSharedPtr factory); struct ClusterSlotsRequest : public Extensions::NetworkFilters::Common::Redis::RespValue { @@ -298,7 +298,7 @@ class RedisClusterFactory : public Upstream::ConfigurableClusterFactoryBase< const envoy::extensions::clusters::redis::v3::RedisClusterConfig& proto_config, Upstream::ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; } // namespace Redis } // namespace Clusters diff --git a/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h b/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h index a0534ac18e78a..0f08facaffbaf 100644 --- a/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h +++ b/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h @@ -226,7 +226,7 @@ class DnsCacheImpl : public DnsCache, Logger::Loggable tls_slot_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; DnsCacheStats stats_; std::list update_callbacks_; absl::Mutex primary_hosts_lock_; diff --git a/source/extensions/filters/network/redis_proxy/config.cc b/source/extensions/filters/network/redis_proxy/config.cc index bdef53f8fbcb6..17c3fbd3fc91f 100644 --- a/source/extensions/filters/network/redis_proxy/config.cc +++ b/source/extensions/filters/network/redis_proxy/config.cc @@ -63,7 +63,7 @@ Network::FilterFactoryCb RedisProxyFilterConfigFactory::createFilterFactoryFromP Upstreams upstreams; for (auto& cluster : unique_clusters) { - Stats::ScopePtr stats_scope = + Stats::ScopeSharedPtr stats_scope = context.scope().createScope(fmt::format("cluster.{}.redis_cluster", cluster)); auto conn_pool_ptr = std::make_shared( cluster, context.clusterManager(), Common::Redis::Client::ClientFactoryImpl::instance_, diff --git a/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc b/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc index 56a06c67e0753..7bf4ab750cfef 100644 --- a/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc +++ b/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc @@ -40,7 +40,7 @@ InstanceImpl::InstanceImpl( Common::Redis::Client::ClientFactory& client_factory, ThreadLocal::SlotAllocator& tls, const envoy::extensions::filters::network::redis_proxy::v3::RedisProxy::ConnPoolSettings& config, - Api::Api& api, Stats::ScopePtr&& stats_scope, + Api::Api& api, Stats::ScopeSharedPtr&& stats_scope, const Common::Redis::RedisCommandStatsSharedPtr& redis_command_stats, Extensions::Common::Redis::ClusterRefreshManagerSharedPtr refresh_manager) : cluster_name_(cluster_name), cm_(cm), client_factory_(client_factory), diff --git a/source/extensions/filters/network/redis_proxy/conn_pool_impl.h b/source/extensions/filters/network/redis_proxy/conn_pool_impl.h index 76373d33fe9c6..7988fb77e86f0 100644 --- a/source/extensions/filters/network/redis_proxy/conn_pool_impl.h +++ b/source/extensions/filters/network/redis_proxy/conn_pool_impl.h @@ -59,7 +59,7 @@ class InstanceImpl : public Instance, public std::enable_shared_from_this& const std::string& address_out_path, Network::Address::InstanceConstSharedPtr address, const Network::Socket::OptionsSharedPtr& socket_options, - Stats::ScopePtr&& listener_scope) { + Stats::ScopeSharedPtr&& listener_scope) { for (const auto& access_log : access_logs) { access_logs_.emplace_back(access_log); } diff --git a/source/server/admin/admin.h b/source/server/admin/admin.h index cc8739342e66e..329e2586c8bf4 100644 --- a/source/server/admin/admin.h +++ b/source/server/admin/admin.h @@ -91,7 +91,7 @@ class AdminImpl : public Admin, const std::string& address_out_path, Network::Address::InstanceConstSharedPtr address, const Network::Socket::OptionsSharedPtr& socket_options, - Stats::ScopePtr&& listener_scope) override; + Stats::ScopeSharedPtr&& listener_scope) override; uint32_t concurrency() const override { return server_.options().concurrency(); } // Network::FilterChainManager @@ -342,7 +342,7 @@ class AdminImpl : public Admin, class AdminListener : public Network::ListenerConfig { public: - AdminListener(AdminImpl& parent, Stats::ScopePtr&& listener_scope) + AdminListener(AdminImpl& parent, Stats::ScopeSharedPtr&& listener_scope) : parent_(parent), name_("admin"), scope_(std::move(listener_scope)), stats_(Http::ConnectionManagerImpl::generateListenerStats("http.admin.", *scope_)), init_manager_(nullptr), ignore_global_conn_limit_(parent.ignore_global_conn_limit_) {} @@ -381,7 +381,7 @@ class AdminImpl : public Admin, AdminImpl& parent_; const std::string name_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; Http::ConnectionManagerListenerStats stats_; Network::NopConnectionBalancerImpl connection_balancer_; BasicResourceLimitImpl open_connections_; diff --git a/source/server/api_listener_impl.h b/source/server/api_listener_impl.h index 9d401fa277bdb..cb713e806b413 100644 --- a/source/server/api_listener_impl.h +++ b/source/server/api_listener_impl.h @@ -179,8 +179,8 @@ class ApiListenerImplBase : public ApiListener, ListenerManagerImpl& parent_; const std::string name_; Network::Address::InstanceConstSharedPtr address_; - Stats::ScopePtr global_scope_; - Stats::ScopePtr listener_scope_; + Stats::ScopeSharedPtr global_scope_; + Stats::ScopeSharedPtr listener_scope_; FactoryContextImpl factory_context_; SyntheticReadCallbacks read_callbacks_; }; diff --git a/source/server/config_validation/admin.cc b/source/server/config_validation/admin.cc index 565ceb1b11879..e0182c634bdd0 100644 --- a/source/server/config_validation/admin.cc +++ b/source/server/config_validation/admin.cc @@ -18,7 +18,7 @@ void ValidationAdmin::startHttpListener(const std::list is_draining_{false}; }; diff --git a/source/server/lds_api.h b/source/server/lds_api.h index 05a4db0a29f56..72d441b80164a 100644 --- a/source/server/lds_api.h +++ b/source/server/lds_api.h @@ -47,7 +47,7 @@ class LdsApiImpl : public LdsApi, Config::SubscriptionPtr subscription_; std::string system_version_info_; ListenerManager& listener_manager_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; Upstream::ClusterManager& cm_; Init::TargetImpl init_target_; }; diff --git a/source/server/listener_impl.h b/source/server/listener_impl.h index a8d1801e70f1b..5505482e39c3f 100644 --- a/source/server/listener_impl.h +++ b/source/server/listener_impl.h @@ -156,8 +156,8 @@ class ListenerFactoryContextBaseImpl final : public Configuration::FactoryContex const Envoy::Config::TypedMetadataImpl typed_metadata_; envoy::config::core::v3::TrafficDirection direction_; - Stats::ScopePtr global_scope_; - Stats::ScopePtr listener_scope_; // Stats with listener named scope. + Stats::ScopeSharedPtr global_scope_; + Stats::ScopeSharedPtr listener_scope_; // Stats with listener named scope. ProtobufMessage::ValidationVisitor& validation_visitor_; const Server::DrainManagerPtr drain_manager_; bool is_quic_; diff --git a/source/server/listener_manager_impl.h b/source/server/listener_manager_impl.h index 5711a988bd0ed..e6d93f80074cc 100644 --- a/source/server/listener_manager_impl.h +++ b/source/server/listener_manager_impl.h @@ -318,7 +318,7 @@ class ListenerManagerImpl : public ListenerManager, Logger::Loggable workers_; bool workers_started_{}; absl::optional stop_listeners_type_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; ListenerManagerStats stats_; ConfigTracker::EntryOwnerPtr config_tracker_entry_; LdsApiPtr lds_api_; diff --git a/source/server/server.h b/source/server/server.h index 29f4944f74d41..eada46f57435e 100644 --- a/source/server/server.h +++ b/source/server/server.h @@ -216,7 +216,7 @@ class ServerFactoryContextImpl : public Configuration::ServerFactoryContext, private: Instance& server_; - Stats::ScopePtr server_scope_; + Stats::ScopeSharedPtr server_scope_; }; /** diff --git a/test/common/grpc/async_client_manager_impl_test.cc b/test/common/grpc/async_client_manager_impl_test.cc index c3ffb0d795724..3112d3ec28ccd 100644 --- a/test/common/grpc/async_client_manager_impl_test.cc +++ b/test/common/grpc/async_client_manager_impl_test.cc @@ -178,6 +178,7 @@ TEST_F(AsyncClientManagerImplTest, EnvoyGrpcInvalid) { } TEST_F(AsyncClientManagerImplTest, GoogleGrpc) { + ; EXPECT_CALL(scope_, createScope_("grpc.foo.")); envoy::config::core::v3::GrpcService grpc_service; grpc_service.mutable_google_grpc()->set_stat_prefix("foo"); diff --git a/test/common/stats/isolated_store_impl_test.cc b/test/common/stats/isolated_store_impl_test.cc index f3a3e0a31dcd2..a94703b50c9d9 100644 --- a/test/common/stats/isolated_store_impl_test.cc +++ b/test/common/stats/isolated_store_impl_test.cc @@ -31,7 +31,7 @@ class StatsIsolatedStoreImplTest : public testing::Test { }; TEST_F(StatsIsolatedStoreImplTest, All) { - ScopePtr scope1 = store_->createScope("scope1."); + ScopeSharedPtr scope1 = store_->createScope("scope1."); Counter& c1 = store_->counterFromString("c1"); Counter& c2 = scope1->counterFromString("c2"); EXPECT_EQ("c1", c1.name()); @@ -108,11 +108,11 @@ TEST_F(StatsIsolatedStoreImplTest, All) { ASSERT_TRUE(found_histogram.has_value()); EXPECT_EQ(&h1, &found_histogram->get()); - ScopePtr scope2 = scope1->scopeFromStatName(makeStatName("foo.")); + ScopeSharedPtr scope2 = scope1->scopeFromStatName(makeStatName("foo.")); EXPECT_EQ("scope1.foo.bar", scope2->counterFromString("bar").name()); // Validate that we sanitize away bad characters in the stats prefix. - ScopePtr scope3 = scope1->createScope(std::string("foo:\0:.", 7)); + ScopeSharedPtr scope3 = scope1->createScope(std::string("foo:\0:.", 7)); EXPECT_EQ("scope1.foo___.bar", scope3->counterFromString("bar").name()); EXPECT_EQ(4UL, store_->counters().size()); @@ -125,14 +125,14 @@ TEST_F(StatsIsolatedStoreImplTest, All) { } TEST_F(StatsIsolatedStoreImplTest, PrefixIsStatName) { - ScopePtr scope1 = store_->createScope("scope1"); - ScopePtr scope2 = scope1->scopeFromStatName(makeStatName("scope2")); + ScopeSharedPtr scope1 = store_->createScope("scope1"); + ScopeSharedPtr scope2 = scope1->scopeFromStatName(makeStatName("scope2")); Counter& c1 = scope2->counterFromString("c1"); EXPECT_EQ("scope1.scope2.c1", c1.name()); } TEST_F(StatsIsolatedStoreImplTest, AllWithSymbolTable) { - ScopePtr scope1 = store_->createScope("scope1."); + ScopeSharedPtr scope1 = store_->createScope("scope1."); Counter& c1 = store_->counterFromStatName(makeStatName("c1")); Counter& c2 = scope1->counterFromStatName(makeStatName("c2")); EXPECT_EQ("c1", c1.name()); @@ -174,11 +174,11 @@ TEST_F(StatsIsolatedStoreImplTest, AllWithSymbolTable) { h1.recordValue(200); h2.recordValue(200); - ScopePtr scope2 = scope1->createScope("foo."); + ScopeSharedPtr scope2 = scope1->createScope("foo."); EXPECT_EQ("scope1.foo.bar", scope2->counterFromStatName(makeStatName("bar")).name()); // Validate that we sanitize away bad characters in the stats prefix. - ScopePtr scope3 = scope1->createScope(std::string("foo:\0:.", 7)); + ScopeSharedPtr scope3 = scope1->createScope(std::string("foo:\0:.", 7)); EXPECT_EQ("scope1.foo___.bar", scope3->counterFromString("bar").name()); EXPECT_EQ(4UL, store_->counters().size()); @@ -187,7 +187,7 @@ TEST_F(StatsIsolatedStoreImplTest, AllWithSymbolTable) { } TEST_F(StatsIsolatedStoreImplTest, ConstSymtabAccessor) { - ScopePtr scope = store_->createScope("scope."); + ScopeSharedPtr scope = store_->createScope("scope."); const Scope& cscope = *scope; const SymbolTable& const_symbol_table = cscope.constSymbolTable(); SymbolTable& symbol_table = scope->symbolTable(); @@ -197,7 +197,7 @@ TEST_F(StatsIsolatedStoreImplTest, ConstSymtabAccessor) { TEST_F(StatsIsolatedStoreImplTest, LongStatName) { const std::string long_string(128, 'A'); - ScopePtr scope = store_->createScope("scope."); + ScopeSharedPtr scope = store_->createScope("scope."); Counter& counter = scope->counterFromString(long_string); EXPECT_EQ(absl::StrCat("scope.", long_string), counter.name()); } @@ -250,8 +250,8 @@ TEST_F(StatsIsolatedStoreImplTest, StatNamesStruct) { MAKE_STAT_NAMES_STRUCT(StatNames, ALL_TEST_STATS); StatNames stat_names(store_->symbolTable()); EXPECT_EQ("prefix", store_->symbolTable().toString(stat_names.prefix_)); - ScopePtr scope1 = store_->createScope("scope1."); - ScopePtr scope2 = store_->createScope("scope2."); + ScopeSharedPtr scope1 = store_->createScope("scope1."); + ScopeSharedPtr scope2 = store_->createScope("scope2."); MAKE_STATS_STRUCT(Stats, StatNames, ALL_TEST_STATS); Stats stats1(stat_names, *scope1); EXPECT_EQ("scope1.test_counter", stats1.test_counter_.name()); diff --git a/test/common/stats/thread_local_store_test.cc b/test/common/stats/thread_local_store_test.cc index edb0faa12d40f..25b4eed29b236 100644 --- a/test/common/stats/thread_local_store_test.cc +++ b/test/common/stats/thread_local_store_test.cc @@ -343,7 +343,7 @@ TEST_F(StatsThreadLocalStoreTest, BasicScope) { InSequence s; store_->initializeThreading(main_thread_dispatcher_, tls_); - ScopePtr scope1 = store_->createScope("scope1."); + ScopeSharedPtr scope1 = store_->createScope("scope1."); Counter& c1 = store_->counterFromString("c1"); Counter& c2 = scope1->counterFromString("c2"); EXPECT_EQ("c1", c1.name()); @@ -434,8 +434,8 @@ TEST_F(StatsThreadLocalStoreTest, HistogramScopeOverlap) { store_->initializeThreading(main_thread_dispatcher_, tls_); // Creating two scopes with the same name gets you two distinct scope objects. - ScopePtr scope1 = store_->createScope("scope."); - ScopePtr scope2 = store_->createScope("scope."); + ScopeSharedPtr scope1 = store_->createScope("scope."); + ScopeSharedPtr scope2 = store_->createScope("scope."); EXPECT_NE(scope1, scope2); EXPECT_EQ(0, store_->histograms().size()); @@ -512,15 +512,15 @@ TEST_F(StatsThreadLocalStoreTest, ForEach) { EXPECT_THAT(collect_gauges(), UnorderedElementsAreArray(empty)); EXPECT_THAT(collect_text_readouts(), UnorderedElementsAreArray(empty)); - ScopePtr scope1 = store_->createScope("scope1"); + ScopeSharedPtr scope1 = store_->createScope("scope1"); scope1->counterFromString("counter1"); scope1->gaugeFromString("gauge1", Gauge::ImportMode::Accumulate); scope1->textReadoutFromString("tr1"); - ScopePtr scope2 = scope1->createScope("scope2"); + ScopeSharedPtr scope2 = scope1->createScope("scope2"); scope2->counterFromString("counter2"); scope2->gaugeFromString("gauge2", Gauge::ImportMode::Accumulate); scope2->textReadoutFromString("tr2"); - ScopePtr scope3 = store_->createScope("scope3"); + ScopeSharedPtr scope3 = store_->createScope("scope3"); EXPECT_THAT(collect_scopes(), UnorderedElementsAreArray({"", "", "scope1", "scope1.scope2", "scope3"})); EXPECT_THAT(collect_counters(), @@ -536,7 +536,7 @@ TEST_F(StatsThreadLocalStoreTest, SanitizePrefix) { InSequence s; store_->initializeThreading(main_thread_dispatcher_, tls_); - ScopePtr scope1 = store_->createScope(std::string("scope1:\0:foo.", 13)); + ScopeSharedPtr scope1 = store_->createScope(std::string("scope1:\0:foo.", 13)); Counter& c1 = scope1->counterFromString("c1"); EXPECT_EQ("scope1___foo.c1", c1.name()); @@ -546,7 +546,7 @@ TEST_F(StatsThreadLocalStoreTest, SanitizePrefix) { } TEST_F(StatsThreadLocalStoreTest, ConstSymtabAccessor) { - ScopePtr scope = store_->createScope("scope."); + ScopeSharedPtr scope = store_->createScope("scope."); const Scope& cscope = *scope; const SymbolTable& const_symbol_table = cscope.constSymbolTable(); SymbolTable& symbol_table = scope->symbolTable(); @@ -557,7 +557,7 @@ TEST_F(StatsThreadLocalStoreTest, ScopeDelete) { InSequence s; store_->initializeThreading(main_thread_dispatcher_, tls_); - ScopePtr scope1 = store_->createScope("scope1."); + ScopeSharedPtr scope1 = store_->createScope("scope1."); scope1->counterFromString("c1"); EXPECT_EQ(1UL, store_->counters().size()); CounterSharedPtr c1 = TestUtility::findCounter(*store_, "scope1.c1"); @@ -585,7 +585,7 @@ TEST_F(StatsThreadLocalStoreTest, NestedScopes) { InSequence s; store_->initializeThreading(main_thread_dispatcher_, tls_); - ScopePtr scope1 = store_->createScope("scope1."); + ScopeSharedPtr scope1 = store_->createScope("scope1."); Counter& c1 = scope1->counterFromString("foo.bar"); EXPECT_EQ("scope1.foo.bar", c1.name()); StatNameManagedStorage c1_name("scope1.foo.bar", symbol_table_); @@ -593,7 +593,7 @@ TEST_F(StatsThreadLocalStoreTest, NestedScopes) { ASSERT_TRUE(found_counter.has_value()); EXPECT_EQ(&c1, &found_counter->get()); - ScopePtr scope2 = scope1->createScope("foo."); + ScopeSharedPtr scope2 = scope1->createScope("foo."); Counter& c2 = scope2->counterFromString("bar"); EXPECT_EQ(&c1, &c2); EXPECT_EQ("scope1.foo.bar", c2.name()); @@ -623,8 +623,8 @@ TEST_F(StatsThreadLocalStoreTest, OverlappingScopes) { // Both scopes point to the same namespace. This can happen during reload of a cluster for // example. - ScopePtr scope1 = store_->createScope("scope1."); - ScopePtr scope2 = store_->createScope("scope1."); + ScopeSharedPtr scope1 = store_->createScope("scope1."); + ScopeSharedPtr scope2 = store_->createScope("scope1."); // We will call alloc twice, but they should point to the same backing storage. Counter& c1 = scope1->counterFromString("c"); @@ -750,7 +750,7 @@ class ThreadLocalStoreNoMocksTestBase : public testing::Test { class LookupWithStatNameTest : public ThreadLocalStoreNoMocksTestBase {}; TEST_F(LookupWithStatNameTest, All) { - ScopePtr scope1 = store_->scopeFromStatName(makeStatName("scope1")); + ScopeSharedPtr scope1 = store_->scopeFromStatName(makeStatName("scope1")); Counter& c1 = store_->Store::counterFromStatName(makeStatName("c1")); Counter& c2 = scope1->counterFromStatName(makeStatName("c2")); EXPECT_EQ("c1", c1.name()); @@ -782,12 +782,12 @@ TEST_F(LookupWithStatNameTest, All) { h1.recordValue(200); h2.recordValue(200); - ScopePtr scope2 = scope1->scopeFromStatName(makeStatName("foo")); + ScopeSharedPtr scope2 = scope1->scopeFromStatName(makeStatName("foo")); EXPECT_EQ("scope1.foo.bar", scope2->counterFromStatName(makeStatName("bar")).name()); // Validate that we sanitize away bad characters in the stats prefix. This happens only // when constructing a stat from a string, not from a stat name. - ScopePtr scope3 = scope1->createScope(std::string("foo:\0:.", 7)); + ScopeSharedPtr scope3 = scope1->createScope(std::string("foo:\0:.", 7)); EXPECT_EQ("scope1.foo___.bar", scope3->counterFromString("bar").name()); EXPECT_EQ(4UL, store_->counters().size()); @@ -1104,7 +1104,7 @@ class RememberStatsMatcherTest : public testing::TestWithParam { StatsMatcherPtr matcher_ptr(matcher); store_.setStatsMatcher(std::move(matcher_ptr)); - ScopePtr scope = store_.createScope("scope."); + ScopeSharedPtr scope = store_.createScope("scope."); StatNamePool pool(symbol_table_); for (int j = 0; j < 5; ++j) { @@ -1171,7 +1171,7 @@ class RememberStatsMatcherTest : public testing::TestWithParam { NiceMock tls_; AllocatorImpl heap_alloc_; ThreadLocalStoreImpl store_; - ScopePtr scope_; + ScopeSharedPtr scope_; }; INSTANTIATE_TEST_SUITE_P(RememberStatsMatcherTest, RememberStatsMatcherTest, @@ -1429,7 +1429,7 @@ TEST(ThreadLocalStoreThreadTest, ConstructDestruct) { ThreadLocalStoreImpl store(alloc); store.initializeThreading(*dispatcher, tls); - { ScopePtr scope1 = store.createScope("scope1."); } + { ScopeSharedPtr scope1 = store.createScope("scope1."); } tls.shutdownGlobalThreading(); store.shutdownThreading(); tls.shutdownThread(); @@ -1495,7 +1495,7 @@ TEST_F(HistogramTest, MultiHistogramMultipleMerges) { } TEST_F(HistogramTest, BasicScopeHistogramMerge) { - ScopePtr scope1 = store_->createScope("scope1."); + ScopeSharedPtr scope1 = store_->createScope("scope1."); Histogram& h1 = store_->histogramFromString("h1", Histogram::Unit::Unspecified); Histogram& h2 = scope1->histogramFromString("h2", Histogram::Unit::Unspecified); @@ -1574,7 +1574,7 @@ TEST_F(HistogramTest, BasicHistogramMergeSummary) { } TEST_F(HistogramTest, BasicHistogramUsed) { - ScopePtr scope1 = store_->createScope("scope1."); + ScopeSharedPtr scope1 = store_->createScope("scope1."); Histogram& h1 = store_->histogramFromString("h1", Histogram::Unit::Unspecified); Histogram& h2 = scope1->histogramFromString("h2", Histogram::Unit::Unspecified); @@ -1605,7 +1605,7 @@ TEST_F(HistogramTest, BasicHistogramUsed) { } TEST_F(HistogramTest, ParentHistogramBucketSummary) { - ScopePtr scope1 = store_->createScope("scope1."); + ScopeSharedPtr scope1 = store_->createScope("scope1."); Histogram& histogram = store_->histogramFromString("histogram", Histogram::Unit::Unspecified); store_->mergeHistograms([]() -> void {}); ASSERT_EQ(1, store_->histograms().size()); @@ -1716,7 +1716,7 @@ class ClusterShutdownCleanupStarvationTest : public ThreadLocalRealThreadsTestBa void createScopesIncCountersAndCleanup() { for (uint32_t i = 0; i < NumScopes; ++i) { - ScopePtr scope = store_->createScope("scope."); + ScopeSharedPtr scope = store_->createScope("scope."); Counter& counter = scope->counterFromStatName(my_counter_name_); counter.inc(); } @@ -1841,8 +1841,8 @@ TEST_F(HistogramThreadTest, MakeHistogramsAndRecordValues) { TEST_F(HistogramThreadTest, ScopeOverlap) { // Creating two scopes with the same name gets you two distinct scope objects. - ScopePtr scope1 = store_->createScope("scope."); - ScopePtr scope2 = store_->createScope("scope."); + ScopeSharedPtr scope1 = store_->createScope("scope."); + ScopeSharedPtr scope2 = store_->createScope("scope."); EXPECT_NE(scope1, scope2); EXPECT_EQ(0, store_->histograms().size()); diff --git a/test/common/stats/utility_fuzz_test.cc b/test/common/stats/utility_fuzz_test.cc index 7c302624c740b..8a0e698385ecd 100644 --- a/test/common/stats/utility_fuzz_test.cc +++ b/test/common/stats/utility_fuzz_test.cc @@ -44,7 +44,7 @@ DEFINE_FUZZER(const uint8_t* buf, size_t len) { std::unique_ptr store = std::make_unique(symbol_table); Stats::StatNamePool pool(symbol_table); - Stats::ScopePtr scope = store->createScope(provider.ConsumeRandomLengthString(max_len)); + Stats::ScopeSharedPtr scope = store->createScope(provider.ConsumeRandomLengthString(max_len)); Stats::ElementVec ele_vec; Stats::StatNameVec sn_vec; Stats::StatNameTagVector tags; diff --git a/test/common/stats/utility_test.cc b/test/common/stats/utility_test.cc index 040b63bb34bbc..bd922c4f2f258 100644 --- a/test/common/stats/utility_test.cc +++ b/test/common/stats/utility_test.cc @@ -161,7 +161,7 @@ class StatsUtilityTest : public testing::TestWithParam { StatNamePool pool_; std::unique_ptr alloc_; std::unique_ptr store_; - ScopePtr scope_; + ScopeSharedPtr scope_; absl::flat_hash_set results_; StatNameTagVector tags_; }; @@ -170,7 +170,7 @@ INSTANTIATE_TEST_SUITE_P(StatsUtilityTest, StatsUtilityTest, testing::ValuesIn({StoreType::ThreadLocal, StoreType::Isolated})); TEST_P(StatsUtilityTest, Counters) { - ScopePtr scope = store_->createScope("scope."); + ScopeSharedPtr scope = store_->createScope("scope."); Counter& c1 = Utility::counterFromElements(*scope, {DynamicName("a"), DynamicName("b")}); EXPECT_EQ("scope.a.b", c1.name()); StatName token = pool_.add("token"); @@ -189,7 +189,7 @@ TEST_P(StatsUtilityTest, Counters) { } TEST_P(StatsUtilityTest, Gauges) { - ScopePtr scope = store_->createScope("scope."); + ScopeSharedPtr scope = store_->createScope("scope."); Gauge& g1 = Utility::gaugeFromElements(*scope, {DynamicName("a"), DynamicName("b")}, Gauge::ImportMode::NeverImport); EXPECT_EQ("scope.a.b", g1.name()); @@ -208,7 +208,7 @@ TEST_P(StatsUtilityTest, Gauges) { } TEST_P(StatsUtilityTest, Histograms) { - ScopePtr scope = store_->createScope("scope."); + ScopeSharedPtr scope = store_->createScope("scope."); Histogram& h1 = Utility::histogramFromElements(*scope, {DynamicName("a"), DynamicName("b")}, Histogram::Unit::Milliseconds); EXPECT_EQ("scope.a.b", h1.name()); @@ -227,7 +227,7 @@ TEST_P(StatsUtilityTest, Histograms) { } TEST_P(StatsUtilityTest, TextReadouts) { - ScopePtr scope = store_->createScope("scope."); + ScopeSharedPtr scope = store_->createScope("scope."); TextReadout& t1 = Utility::textReadoutFromElements(*scope, {DynamicName("a"), DynamicName("b")}); EXPECT_EQ("scope.a.b", t1.name()); StatName token = pool_.add("token"); diff --git a/test/common/upstream/cluster_factory_impl_test.cc b/test/common/upstream/cluster_factory_impl_test.cc index 8ae0c5cad5f5c..8f63415707a66 100644 --- a/test/common/upstream/cluster_factory_impl_test.cc +++ b/test/common/upstream/cluster_factory_impl_test.cc @@ -43,7 +43,7 @@ class TestStaticClusterFactory : public Event::TestUsingSimulatedTime, std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override { + Stats::ScopeSharedPtr&& stats_scope) override { return std::make_pair(std::make_shared( cluster, context.runtime(), socket_factory_context, std::move(stats_scope), context.addedViaApi(), 1, "127.0.0.1", 80), diff --git a/test/common/upstream/eds_speed_test.cc b/test/common/upstream/eds_speed_test.cc index c3d6a43e27ef9..ba6e9bdb3ce9f 100644 --- a/test/common/upstream/eds_speed_test.cc +++ b/test/common/upstream/eds_speed_test.cc @@ -81,7 +81,7 @@ class EdsSpeedTest { void resetCluster(const std::string& yaml_config, Cluster::InitializePhase initialize_phase) { local_info_.node_.mutable_locality()->set_zone("us-east-1a"); eds_cluster_ = parseClusterFromV3Yaml(yaml_config); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", eds_cluster_.alt_stat_name().empty() ? eds_cluster_.name() : eds_cluster_.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/eds_test.cc b/test/common/upstream/eds_test.cc index a1dab7eda2112..62a3e95b8782b 100644 --- a/test/common/upstream/eds_test.cc +++ b/test/common/upstream/eds_test.cc @@ -121,7 +121,7 @@ class EdsTest : public testing::Test { void resetCluster(const std::string& yaml_config, Cluster::InitializePhase initialize_phase) { local_info_.node_.mutable_locality()->set_zone("us-east-1a"); eds_cluster_ = parseClusterFromV3Yaml(yaml_config); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", eds_cluster_.alt_stat_name().empty() ? eds_cluster_.name() : eds_cluster_.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/hds_test.cc b/test/common/upstream/hds_test.cc index 23da61c810cb6..b7c6d6b26b8a4 100644 --- a/test/common/upstream/hds_test.cc +++ b/test/common/upstream/hds_test.cc @@ -578,7 +578,7 @@ TEST_F(HdsTest, TestSocketContext) { EXPECT_CALL(test_factory_, createClusterInfo(_)) .WillRepeatedly(Invoke([&](const ClusterInfoFactory::CreateClusterInfoParams& params) { // Build scope, factory_context as does ProdClusterInfoFactory. - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( params.admin_, params.ssl_context_manager_, *scope, params.cm_, params.local_info_, @@ -1030,7 +1030,7 @@ TEST_F(HdsTest, TestUpdateSocketContext) { EXPECT_CALL(test_factory_, createClusterInfo(_)) .WillRepeatedly(Invoke([&](const ClusterInfoFactory::CreateClusterInfoParams& params) { // Build scope, factory_context as does ProdClusterInfoFactory. - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( params.admin_, params.ssl_context_manager_, *scope, params.cm_, params.local_info_, diff --git a/test/common/upstream/leds_test.cc b/test/common/upstream/leds_test.cc index 300c6c20ad8cd..a0dcdc671137f 100644 --- a/test/common/upstream/leds_test.cc +++ b/test/common/upstream/leds_test.cc @@ -156,7 +156,7 @@ class LedsTest : public testing::Test { Ssl::MockContextManager ssl_context_manager_; NiceMock cm_; NiceMock dispatcher_; - Envoy::Stats::ScopePtr cluster_scope_; + Envoy::Stats::ScopeSharedPtr cluster_scope_; LedsSubscriptionPtr leds_subscription_; NiceMock random_; NiceMock runtime_; diff --git a/test/common/upstream/logical_dns_cluster_test.cc b/test/common/upstream/logical_dns_cluster_test.cc index 9afdd78e71c92..8135cad9954bf 100644 --- a/test/common/upstream/logical_dns_cluster_test.cc +++ b/test/common/upstream/logical_dns_cluster_test.cc @@ -48,7 +48,7 @@ class LogicalDnsClusterTest : public Event::TestUsingSimulatedTime, public testi resolve_timer_ = new Event::MockTimer(&dispatcher_); NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/original_dst_cluster_test.cc b/test/common/upstream/original_dst_cluster_test.cc index 6fc86b2e056a8..369f4c19d01d2 100644 --- a/test/common/upstream/original_dst_cluster_test.cc +++ b/test/common/upstream/original_dst_cluster_test.cc @@ -75,7 +75,7 @@ class OriginalDstClusterTest : public Event::TestUsingSimulatedTime, public test void setup(const envoy::config::cluster::v3::Cluster& cluster_config) { NiceMock cm; - Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/subset_lb_test.cc b/test/common/upstream/subset_lb_test.cc index 133d15cacba90..b925294c25394 100644 --- a/test/common/upstream/subset_lb_test.cc +++ b/test/common/upstream/subset_lb_test.cc @@ -481,7 +481,7 @@ class SubsetLoadBalancerTest : public Event::TestUsingSimulatedTime, NiceMock runtime_; NiceMock random_; Stats::IsolatedStoreImpl stats_store_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; ClusterStatNames stat_names_; ClusterStats stats_; PrioritySetImpl local_priority_set_; diff --git a/test/common/upstream/transport_socket_matcher_test.cc b/test/common/upstream/transport_socket_matcher_test.cc index 4a3f8af0690c9..88d200f4e1404 100644 --- a/test/common/upstream/transport_socket_matcher_test.cc +++ b/test/common/upstream/transport_socket_matcher_test.cc @@ -107,7 +107,7 @@ class TransportSocketMatcherTest : public testing::Test { NiceMock mock_factory_context_; Network::TransportSocketFactoryPtr mock_default_factory_; Stats::IsolatedStoreImpl stats_store_; - Stats::ScopePtr stats_scope_; + Stats::ScopeSharedPtr stats_scope_; }; TEST_F(TransportSocketMatcherTest, ReturnDefaultSocketFactoryWhenNoMatch) { diff --git a/test/common/upstream/upstream_impl_test.cc b/test/common/upstream/upstream_impl_test.cc index a52916f4ef471..f66ce7daa6b97 100644 --- a/test/common/upstream/upstream_impl_test.cc +++ b/test/common/upstream/upstream_impl_test.cc @@ -190,7 +190,7 @@ TEST_P(StrictDnsParamTest, ImmediateResolve) { return nullptr; })); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -224,7 +224,7 @@ TEST_F(StrictDnsClusterImplTest, ZeroHostsIsInializedImmediately) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -259,7 +259,7 @@ TEST_F(StrictDnsClusterImplTest, ZeroHostsHealthChecker) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -305,7 +305,7 @@ TEST_F(StrictDnsClusterImplTest, DontWaitForDNSOnInit) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -380,7 +380,7 @@ TEST_F(StrictDnsClusterImplTest, Basic) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -536,7 +536,7 @@ TEST_F(StrictDnsClusterImplTest, HostRemovalActiveHealthSkipped) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -597,7 +597,7 @@ TEST_F(StrictDnsClusterImplTest, HostRemovalAfterHcFail) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -724,7 +724,7 @@ TEST_F(StrictDnsClusterImplTest, LoadAssignmentBasic) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -962,7 +962,7 @@ TEST_F(StrictDnsClusterImplTest, LoadAssignmentBasicMultiplePriorities) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1078,7 +1078,7 @@ TEST_F(StrictDnsClusterImplTest, CustomResolverFails) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -1113,7 +1113,7 @@ TEST_F(StrictDnsClusterImplTest, FailureRefreshRateBackoffResetsWhenSuccessHappe )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1162,7 +1162,7 @@ TEST_F(StrictDnsClusterImplTest, TtlAsDnsRefreshRate) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1242,7 +1242,7 @@ TEST_F(StrictDnsClusterImplTest, Http2UserDefinedSettingsParametersValidation) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1470,7 +1470,7 @@ TEST_F(StaticClusterImplTest, InitialHosts) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1505,7 +1505,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentEmptyHostname) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1540,7 +1540,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentNonEmptyHostname) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1575,7 +1575,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentNonEmptyHostnameWithHealthChecks) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1628,7 +1628,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentMultiplePriorities) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1673,7 +1673,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentLocality) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1719,7 +1719,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentEdsHealth) { NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1751,7 +1751,7 @@ TEST_F(StaticClusterImplTest, AltStatName) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1781,7 +1781,7 @@ TEST_F(StaticClusterImplTest, RingHash) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1819,7 +1819,7 @@ TEST_F(StaticClusterImplTest, RoundRobinWithSlowStart) { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1861,7 +1861,7 @@ TEST_F(StaticClusterImplTest, LeastRequestWithSlowStart) { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1901,7 +1901,7 @@ TEST_F(StaticClusterImplTest, OutlierDetector) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1959,7 +1959,7 @@ TEST_F(StaticClusterImplTest, HealthyStat) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2100,7 +2100,7 @@ TEST_F(StaticClusterImplTest, UrlConfig) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2152,7 +2152,7 @@ TEST_F(StaticClusterImplTest, UnsupportedLBType) { EXPECT_THROW_WITH_REGEX( { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); @@ -2195,7 +2195,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2240,7 +2240,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithOtherLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2283,7 +2283,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithoutLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2313,7 +2313,7 @@ TEST_F(StaticClusterImplTest, MalformedHostIP) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2341,7 +2341,7 @@ TEST_F(StaticClusterImplTest, NoHostsTest) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2360,7 +2360,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { { // If the cluster manager gets a source address from the bootstrap proto, use it. cm_.bind_config_.mutable_source_address()->set_address("1.2.3.5"); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2373,7 +2373,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { config.mutable_upstream_bind_config()->mutable_source_address()->set_address(cluster_address); { // Verify source address from cluster config is used when present. - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2385,7 +2385,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { { // The source address from cluster config takes precedence over one from the bootstrap proto. cm_.bind_config_.mutable_source_address()->set_address("1.2.3.5"); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2409,7 +2409,7 @@ TEST_F(StaticClusterImplTest, LedsUnsupported) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2445,7 +2445,7 @@ TEST_F(ClusterImplTest, CloseConnectionsOnHostHealthFailure) { port_value: 443 )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2683,7 +2683,7 @@ class ClusterInfoImplTest : public testing::Test { NiceMock tls_; ReadyWatcher initialized_; envoy::config::cluster::v3::Cluster cluster_config_; - Envoy::Stats::ScopePtr scope_; + Envoy::Stats::ScopeSharedPtr scope_; std::unique_ptr factory_context_; NiceMock validation_visitor_; Api::ApiPtr api_; diff --git a/test/extensions/bootstrap/wasm/wasm_speed_test.cc b/test/extensions/bootstrap/wasm/wasm_speed_test.cc index aaadd74ba6e21..16ed10b24d053 100644 --- a/test/extensions/bootstrap/wasm/wasm_speed_test.cc +++ b/test/extensions/bootstrap/wasm/wasm_speed_test.cc @@ -46,7 +46,7 @@ static void bmWasmSimpleCallSpeedTest(benchmark::State& state, std::string test, Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; envoy::extensions::wasm::v3::PluginConfig plugin_config; diff --git a/test/extensions/clusters/aggregate/cluster_test.cc b/test/extensions/clusters/aggregate/cluster_test.cc index 97f2ecb6983de..36e2bddcf2bc3 100644 --- a/test/extensions/clusters/aggregate/cluster_test.cc +++ b/test/extensions/clusters/aggregate/cluster_test.cc @@ -96,7 +96,7 @@ class AggregateClusterTest : public Event::TestUsingSimulatedTime, public testin envoy::extensions::clusters::aggregate::v3::ClusterConfig config; Config::Utility::translateOpaqueConfig(cluster_config.cluster_type().typed_config(), ProtobufMessage::getStrictValidationVisitor(), config); - Stats::ScopePtr scope = stats_store_.createScope("cluster.name."); + Stats::ScopeSharedPtr scope = stats_store_.createScope("cluster.name."); Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_store_, singleton_manager_, tls_, validation_visitor_, *api_, options_); diff --git a/test/extensions/clusters/dynamic_forward_proxy/cluster_test.cc b/test/extensions/clusters/dynamic_forward_proxy/cluster_test.cc index 4160758acafe2..121325af0ece7 100644 --- a/test/extensions/clusters/dynamic_forward_proxy/cluster_test.cc +++ b/test/extensions/clusters/dynamic_forward_proxy/cluster_test.cc @@ -40,7 +40,7 @@ class ClusterTest : public testing::Test, envoy::extensions::clusters::dynamic_forward_proxy::v3::ClusterConfig config; Config::Utility::translateOpaqueConfig(cluster_config.cluster_type().typed_config(), ProtobufMessage::getStrictValidationVisitor(), config); - Stats::ScopePtr scope = stats_store_.createScope("cluster.name."); + Stats::ScopeSharedPtr scope = stats_store_.createScope("cluster.name."); Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_store_, singleton_manager_, tls_, validation_visitor_, *api_, options_); diff --git a/test/extensions/clusters/redis/redis_cluster_test.cc b/test/extensions/clusters/redis/redis_cluster_test.cc index 8c1fc3cc9f352..daa32f803f756 100644 --- a/test/extensions/clusters/redis/redis_cluster_test.cc +++ b/test/extensions/clusters/redis/redis_cluster_test.cc @@ -99,7 +99,7 @@ class RedisClusterTest : public testing::Test, expectRedisSessionCreated(); NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = Upstream::parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -128,7 +128,7 @@ class RedisClusterTest : public testing::Test, void setupFactoryFromV3Yaml(const std::string& yaml) { NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = Upstream::parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/extensions/common/wasm/wasm_speed_test.cc b/test/extensions/common/wasm/wasm_speed_test.cc index f2e9371267e04..20123bf881ed3 100644 --- a/test/extensions/common/wasm/wasm_speed_test.cc +++ b/test/extensions/common/wasm/wasm_speed_test.cc @@ -28,7 +28,7 @@ void bmWasmSpeedTest(benchmark::State& state) { Envoy::Api::ApiPtr api = Envoy::Api::createApiForTest(stats_store); Envoy::Upstream::MockClusterManager cluster_manager; Envoy::Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Envoy::Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Envoy::Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); proxy_wasm::AllowedCapabilitiesMap allowed_capabilities; envoy::extensions::wasm::v3::PluginConfig plugin_config; diff --git a/test/extensions/common/wasm/wasm_test.cc b/test/extensions/common/wasm/wasm_test.cc index ff7398083d9eb..8d4091340d9dd 100644 --- a/test/extensions/common/wasm/wasm_test.cc +++ b/test/extensions/common/wasm/wasm_test.cc @@ -97,7 +97,7 @@ TEST_P(WasmCommonTest, WasmFailState) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; envoy::extensions::wasm::v3::PluginConfig plugin_config; @@ -161,7 +161,7 @@ TEST_P(WasmCommonTest, Logging) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "logging"; auto plugin_configuration = "configure-test"; @@ -242,7 +242,7 @@ TEST_P(WasmCommonTest, BadSignature) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; const auto code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( "{{ test_rundir }}/test/extensions/common/wasm/test_data/bad_signature_cpp.wasm")); @@ -270,7 +270,7 @@ TEST_P(WasmCommonTest, Segv) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "segv"; const auto code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( @@ -313,7 +313,7 @@ TEST_P(WasmCommonTest, DivByZero) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "divbyzero"; @@ -348,7 +348,7 @@ TEST_P(WasmCommonTest, IntrinsicGlobals) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "globals"; @@ -390,7 +390,7 @@ TEST_P(WasmCommonTest, Utilities) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "utilities"; @@ -459,7 +459,7 @@ TEST_P(WasmCommonTest, Stats) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "stats"; @@ -506,7 +506,7 @@ TEST_P(WasmCommonTest, Foreign) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "foreign"; @@ -546,7 +546,7 @@ TEST_P(WasmCommonTest, OnForeign) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "on_foreign"; @@ -594,7 +594,7 @@ TEST_P(WasmCommonTest, WASI) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "WASI"; @@ -638,7 +638,7 @@ TEST_P(WasmCommonTest, VmCache) { NiceMock lifecycle_notifier; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); Config::DataSource::RemoteAsyncDataProviderPtr remote_data_provider; - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "vm_cache"; auto plugin_configuration = "done"; @@ -738,7 +738,7 @@ TEST_P(WasmCommonTest, RemoteCode) { Init::ExpectableWatcherImpl init_watcher; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); Config::DataSource::RemoteAsyncDataProviderPtr remote_data_provider; - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "vm_cache"; auto plugin_configuration = "done"; @@ -852,7 +852,7 @@ TEST_P(WasmCommonTest, RemoteCodeMultipleRetry) { Init::ExpectableWatcherImpl init_watcher; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); Config::DataSource::RemoteAsyncDataProviderPtr remote_data_provider; - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "vm_cache"; auto plugin_configuration = "done"; @@ -970,7 +970,7 @@ TEST_P(WasmCommonTest, RestrictCapabilities) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "restrict_all"; @@ -1024,7 +1024,7 @@ TEST_P(WasmCommonTest, AllowOnVmStart) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "allow_on_vm_start"; @@ -1080,7 +1080,7 @@ TEST_P(WasmCommonTest, AllowLog) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "allow_log"; @@ -1133,7 +1133,7 @@ TEST_P(WasmCommonTest, AllowWASI) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "allow_wasi"; @@ -1186,7 +1186,7 @@ TEST_P(WasmCommonTest, AllowOnContextCreate) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "allow_on_context_create"; @@ -1241,7 +1241,7 @@ TEST_P(WasmCommonTest, ThreadLocalCopyRetainsEnforcement) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); + Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); NiceMock local_info; auto vm_configuration = "thread_local_copy"; diff --git a/test/extensions/common/wasm/wasm_vm_test.cc b/test/extensions/common/wasm/wasm_vm_test.cc index dd4b7412af3cc..38cd5227c24ef 100644 --- a/test/extensions/common/wasm/wasm_vm_test.cc +++ b/test/extensions/common/wasm/wasm_vm_test.cc @@ -42,7 +42,7 @@ proxy_wasm::RegisterNullVmPluginFactory register_test_null_vm_plugin("test_null_ class BaseVmTest : public testing::Test { public: - BaseVmTest() : scope_(Stats::ScopeSharedPtr(stats_store.createScope("wasm."))) {} + BaseVmTest() : scope_(stats_store.createScope("wasm.")) {} protected: Stats::IsolatedStoreImpl stats_store; @@ -118,7 +118,7 @@ double badPong3(double) { return 3; } class WasmVmTest : public testing::TestWithParam { public: - WasmVmTest() : scope_(Stats::ScopeSharedPtr(stats_store.createScope("wasm."))) {} + WasmVmTest() : scope_(stats_store.createScope("wasm.")) {} void SetUp() override { // NOLINT(readability-identifier-naming) g_host_functions = new MockHostFunctions(); diff --git a/test/extensions/filters/network/common/redis/client_impl_test.cc b/test/extensions/filters/network/common/redis/client_impl_test.cc index 8096c08cc7f03..399c4f105cdc0 100644 --- a/test/extensions/filters/network/common/redis/client_impl_test.cc +++ b/test/extensions/filters/network/common/redis/client_impl_test.cc @@ -140,7 +140,7 @@ class RedisClientImplTest : public testing::Test, std::unique_ptr config_; ClientPtr client_; NiceMock stats_; - Stats::ScopePtr stats_scope_; + Stats::ScopeSharedPtr stats_scope_; Common::Redis::RedisCommandStatsSharedPtr redis_command_stats_; std::string auth_username_; std::string auth_password_; diff --git a/test/integration/clusters/custom_static_cluster.h b/test/integration/clusters/custom_static_cluster.h index 6daeb9220eda4..ef39b5b19da14 100644 --- a/test/integration/clusters/custom_static_cluster.h +++ b/test/integration/clusters/custom_static_cluster.h @@ -26,7 +26,7 @@ class CustomStaticCluster : public Upstream::ClusterImplBase { public: CustomStaticCluster(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api, uint32_t priority, + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, uint32_t priority, std::string address, uint32_t port) : ClusterImplBase(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), @@ -63,7 +63,7 @@ class CustomStaticClusterFactoryBase : public Upstream::ConfigurableClusterFacto const test::integration::clusters::CustomStaticConfig& proto_config, Upstream::ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override { + Stats::ScopeSharedPtr&& stats_scope) override { auto new_cluster = std::make_shared( cluster, context.runtime(), socket_factory_context, std::move(stats_scope), context.addedViaApi(), proto_config.priority(), proto_config.address(), diff --git a/test/integration/fake_upstream.h b/test/integration/fake_upstream.h index 5935c918ad9f9..ea221d2899b02 100644 --- a/test/integration/fake_upstream.h +++ b/test/integration/fake_upstream.h @@ -857,7 +857,7 @@ class FakeUpstream : Logger::Loggable, FakeListener listener_; const Network::FilterChainSharedPtr filter_chain_; std::list received_datagrams_ ABSL_GUARDED_BY(lock_); - Stats::ScopePtr stats_scope_; + Stats::ScopeSharedPtr stats_scope_; Http::Http1::CodecStats::AtomicPtr http1_codec_stats_; Http::Http2::CodecStats::AtomicPtr http2_codec_stats_; Http::Http3::CodecStats::AtomicPtr http3_codec_stats_; diff --git a/test/integration/server.h b/test/integration/server.h index 6c228624a3206..e94295248a91c 100644 --- a/test/integration/server.h +++ b/test/integration/server.h @@ -70,17 +70,17 @@ namespace Stats { */ class TestScopeWrapper : public Scope { public: - TestScopeWrapper(Thread::MutexBasicLockable& lock, ScopePtr wrapped_scope) + TestScopeWrapper(Thread::MutexBasicLockable& lock, ScopeSharedPtr wrapped_scope) : lock_(lock), wrapped_scope_(std::move(wrapped_scope)) {} - ScopePtr createScope(const std::string& name) override { + ScopeSharedPtr createScope(const std::string& name) override { Thread::LockGuard lock(lock_); - return ScopePtr{new TestScopeWrapper(lock_, wrapped_scope_->createScope(name))}; + return ScopeSharedPtr{new TestScopeWrapper(lock_, wrapped_scope_->createScope(name))}; } - ScopePtr scopeFromStatName(StatName name) override { + ScopeSharedPtr scopeFromStatName(StatName name) override { Thread::LockGuard lock(lock_); - return ScopePtr{new TestScopeWrapper(lock_, wrapped_scope_->scopeFromStatName(name))}; + return ScopeSharedPtr{new TestScopeWrapper(lock_, wrapped_scope_->scopeFromStatName(name))}; } void deliverHistogramToSinks(const Histogram& histogram, uint64_t value) override { @@ -167,7 +167,7 @@ class TestScopeWrapper : public Scope { private: Thread::MutexBasicLockable& lock_; - ScopePtr wrapped_scope_; + ScopeSharedPtr wrapped_scope_; }; // A counter which signals on a condition variable when it is incremented. @@ -324,13 +324,13 @@ class TestIsolatedStoreImpl : public StoreRoot { Thread::LockGuard lock(lock_); return store_.counterFromString(name); } - ScopePtr createScope(const std::string& name) override { + ScopeSharedPtr createScope(const std::string& name) override { Thread::LockGuard lock(lock_); - return ScopePtr{new TestScopeWrapper(lock_, store_.createScope(name))}; + return ScopeSharedPtr{new TestScopeWrapper(lock_, store_.createScope(name))}; } - ScopePtr scopeFromStatName(StatName name) override { + ScopeSharedPtr scopeFromStatName(StatName name) override { Thread::LockGuard lock(lock_); - return ScopePtr{new TestScopeWrapper(lock_, store_.scopeFromStatName(name))}; + return ScopeSharedPtr{new TestScopeWrapper(lock_, store_.scopeFromStatName(name))}; } void deliverHistogramToSinks(const Histogram&, uint64_t) override {} Gauge& gaugeFromStatNameWithTags(const StatName& name, StatNameTagVectorOptConstRef tags, diff --git a/test/mocks/server/admin.h b/test/mocks/server/admin.h index 6d9b150edc4d1..15a6ee26780ea 100644 --- a/test/mocks/server/admin.h +++ b/test/mocks/server/admin.h @@ -32,7 +32,7 @@ class MockAdmin : public Admin { const std::string& address_out_path, Network::Address::InstanceConstSharedPtr address, const Network::Socket::OptionsSharedPtr& socket_options, - Stats::ScopePtr&& listener_scope)); + Stats::ScopeSharedPtr&& listener_scope)); MOCK_METHOD(Http::Code, request, (absl::string_view path_and_query, absl::string_view method, Http::ResponseHeaderMap& response_headers, std::string& body)); diff --git a/test/mocks/stats/mocks.h b/test/mocks/stats/mocks.h index 42837995662a5..9b4b5928eb4ac 100644 --- a/test/mocks/stats/mocks.h +++ b/test/mocks/stats/mocks.h @@ -278,8 +278,10 @@ class MockStore : public TestUtil::TestStore { MockStore(); ~MockStore() override; - ScopePtr createScope(const std::string& name) override { return ScopePtr{createScope_(name)}; } - ScopePtr scopeFromStatName(StatName name) override { + ScopeSharedPtr createScope(const std::string& name) override { + return ScopeSharedPtr(createScope_(name)); + } + ScopeSharedPtr scopeFromStatName(StatName name) override { return createScope(symbolTable().toString(name)); } diff --git a/test/mocks/upstream/cluster_info.h b/test/mocks/upstream/cluster_info.h index afd3f405c57d3..b30f3ec786f4f 100644 --- a/test/mocks/upstream/cluster_info.h +++ b/test/mocks/upstream/cluster_info.h @@ -207,7 +207,7 @@ class MockClusterInfo : public ClusterInfo { envoy::config::core::v3::Metadata metadata_; std::unique_ptr typed_metadata_; absl::optional max_stream_duration_; - Stats::ScopePtr stats_scope_; + Stats::ScopeSharedPtr stats_scope_; mutable Http::Http1::CodecStats::AtomicPtr http1_codec_stats_; mutable Http::Http2::CodecStats::AtomicPtr http2_codec_stats_; mutable Http::Http3::CodecStats::AtomicPtr http3_codec_stats_; diff --git a/test/test_common/wasm_base.h b/test/test_common/wasm_base.h index 5e3394bf5559c..65f057cce54b5 100644 --- a/test/test_common/wasm_base.h +++ b/test/test_common/wasm_base.h @@ -59,7 +59,7 @@ template class WasmTestBase : public Base { void setupBase(const std::string& runtime, const std::string& code, CreateContextFn create_root) { Api::ApiPtr api = Api::createApiForTest(stats_store_); - scope_ = Stats::ScopeSharedPtr(stats_store_.createScope("wasm.")); + scope_ = stats_store_.createScope("wasm."); envoy::extensions::wasm::v3::PluginConfig plugin_config; *plugin_config.mutable_root_id() = root_id_; From ac71e6d3798cb3baed3329d5ddb96ad0197e8add Mon Sep 17 00:00:00 2001 From: Joshua Marantz Date: Fri, 18 Feb 2022 12:52:05 -0500 Subject: [PATCH 2/7] back out half the changes to try to narrow down where the apple failure is coming from Signed-off-by: Joshua Marantz --- source/server/listener_impl.h | 4 +- source/server/listener_manager_impl.h | 2 +- source/server/server.h | 2 +- .../grpc/async_client_manager_impl_test.cc | 1 - test/common/stats/utility_fuzz_test.cc | 2 +- .../upstream/cluster_factory_impl_test.cc | 2 +- test/common/upstream/eds_speed_test.cc | 2 +- test/common/upstream/eds_test.cc | 2 +- test/common/upstream/hds_test.cc | 4 +- test/common/upstream/leds_test.cc | 2 +- .../upstream/logical_dns_cluster_test.cc | 2 +- .../upstream/original_dst_cluster_test.cc | 2 +- test/common/upstream/subset_lb_test.cc | 2 +- .../upstream/transport_socket_matcher_test.cc | 2 +- test/common/upstream/upstream_impl_test.cc | 78 +++++++++---------- .../bootstrap/wasm/wasm_speed_test.cc | 2 +- .../clusters/aggregate/cluster_test.cc | 2 +- .../dynamic_forward_proxy/cluster_test.cc | 2 +- .../clusters/redis/redis_cluster_test.cc | 4 +- .../extensions/common/wasm/wasm_speed_test.cc | 2 +- test/extensions/common/wasm/wasm_test.cc | 40 +++++----- test/extensions/common/wasm/wasm_vm_test.cc | 4 +- .../network/common/redis/client_impl_test.cc | 2 +- .../clusters/custom_static_cluster.h | 4 +- test/integration/fake_upstream.h | 2 +- test/mocks/server/admin.h | 2 +- test/mocks/upstream/cluster_info.h | 2 +- test/test_common/wasm_base.h | 2 +- 28 files changed, 89 insertions(+), 90 deletions(-) diff --git a/source/server/listener_impl.h b/source/server/listener_impl.h index cd858d6aaeebe..da83dc5ff6878 100644 --- a/source/server/listener_impl.h +++ b/source/server/listener_impl.h @@ -156,8 +156,8 @@ class ListenerFactoryContextBaseImpl final : public Configuration::FactoryContex const Envoy::Config::TypedMetadataImpl typed_metadata_; envoy::config::core::v3::TrafficDirection direction_; - Stats::ScopeSharedPtr global_scope_; - Stats::ScopeSharedPtr listener_scope_; // Stats with listener named scope. + Stats::ScopePtr global_scope_; + Stats::ScopePtr listener_scope_; // Stats with listener named scope. ProtobufMessage::ValidationVisitor& validation_visitor_; const Server::DrainManagerPtr drain_manager_; bool is_quic_; diff --git a/source/server/listener_manager_impl.h b/source/server/listener_manager_impl.h index e6d93f80074cc..5711a988bd0ed 100644 --- a/source/server/listener_manager_impl.h +++ b/source/server/listener_manager_impl.h @@ -318,7 +318,7 @@ class ListenerManagerImpl : public ListenerManager, Logger::Loggable workers_; bool workers_started_{}; absl::optional stop_listeners_type_; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; ListenerManagerStats stats_; ConfigTracker::EntryOwnerPtr config_tracker_entry_; LdsApiPtr lds_api_; diff --git a/source/server/server.h b/source/server/server.h index eada46f57435e..29f4944f74d41 100644 --- a/source/server/server.h +++ b/source/server/server.h @@ -216,7 +216,7 @@ class ServerFactoryContextImpl : public Configuration::ServerFactoryContext, private: Instance& server_; - Stats::ScopeSharedPtr server_scope_; + Stats::ScopePtr server_scope_; }; /** diff --git a/test/common/grpc/async_client_manager_impl_test.cc b/test/common/grpc/async_client_manager_impl_test.cc index 3112d3ec28ccd..c3ffb0d795724 100644 --- a/test/common/grpc/async_client_manager_impl_test.cc +++ b/test/common/grpc/async_client_manager_impl_test.cc @@ -178,7 +178,6 @@ TEST_F(AsyncClientManagerImplTest, EnvoyGrpcInvalid) { } TEST_F(AsyncClientManagerImplTest, GoogleGrpc) { - ; EXPECT_CALL(scope_, createScope_("grpc.foo.")); envoy::config::core::v3::GrpcService grpc_service; grpc_service.mutable_google_grpc()->set_stat_prefix("foo"); diff --git a/test/common/stats/utility_fuzz_test.cc b/test/common/stats/utility_fuzz_test.cc index 8a0e698385ecd..7c302624c740b 100644 --- a/test/common/stats/utility_fuzz_test.cc +++ b/test/common/stats/utility_fuzz_test.cc @@ -44,7 +44,7 @@ DEFINE_FUZZER(const uint8_t* buf, size_t len) { std::unique_ptr store = std::make_unique(symbol_table); Stats::StatNamePool pool(symbol_table); - Stats::ScopeSharedPtr scope = store->createScope(provider.ConsumeRandomLengthString(max_len)); + Stats::ScopePtr scope = store->createScope(provider.ConsumeRandomLengthString(max_len)); Stats::ElementVec ele_vec; Stats::StatNameVec sn_vec; Stats::StatNameTagVector tags; diff --git a/test/common/upstream/cluster_factory_impl_test.cc b/test/common/upstream/cluster_factory_impl_test.cc index 8f63415707a66..8ae0c5cad5f5c 100644 --- a/test/common/upstream/cluster_factory_impl_test.cc +++ b/test/common/upstream/cluster_factory_impl_test.cc @@ -43,7 +43,7 @@ class TestStaticClusterFactory : public Event::TestUsingSimulatedTime, std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override { + Stats::ScopePtr&& stats_scope) override { return std::make_pair(std::make_shared( cluster, context.runtime(), socket_factory_context, std::move(stats_scope), context.addedViaApi(), 1, "127.0.0.1", 80), diff --git a/test/common/upstream/eds_speed_test.cc b/test/common/upstream/eds_speed_test.cc index ba6e9bdb3ce9f..c3d6a43e27ef9 100644 --- a/test/common/upstream/eds_speed_test.cc +++ b/test/common/upstream/eds_speed_test.cc @@ -81,7 +81,7 @@ class EdsSpeedTest { void resetCluster(const std::string& yaml_config, Cluster::InitializePhase initialize_phase) { local_info_.node_.mutable_locality()->set_zone("us-east-1a"); eds_cluster_ = parseClusterFromV3Yaml(yaml_config); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", eds_cluster_.alt_stat_name().empty() ? eds_cluster_.name() : eds_cluster_.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/eds_test.cc b/test/common/upstream/eds_test.cc index 3e4d94b126e32..c57da0bb13e12 100644 --- a/test/common/upstream/eds_test.cc +++ b/test/common/upstream/eds_test.cc @@ -121,7 +121,7 @@ class EdsTest : public testing::Test { void resetCluster(const std::string& yaml_config, Cluster::InitializePhase initialize_phase) { local_info_.node_.mutable_locality()->set_zone("us-east-1a"); eds_cluster_ = parseClusterFromV3Yaml(yaml_config); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", eds_cluster_.alt_stat_name().empty() ? eds_cluster_.name() : eds_cluster_.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/hds_test.cc b/test/common/upstream/hds_test.cc index b7c6d6b26b8a4..23da61c810cb6 100644 --- a/test/common/upstream/hds_test.cc +++ b/test/common/upstream/hds_test.cc @@ -578,7 +578,7 @@ TEST_F(HdsTest, TestSocketContext) { EXPECT_CALL(test_factory_, createClusterInfo(_)) .WillRepeatedly(Invoke([&](const ClusterInfoFactory::CreateClusterInfoParams& params) { // Build scope, factory_context as does ProdClusterInfoFactory. - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( params.admin_, params.ssl_context_manager_, *scope, params.cm_, params.local_info_, @@ -1030,7 +1030,7 @@ TEST_F(HdsTest, TestUpdateSocketContext) { EXPECT_CALL(test_factory_, createClusterInfo(_)) .WillRepeatedly(Invoke([&](const ClusterInfoFactory::CreateClusterInfoParams& params) { // Build scope, factory_context as does ProdClusterInfoFactory. - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( params.admin_, params.ssl_context_manager_, *scope, params.cm_, params.local_info_, diff --git a/test/common/upstream/leds_test.cc b/test/common/upstream/leds_test.cc index a0dcdc671137f..300c6c20ad8cd 100644 --- a/test/common/upstream/leds_test.cc +++ b/test/common/upstream/leds_test.cc @@ -156,7 +156,7 @@ class LedsTest : public testing::Test { Ssl::MockContextManager ssl_context_manager_; NiceMock cm_; NiceMock dispatcher_; - Envoy::Stats::ScopeSharedPtr cluster_scope_; + Envoy::Stats::ScopePtr cluster_scope_; LedsSubscriptionPtr leds_subscription_; NiceMock random_; NiceMock runtime_; diff --git a/test/common/upstream/logical_dns_cluster_test.cc b/test/common/upstream/logical_dns_cluster_test.cc index 8135cad9954bf..9afdd78e71c92 100644 --- a/test/common/upstream/logical_dns_cluster_test.cc +++ b/test/common/upstream/logical_dns_cluster_test.cc @@ -48,7 +48,7 @@ class LogicalDnsClusterTest : public Event::TestUsingSimulatedTime, public testi resolve_timer_ = new Event::MockTimer(&dispatcher_); NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/original_dst_cluster_test.cc b/test/common/upstream/original_dst_cluster_test.cc index 369f4c19d01d2..6fc86b2e056a8 100644 --- a/test/common/upstream/original_dst_cluster_test.cc +++ b/test/common/upstream/original_dst_cluster_test.cc @@ -75,7 +75,7 @@ class OriginalDstClusterTest : public Event::TestUsingSimulatedTime, public test void setup(const envoy::config::cluster::v3::Cluster& cluster_config) { NiceMock cm; - Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/subset_lb_test.cc b/test/common/upstream/subset_lb_test.cc index b925294c25394..133d15cacba90 100644 --- a/test/common/upstream/subset_lb_test.cc +++ b/test/common/upstream/subset_lb_test.cc @@ -481,7 +481,7 @@ class SubsetLoadBalancerTest : public Event::TestUsingSimulatedTime, NiceMock runtime_; NiceMock random_; Stats::IsolatedStoreImpl stats_store_; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; ClusterStatNames stat_names_; ClusterStats stats_; PrioritySetImpl local_priority_set_; diff --git a/test/common/upstream/transport_socket_matcher_test.cc b/test/common/upstream/transport_socket_matcher_test.cc index 88d200f4e1404..4a3f8af0690c9 100644 --- a/test/common/upstream/transport_socket_matcher_test.cc +++ b/test/common/upstream/transport_socket_matcher_test.cc @@ -107,7 +107,7 @@ class TransportSocketMatcherTest : public testing::Test { NiceMock mock_factory_context_; Network::TransportSocketFactoryPtr mock_default_factory_; Stats::IsolatedStoreImpl stats_store_; - Stats::ScopeSharedPtr stats_scope_; + Stats::ScopePtr stats_scope_; }; TEST_F(TransportSocketMatcherTest, ReturnDefaultSocketFactoryWhenNoMatch) { diff --git a/test/common/upstream/upstream_impl_test.cc b/test/common/upstream/upstream_impl_test.cc index f66ce7daa6b97..a52916f4ef471 100644 --- a/test/common/upstream/upstream_impl_test.cc +++ b/test/common/upstream/upstream_impl_test.cc @@ -190,7 +190,7 @@ TEST_P(StrictDnsParamTest, ImmediateResolve) { return nullptr; })); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -224,7 +224,7 @@ TEST_F(StrictDnsClusterImplTest, ZeroHostsIsInializedImmediately) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -259,7 +259,7 @@ TEST_F(StrictDnsClusterImplTest, ZeroHostsHealthChecker) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -305,7 +305,7 @@ TEST_F(StrictDnsClusterImplTest, DontWaitForDNSOnInit) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -380,7 +380,7 @@ TEST_F(StrictDnsClusterImplTest, Basic) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -536,7 +536,7 @@ TEST_F(StrictDnsClusterImplTest, HostRemovalActiveHealthSkipped) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -597,7 +597,7 @@ TEST_F(StrictDnsClusterImplTest, HostRemovalAfterHcFail) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -724,7 +724,7 @@ TEST_F(StrictDnsClusterImplTest, LoadAssignmentBasic) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -962,7 +962,7 @@ TEST_F(StrictDnsClusterImplTest, LoadAssignmentBasicMultiplePriorities) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1078,7 +1078,7 @@ TEST_F(StrictDnsClusterImplTest, CustomResolverFails) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -1113,7 +1113,7 @@ TEST_F(StrictDnsClusterImplTest, FailureRefreshRateBackoffResetsWhenSuccessHappe )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1162,7 +1162,7 @@ TEST_F(StrictDnsClusterImplTest, TtlAsDnsRefreshRate) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1242,7 +1242,7 @@ TEST_F(StrictDnsClusterImplTest, Http2UserDefinedSettingsParametersValidation) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1470,7 +1470,7 @@ TEST_F(StaticClusterImplTest, InitialHosts) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1505,7 +1505,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentEmptyHostname) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1540,7 +1540,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentNonEmptyHostname) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1575,7 +1575,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentNonEmptyHostnameWithHealthChecks) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1628,7 +1628,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentMultiplePriorities) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1673,7 +1673,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentLocality) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1719,7 +1719,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentEdsHealth) { NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1751,7 +1751,7 @@ TEST_F(StaticClusterImplTest, AltStatName) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1781,7 +1781,7 @@ TEST_F(StaticClusterImplTest, RingHash) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1819,7 +1819,7 @@ TEST_F(StaticClusterImplTest, RoundRobinWithSlowStart) { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1861,7 +1861,7 @@ TEST_F(StaticClusterImplTest, LeastRequestWithSlowStart) { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1901,7 +1901,7 @@ TEST_F(StaticClusterImplTest, OutlierDetector) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1959,7 +1959,7 @@ TEST_F(StaticClusterImplTest, HealthyStat) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2100,7 +2100,7 @@ TEST_F(StaticClusterImplTest, UrlConfig) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2152,7 +2152,7 @@ TEST_F(StaticClusterImplTest, UnsupportedLBType) { EXPECT_THROW_WITH_REGEX( { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); @@ -2195,7 +2195,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2240,7 +2240,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithOtherLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2283,7 +2283,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithoutLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2313,7 +2313,7 @@ TEST_F(StaticClusterImplTest, MalformedHostIP) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2341,7 +2341,7 @@ TEST_F(StaticClusterImplTest, NoHostsTest) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2360,7 +2360,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { { // If the cluster manager gets a source address from the bootstrap proto, use it. cm_.bind_config_.mutable_source_address()->set_address("1.2.3.5"); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2373,7 +2373,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { config.mutable_upstream_bind_config()->mutable_source_address()->set_address(cluster_address); { // Verify source address from cluster config is used when present. - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2385,7 +2385,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { { // The source address from cluster config takes precedence over one from the bootstrap proto. cm_.bind_config_.mutable_source_address()->set_address("1.2.3.5"); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2409,7 +2409,7 @@ TEST_F(StaticClusterImplTest, LedsUnsupported) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2445,7 +2445,7 @@ TEST_F(ClusterImplTest, CloseConnectionsOnHostHealthFailure) { port_value: 443 )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2683,7 +2683,7 @@ class ClusterInfoImplTest : public testing::Test { NiceMock tls_; ReadyWatcher initialized_; envoy::config::cluster::v3::Cluster cluster_config_; - Envoy::Stats::ScopeSharedPtr scope_; + Envoy::Stats::ScopePtr scope_; std::unique_ptr factory_context_; NiceMock validation_visitor_; Api::ApiPtr api_; diff --git a/test/extensions/bootstrap/wasm/wasm_speed_test.cc b/test/extensions/bootstrap/wasm/wasm_speed_test.cc index 16ed10b24d053..aaadd74ba6e21 100644 --- a/test/extensions/bootstrap/wasm/wasm_speed_test.cc +++ b/test/extensions/bootstrap/wasm/wasm_speed_test.cc @@ -46,7 +46,7 @@ static void bmWasmSimpleCallSpeedTest(benchmark::State& state, std::string test, Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; envoy::extensions::wasm::v3::PluginConfig plugin_config; diff --git a/test/extensions/clusters/aggregate/cluster_test.cc b/test/extensions/clusters/aggregate/cluster_test.cc index 36e2bddcf2bc3..97f2ecb6983de 100644 --- a/test/extensions/clusters/aggregate/cluster_test.cc +++ b/test/extensions/clusters/aggregate/cluster_test.cc @@ -96,7 +96,7 @@ class AggregateClusterTest : public Event::TestUsingSimulatedTime, public testin envoy::extensions::clusters::aggregate::v3::ClusterConfig config; Config::Utility::translateOpaqueConfig(cluster_config.cluster_type().typed_config(), ProtobufMessage::getStrictValidationVisitor(), config); - Stats::ScopeSharedPtr scope = stats_store_.createScope("cluster.name."); + Stats::ScopePtr scope = stats_store_.createScope("cluster.name."); Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_store_, singleton_manager_, tls_, validation_visitor_, *api_, options_); diff --git a/test/extensions/clusters/dynamic_forward_proxy/cluster_test.cc b/test/extensions/clusters/dynamic_forward_proxy/cluster_test.cc index c334f0b14b748..2b8b46bc0673c 100644 --- a/test/extensions/clusters/dynamic_forward_proxy/cluster_test.cc +++ b/test/extensions/clusters/dynamic_forward_proxy/cluster_test.cc @@ -40,7 +40,7 @@ class ClusterTest : public testing::Test, envoy::extensions::clusters::dynamic_forward_proxy::v3::ClusterConfig config; Config::Utility::translateOpaqueConfig(cluster_config.cluster_type().typed_config(), ProtobufMessage::getStrictValidationVisitor(), config); - Stats::ScopeSharedPtr scope = stats_store_.createScope("cluster.name."); + Stats::ScopePtr scope = stats_store_.createScope("cluster.name."); Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_store_, singleton_manager_, tls_, validation_visitor_, *api_, options_); diff --git a/test/extensions/clusters/redis/redis_cluster_test.cc b/test/extensions/clusters/redis/redis_cluster_test.cc index daa32f803f756..8c1fc3cc9f352 100644 --- a/test/extensions/clusters/redis/redis_cluster_test.cc +++ b/test/extensions/clusters/redis/redis_cluster_test.cc @@ -99,7 +99,7 @@ class RedisClusterTest : public testing::Test, expectRedisSessionCreated(); NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = Upstream::parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -128,7 +128,7 @@ class RedisClusterTest : public testing::Test, void setupFactoryFromV3Yaml(const std::string& yaml) { NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = Upstream::parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/extensions/common/wasm/wasm_speed_test.cc b/test/extensions/common/wasm/wasm_speed_test.cc index 20123bf881ed3..f2e9371267e04 100644 --- a/test/extensions/common/wasm/wasm_speed_test.cc +++ b/test/extensions/common/wasm/wasm_speed_test.cc @@ -28,7 +28,7 @@ void bmWasmSpeedTest(benchmark::State& state) { Envoy::Api::ApiPtr api = Envoy::Api::createApiForTest(stats_store); Envoy::Upstream::MockClusterManager cluster_manager; Envoy::Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Envoy::Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Envoy::Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); proxy_wasm::AllowedCapabilitiesMap allowed_capabilities; envoy::extensions::wasm::v3::PluginConfig plugin_config; diff --git a/test/extensions/common/wasm/wasm_test.cc b/test/extensions/common/wasm/wasm_test.cc index 8d4091340d9dd..ff7398083d9eb 100644 --- a/test/extensions/common/wasm/wasm_test.cc +++ b/test/extensions/common/wasm/wasm_test.cc @@ -97,7 +97,7 @@ TEST_P(WasmCommonTest, WasmFailState) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; envoy::extensions::wasm::v3::PluginConfig plugin_config; @@ -161,7 +161,7 @@ TEST_P(WasmCommonTest, Logging) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "logging"; auto plugin_configuration = "configure-test"; @@ -242,7 +242,7 @@ TEST_P(WasmCommonTest, BadSignature) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; const auto code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( "{{ test_rundir }}/test/extensions/common/wasm/test_data/bad_signature_cpp.wasm")); @@ -270,7 +270,7 @@ TEST_P(WasmCommonTest, Segv) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "segv"; const auto code = TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( @@ -313,7 +313,7 @@ TEST_P(WasmCommonTest, DivByZero) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "divbyzero"; @@ -348,7 +348,7 @@ TEST_P(WasmCommonTest, IntrinsicGlobals) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "globals"; @@ -390,7 +390,7 @@ TEST_P(WasmCommonTest, Utilities) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "utilities"; @@ -459,7 +459,7 @@ TEST_P(WasmCommonTest, Stats) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "stats"; @@ -506,7 +506,7 @@ TEST_P(WasmCommonTest, Foreign) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "foreign"; @@ -546,7 +546,7 @@ TEST_P(WasmCommonTest, OnForeign) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "on_foreign"; @@ -594,7 +594,7 @@ TEST_P(WasmCommonTest, WASI) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "WASI"; @@ -638,7 +638,7 @@ TEST_P(WasmCommonTest, VmCache) { NiceMock lifecycle_notifier; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); Config::DataSource::RemoteAsyncDataProviderPtr remote_data_provider; - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "vm_cache"; auto plugin_configuration = "done"; @@ -738,7 +738,7 @@ TEST_P(WasmCommonTest, RemoteCode) { Init::ExpectableWatcherImpl init_watcher; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); Config::DataSource::RemoteAsyncDataProviderPtr remote_data_provider; - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "vm_cache"; auto plugin_configuration = "done"; @@ -852,7 +852,7 @@ TEST_P(WasmCommonTest, RemoteCodeMultipleRetry) { Init::ExpectableWatcherImpl init_watcher; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); Config::DataSource::RemoteAsyncDataProviderPtr remote_data_provider; - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "vm_cache"; auto plugin_configuration = "done"; @@ -970,7 +970,7 @@ TEST_P(WasmCommonTest, RestrictCapabilities) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "restrict_all"; @@ -1024,7 +1024,7 @@ TEST_P(WasmCommonTest, AllowOnVmStart) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "allow_on_vm_start"; @@ -1080,7 +1080,7 @@ TEST_P(WasmCommonTest, AllowLog) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "allow_log"; @@ -1133,7 +1133,7 @@ TEST_P(WasmCommonTest, AllowWASI) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "allow_wasi"; @@ -1186,7 +1186,7 @@ TEST_P(WasmCommonTest, AllowOnContextCreate) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "allow_on_context_create"; @@ -1241,7 +1241,7 @@ TEST_P(WasmCommonTest, ThreadLocalCopyRetainsEnforcement) { Api::ApiPtr api = Api::createApiForTest(stats_store); Upstream::MockClusterManager cluster_manager; Event::DispatcherPtr dispatcher(api->allocateDispatcher("wasm_test")); - Stats::ScopeSharedPtr scope = stats_store.createScope("wasm."); + auto scope = Stats::ScopeSharedPtr(stats_store.createScope("wasm.")); NiceMock local_info; auto vm_configuration = "thread_local_copy"; diff --git a/test/extensions/common/wasm/wasm_vm_test.cc b/test/extensions/common/wasm/wasm_vm_test.cc index 38cd5227c24ef..dd4b7412af3cc 100644 --- a/test/extensions/common/wasm/wasm_vm_test.cc +++ b/test/extensions/common/wasm/wasm_vm_test.cc @@ -42,7 +42,7 @@ proxy_wasm::RegisterNullVmPluginFactory register_test_null_vm_plugin("test_null_ class BaseVmTest : public testing::Test { public: - BaseVmTest() : scope_(stats_store.createScope("wasm.")) {} + BaseVmTest() : scope_(Stats::ScopeSharedPtr(stats_store.createScope("wasm."))) {} protected: Stats::IsolatedStoreImpl stats_store; @@ -118,7 +118,7 @@ double badPong3(double) { return 3; } class WasmVmTest : public testing::TestWithParam { public: - WasmVmTest() : scope_(stats_store.createScope("wasm.")) {} + WasmVmTest() : scope_(Stats::ScopeSharedPtr(stats_store.createScope("wasm."))) {} void SetUp() override { // NOLINT(readability-identifier-naming) g_host_functions = new MockHostFunctions(); diff --git a/test/extensions/filters/network/common/redis/client_impl_test.cc b/test/extensions/filters/network/common/redis/client_impl_test.cc index 399c4f105cdc0..8096c08cc7f03 100644 --- a/test/extensions/filters/network/common/redis/client_impl_test.cc +++ b/test/extensions/filters/network/common/redis/client_impl_test.cc @@ -140,7 +140,7 @@ class RedisClientImplTest : public testing::Test, std::unique_ptr config_; ClientPtr client_; NiceMock stats_; - Stats::ScopeSharedPtr stats_scope_; + Stats::ScopePtr stats_scope_; Common::Redis::RedisCommandStatsSharedPtr redis_command_stats_; std::string auth_username_; std::string auth_password_; diff --git a/test/integration/clusters/custom_static_cluster.h b/test/integration/clusters/custom_static_cluster.h index ef39b5b19da14..6daeb9220eda4 100644 --- a/test/integration/clusters/custom_static_cluster.h +++ b/test/integration/clusters/custom_static_cluster.h @@ -26,7 +26,7 @@ class CustomStaticCluster : public Upstream::ClusterImplBase { public: CustomStaticCluster(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, uint32_t priority, + Stats::ScopePtr&& stats_scope, bool added_via_api, uint32_t priority, std::string address, uint32_t port) : ClusterImplBase(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), @@ -63,7 +63,7 @@ class CustomStaticClusterFactoryBase : public Upstream::ConfigurableClusterFacto const test::integration::clusters::CustomStaticConfig& proto_config, Upstream::ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override { + Stats::ScopePtr&& stats_scope) override { auto new_cluster = std::make_shared( cluster, context.runtime(), socket_factory_context, std::move(stats_scope), context.addedViaApi(), proto_config.priority(), proto_config.address(), diff --git a/test/integration/fake_upstream.h b/test/integration/fake_upstream.h index 46d513574f5be..82aa2d4f575d0 100644 --- a/test/integration/fake_upstream.h +++ b/test/integration/fake_upstream.h @@ -859,7 +859,7 @@ class FakeUpstream : Logger::Loggable, FakeListener listener_; const Network::FilterChainSharedPtr filter_chain_; std::list received_datagrams_ ABSL_GUARDED_BY(lock_); - Stats::ScopeSharedPtr stats_scope_; + Stats::ScopePtr stats_scope_; Http::Http1::CodecStats::AtomicPtr http1_codec_stats_; Http::Http2::CodecStats::AtomicPtr http2_codec_stats_; Http::Http3::CodecStats::AtomicPtr http3_codec_stats_; diff --git a/test/mocks/server/admin.h b/test/mocks/server/admin.h index fddf26e560ee4..451b36bfbe0c6 100644 --- a/test/mocks/server/admin.h +++ b/test/mocks/server/admin.h @@ -35,7 +35,7 @@ class MockAdmin : public Admin { const std::string& address_out_path, Network::Address::InstanceConstSharedPtr address, const Network::Socket::OptionsSharedPtr& socket_options, - Stats::ScopeSharedPtr&& listener_scope)); + Stats::ScopePtr&& listener_scope)); MOCK_METHOD(Http::Code, request, (absl::string_view path_and_query, absl::string_view method, Http::ResponseHeaderMap& response_headers, std::string& body)); diff --git a/test/mocks/upstream/cluster_info.h b/test/mocks/upstream/cluster_info.h index b30f3ec786f4f..afd3f405c57d3 100644 --- a/test/mocks/upstream/cluster_info.h +++ b/test/mocks/upstream/cluster_info.h @@ -207,7 +207,7 @@ class MockClusterInfo : public ClusterInfo { envoy::config::core::v3::Metadata metadata_; std::unique_ptr typed_metadata_; absl::optional max_stream_duration_; - Stats::ScopeSharedPtr stats_scope_; + Stats::ScopePtr stats_scope_; mutable Http::Http1::CodecStats::AtomicPtr http1_codec_stats_; mutable Http::Http2::CodecStats::AtomicPtr http2_codec_stats_; mutable Http::Http3::CodecStats::AtomicPtr http3_codec_stats_; diff --git a/test/test_common/wasm_base.h b/test/test_common/wasm_base.h index 65f057cce54b5..5e3394bf5559c 100644 --- a/test/test_common/wasm_base.h +++ b/test/test_common/wasm_base.h @@ -59,7 +59,7 @@ template class WasmTestBase : public Base { void setupBase(const std::string& runtime, const std::string& code, CreateContextFn create_root) { Api::ApiPtr api = Api::createApiForTest(stats_store_); - scope_ = stats_store_.createScope("wasm."); + scope_ = Stats::ScopeSharedPtr(stats_store_.createScope("wasm.")); envoy::extensions::wasm::v3::PluginConfig plugin_config; *plugin_config.mutable_root_id() = root_id_; From 90af3cd33d153d1bf350b81f075c2e808e94ad50 Mon Sep 17 00:00:00 2001 From: Joshua Marantz Date: Fri, 18 Feb 2022 20:22:29 -0500 Subject: [PATCH 3/7] back out another quarter of the changes. Signed-off-by: Joshua Marantz --- source/common/upstream/strict_dns_cluster.cc | 4 ++-- source/common/upstream/strict_dns_cluster.h | 4 ++-- source/common/upstream/upstream_impl.cc | 6 +++--- source/common/upstream/upstream_impl.h | 6 +++--- source/extensions/clusters/aggregate/cluster.cc | 4 ++-- source/extensions/clusters/aggregate/cluster.h | 4 ++-- source/extensions/clusters/dynamic_forward_proxy/cluster.cc | 4 ++-- source/extensions/clusters/dynamic_forward_proxy/cluster.h | 4 ++-- source/extensions/clusters/redis/redis_cluster.cc | 4 ++-- source/extensions/clusters/redis/redis_cluster.h | 4 ++-- .../common/dynamic_forward_proxy/dns_cache_impl.h | 2 +- source/extensions/filters/network/redis_proxy/config.cc | 2 +- .../filters/network/redis_proxy/conn_pool_impl.cc | 2 +- .../extensions/filters/network/redis_proxy/conn_pool_impl.h | 2 +- .../extensions/network/dns_resolver/apple/apple_dns_impl.h | 2 +- source/server/admin/admin.cc | 2 +- source/server/admin/admin.h | 6 +++--- source/server/api_listener_impl.h | 4 ++-- source/server/config_validation/admin.cc | 2 +- source/server/config_validation/admin.h | 2 +- source/server/filter_chain_manager_impl.h | 4 ++-- source/server/lds_api.h | 2 +- 22 files changed, 38 insertions(+), 38 deletions(-) diff --git a/source/common/upstream/strict_dns_cluster.cc b/source/common/upstream/strict_dns_cluster.cc index 2c26424ff6e73..d641c31e781d9 100644 --- a/source/common/upstream/strict_dns_cluster.cc +++ b/source/common/upstream/strict_dns_cluster.cc @@ -12,7 +12,7 @@ StrictDnsClusterImpl::StrictDnsClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) + Stats::ScopePtr&& stats_scope, bool added_via_api) : BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), load_assignment_(cluster.load_assignment()), local_info_(factory_context.localInfo()), @@ -198,7 +198,7 @@ std::pair StrictDnsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) { + Stats::ScopePtr&& stats_scope) { auto selected_dns_resolver = selectDnsResolver(cluster, context); return std::make_pair(std::make_shared( diff --git a/source/common/upstream/strict_dns_cluster.h b/source/common/upstream/strict_dns_cluster.h index d04fb5e833180..70c3040414524 100644 --- a/source/common/upstream/strict_dns_cluster.h +++ b/source/common/upstream/strict_dns_cluster.h @@ -18,7 +18,7 @@ class StrictDnsClusterImpl : public BaseDynamicClusterImpl { StrictDnsClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -83,7 +83,7 @@ class StrictDnsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/upstream_impl.cc b/source/common/upstream/upstream_impl.cc index d68fd829cf53f..d35d436c4a509 100644 --- a/source/common/upstream/upstream_impl.cc +++ b/source/common/upstream/upstream_impl.cc @@ -783,8 +783,8 @@ createOptions(const envoy::config::cluster::v3::Cluster& config, ClusterInfoImpl::ClusterInfoImpl( const envoy::config::cluster::v3::Cluster& config, const envoy::config::core::v3::BindConfig& bind_config, Runtime::Loader& runtime, - TransportSocketMatcherPtr&& socket_matcher, Stats::ScopeSharedPtr&& stats_scope, - bool added_via_api, Server::Configuration::TransportSocketFactoryContext& factory_context) + TransportSocketMatcherPtr&& socket_matcher, Stats::ScopePtr&& stats_scope, bool added_via_api, + Server::Configuration::TransportSocketFactoryContext& factory_context) : runtime_(runtime), name_(config.name()), observability_name_(PROTOBUF_GET_STRING_OR_DEFAULT(config, alt_stat_name, name_)), type_(config.type()), @@ -1050,7 +1050,7 @@ ClusterInfoImpl::upstreamHttpProtocol(absl::optional downstream_ ClusterImplBase::ClusterImplBase( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, TimeSource& time_source) + Stats::ScopePtr&& stats_scope, bool added_via_api, TimeSource& time_source) : init_manager_(fmt::format("Cluster {}", cluster.name())), init_watcher_("ClusterImplBase", [this]() { onInitDone(); }), runtime_(runtime), wait_for_warm_on_init_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(cluster, wait_for_warm_on_init, true)), diff --git a/source/common/upstream/upstream_impl.h b/source/common/upstream/upstream_impl.h index 802483a615e8f..f54559954d7bc 100644 --- a/source/common/upstream/upstream_impl.h +++ b/source/common/upstream/upstream_impl.h @@ -598,7 +598,7 @@ class ClusterInfoImpl : public ClusterInfo, Envoy::Extensions::Upstreams::Http::ProtocolOptionsConfigImpl; ClusterInfoImpl(const envoy::config::cluster::v3::Cluster& config, const envoy::config::core::v3::BindConfig& bind_config, Runtime::Loader& runtime, - TransportSocketMatcherPtr&& socket_matcher, Stats::ScopeSharedPtr&& stats_scope, + TransportSocketMatcherPtr&& socket_matcher, Stats::ScopePtr&& stats_scope, bool added_via_api, Server::Configuration::TransportSocketFactoryContext&); static ClusterStats generateStats(Stats::Scope& scope, @@ -793,7 +793,7 @@ class ClusterInfoImpl : public ClusterInfo, const float peekahead_ratio_; const uint32_t per_connection_buffer_limit_bytes_; TransportSocketMatcherPtr socket_matcher_; - Stats::ScopeSharedPtr stats_scope_; + Stats::ScopePtr stats_scope_; mutable ClusterStats stats_; Stats::IsolatedStoreImpl load_report_stats_store_; mutable ClusterLoadReportStats load_report_stats_; @@ -905,7 +905,7 @@ class ClusterImplBase : public Cluster, protected Logger::Loggable(cluster, proto_config, context.clusterManager(), context.runtime(), context.api().randomGenerator(), socket_factory_context, diff --git a/source/extensions/clusters/aggregate/cluster.h b/source/extensions/clusters/aggregate/cluster.h index 592a4ae34b7cd..6d961fd2e0f36 100644 --- a/source/extensions/clusters/aggregate/cluster.h +++ b/source/extensions/clusters/aggregate/cluster.h @@ -44,7 +44,7 @@ class Cluster : public Upstream::ClusterImplBase { Upstream::ClusterManager& cluster_manager, Runtime::Loader& runtime, Random::RandomGenerator& random, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); // Upstream::Cluster Upstream::Cluster::InitializePhase initializePhase() const override { @@ -174,7 +174,7 @@ class ClusterFactory : public Upstream::ConfigurableClusterFactoryBase< const envoy::extensions::clusters::aggregate::v3::ClusterConfig& proto_config, Upstream::ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; DECLARE_FACTORY(ClusterFactory); diff --git a/source/extensions/clusters/dynamic_forward_proxy/cluster.cc b/source/extensions/clusters/dynamic_forward_proxy/cluster.cc index 6d3cfde175c20..b00a2d3399583 100644 --- a/source/extensions/clusters/dynamic_forward_proxy/cluster.cc +++ b/source/extensions/clusters/dynamic_forward_proxy/cluster.cc @@ -24,7 +24,7 @@ Cluster::Cluster( Extensions::Common::DynamicForwardProxy::DnsCacheManagerFactory& cache_manager_factory, const LocalInfo::LocalInfo& local_info, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) + Stats::ScopePtr&& stats_scope, bool added_via_api) : Upstream::BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), @@ -248,7 +248,7 @@ ClusterFactory::createClusterWithConfig( const envoy::extensions::clusters::dynamic_forward_proxy::v3::ClusterConfig& proto_config, Upstream::ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) { + Stats::ScopePtr&& stats_scope) { Extensions::Common::DynamicForwardProxy::DnsCacheManagerFactoryImpl cache_manager_factory( context); envoy::config::cluster::v3::Cluster cluster_config = cluster; diff --git a/source/extensions/clusters/dynamic_forward_proxy/cluster.h b/source/extensions/clusters/dynamic_forward_proxy/cluster.h index c634d854c0f50..bea82bdd93ba0 100644 --- a/source/extensions/clusters/dynamic_forward_proxy/cluster.h +++ b/source/extensions/clusters/dynamic_forward_proxy/cluster.h @@ -24,7 +24,7 @@ class Cluster : public Upstream::BaseDynamicClusterImpl, Extensions::Common::DynamicForwardProxy::DnsCacheManagerFactory& cache_manager_factory, const LocalInfo::LocalInfo& local_info, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); // Upstream::Cluster Upstream::Cluster::InitializePhase initializePhase() const override { @@ -167,7 +167,7 @@ class ClusterFactory : public Upstream::ConfigurableClusterFactoryBase< const envoy::extensions::clusters::dynamic_forward_proxy::v3::ClusterConfig& proto_config, Upstream::ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; DECLARE_FACTORY(ClusterFactory); diff --git a/source/extensions/clusters/redis/redis_cluster.cc b/source/extensions/clusters/redis/redis_cluster.cc index 567a94ef049ee..9a64b58050a08 100644 --- a/source/extensions/clusters/redis/redis_cluster.cc +++ b/source/extensions/clusters/redis/redis_cluster.cc @@ -22,7 +22,7 @@ RedisCluster::RedisCluster( Upstream::ClusterManager& cluster_manager, Runtime::Loader& runtime, Api::Api& api, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, + Stats::ScopePtr&& stats_scope, bool added_via_api, ClusterSlotUpdateCallBackSharedPtr lb_factory) : Upstream::BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, @@ -401,7 +401,7 @@ RedisClusterFactory::createClusterWithConfig( const envoy::extensions::clusters::redis::v3::RedisClusterConfig& proto_config, Upstream::ClusterFactoryContext& context, Envoy::Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Envoy::Stats::ScopeSharedPtr&& stats_scope) { + Envoy::Stats::ScopePtr&& stats_scope) { if (!cluster.has_cluster_type() || cluster.cluster_type().name() != "envoy.clusters.redis") { throw EnvoyException("Redis cluster can only created with redis cluster type."); } diff --git a/source/extensions/clusters/redis/redis_cluster.h b/source/extensions/clusters/redis/redis_cluster.h index 125ab9ecf0f76..ae8553b2effa9 100644 --- a/source/extensions/clusters/redis/redis_cluster.h +++ b/source/extensions/clusters/redis/redis_cluster.h @@ -96,7 +96,7 @@ class RedisCluster : public Upstream::BaseDynamicClusterImpl { Upstream::ClusterManager& cluster_manager, Runtime::Loader& runtime, Api::Api& api, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, + Stats::ScopePtr&& stats_scope, bool added_via_api, ClusterSlotUpdateCallBackSharedPtr factory); struct ClusterSlotsRequest : public Extensions::NetworkFilters::Common::Redis::RespValue { @@ -298,7 +298,7 @@ class RedisClusterFactory : public Upstream::ConfigurableClusterFactoryBase< const envoy::extensions::clusters::redis::v3::RedisClusterConfig& proto_config, Upstream::ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; } // namespace Redis } // namespace Clusters diff --git a/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h b/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h index 0f08facaffbaf..a0534ac18e78a 100644 --- a/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h +++ b/source/extensions/common/dynamic_forward_proxy/dns_cache_impl.h @@ -226,7 +226,7 @@ class DnsCacheImpl : public DnsCache, Logger::Loggable tls_slot_; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; DnsCacheStats stats_; std::list update_callbacks_; absl::Mutex primary_hosts_lock_; diff --git a/source/extensions/filters/network/redis_proxy/config.cc b/source/extensions/filters/network/redis_proxy/config.cc index 17c3fbd3fc91f..bdef53f8fbcb6 100644 --- a/source/extensions/filters/network/redis_proxy/config.cc +++ b/source/extensions/filters/network/redis_proxy/config.cc @@ -63,7 +63,7 @@ Network::FilterFactoryCb RedisProxyFilterConfigFactory::createFilterFactoryFromP Upstreams upstreams; for (auto& cluster : unique_clusters) { - Stats::ScopeSharedPtr stats_scope = + Stats::ScopePtr stats_scope = context.scope().createScope(fmt::format("cluster.{}.redis_cluster", cluster)); auto conn_pool_ptr = std::make_shared( cluster, context.clusterManager(), Common::Redis::Client::ClientFactoryImpl::instance_, diff --git a/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc b/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc index 7bf4ab750cfef..56a06c67e0753 100644 --- a/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc +++ b/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc @@ -40,7 +40,7 @@ InstanceImpl::InstanceImpl( Common::Redis::Client::ClientFactory& client_factory, ThreadLocal::SlotAllocator& tls, const envoy::extensions::filters::network::redis_proxy::v3::RedisProxy::ConnPoolSettings& config, - Api::Api& api, Stats::ScopeSharedPtr&& stats_scope, + Api::Api& api, Stats::ScopePtr&& stats_scope, const Common::Redis::RedisCommandStatsSharedPtr& redis_command_stats, Extensions::Common::Redis::ClusterRefreshManagerSharedPtr refresh_manager) : cluster_name_(cluster_name), cm_(cm), client_factory_(client_factory), diff --git a/source/extensions/filters/network/redis_proxy/conn_pool_impl.h b/source/extensions/filters/network/redis_proxy/conn_pool_impl.h index 7988fb77e86f0..76373d33fe9c6 100644 --- a/source/extensions/filters/network/redis_proxy/conn_pool_impl.h +++ b/source/extensions/filters/network/redis_proxy/conn_pool_impl.h @@ -59,7 +59,7 @@ class InstanceImpl : public Instance, public std::enable_shared_from_this& const std::string& address_out_path, Network::Address::InstanceConstSharedPtr address, const Network::Socket::OptionsSharedPtr& socket_options, - Stats::ScopeSharedPtr&& listener_scope) { + Stats::ScopePtr&& listener_scope) { for (const auto& access_log : access_logs) { access_logs_.emplace_back(access_log); } diff --git a/source/server/admin/admin.h b/source/server/admin/admin.h index 0eccd8c349212..15f1e8f5f1b18 100644 --- a/source/server/admin/admin.h +++ b/source/server/admin/admin.h @@ -93,7 +93,7 @@ class AdminImpl : public Admin, const std::string& address_out_path, Network::Address::InstanceConstSharedPtr address, const Network::Socket::OptionsSharedPtr& socket_options, - Stats::ScopeSharedPtr&& listener_scope) override; + Stats::ScopePtr&& listener_scope) override; uint32_t concurrency() const override { return server_.options().concurrency(); } // Network::FilterChainManager @@ -370,7 +370,7 @@ class AdminImpl : public Admin, class AdminListener : public Network::ListenerConfig { public: - AdminListener(AdminImpl& parent, Stats::ScopeSharedPtr&& listener_scope) + AdminListener(AdminImpl& parent, Stats::ScopePtr&& listener_scope) : parent_(parent), name_("admin"), scope_(std::move(listener_scope)), stats_(Http::ConnectionManagerImpl::generateListenerStats("http.admin.", *scope_)), init_manager_(nullptr), ignore_global_conn_limit_(parent.ignore_global_conn_limit_) {} @@ -409,7 +409,7 @@ class AdminImpl : public Admin, AdminImpl& parent_; const std::string name_; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; Http::ConnectionManagerListenerStats stats_; Network::NopConnectionBalancerImpl connection_balancer_; BasicResourceLimitImpl open_connections_; diff --git a/source/server/api_listener_impl.h b/source/server/api_listener_impl.h index d96c8b4422680..0cf13c6f16749 100644 --- a/source/server/api_listener_impl.h +++ b/source/server/api_listener_impl.h @@ -180,8 +180,8 @@ class ApiListenerImplBase : public ApiListener, ListenerManagerImpl& parent_; const std::string name_; Network::Address::InstanceConstSharedPtr address_; - Stats::ScopeSharedPtr global_scope_; - Stats::ScopeSharedPtr listener_scope_; + Stats::ScopePtr global_scope_; + Stats::ScopePtr listener_scope_; FactoryContextImpl factory_context_; SyntheticReadCallbacks read_callbacks_; }; diff --git a/source/server/config_validation/admin.cc b/source/server/config_validation/admin.cc index 7d8de4ee819b8..981ba4eab1da8 100644 --- a/source/server/config_validation/admin.cc +++ b/source/server/config_validation/admin.cc @@ -22,7 +22,7 @@ void ValidationAdmin::startHttpListener(const std::list is_draining_{false}; }; diff --git a/source/server/lds_api.h b/source/server/lds_api.h index 72d441b80164a..05a4db0a29f56 100644 --- a/source/server/lds_api.h +++ b/source/server/lds_api.h @@ -47,7 +47,7 @@ class LdsApiImpl : public LdsApi, Config::SubscriptionPtr subscription_; std::string system_version_info_; ListenerManager& listener_manager_; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; Upstream::ClusterManager& cm_; Init::TargetImpl init_target_; }; From 36e0e95f8a5dcfabf2e0657e66f8c8b977bc200f Mon Sep 17 00:00:00 2001 From: Joshua Marantz Date: Sun, 20 Feb 2022 14:43:55 -0500 Subject: [PATCH 4/7] total revert to see if this passes CI. Signed-off-by: Joshua Marantz --- contrib/sip_proxy/filters/network/source/config.cc | 2 +- envoy/server/admin.h | 2 +- source/common/filter/config_discovery_impl.h | 2 +- source/common/router/config_impl.h | 8 ++++---- source/common/router/scoped_rds.h | 2 +- source/common/router/vhds.h | 2 +- source/common/runtime/runtime_impl.h | 2 +- source/common/secret/sds_api.h | 2 +- source/common/tcp_proxy/tcp_proxy.h | 2 +- source/common/upstream/cds_api_impl.h | 2 +- source/common/upstream/cluster_factory_impl.cc | 4 ++-- source/common/upstream/cluster_factory_impl.h | 6 +++--- source/common/upstream/eds.cc | 4 ++-- source/common/upstream/eds.h | 4 ++-- source/common/upstream/health_discovery_service.cc | 2 +- source/common/upstream/leds.h | 2 +- source/common/upstream/logical_dns_cluster.cc | 4 ++-- source/common/upstream/logical_dns_cluster.h | 4 ++-- source/common/upstream/maglev_lb.h | 2 +- source/common/upstream/original_dst_cluster.cc | 4 ++-- source/common/upstream/original_dst_cluster.h | 4 ++-- source/common/upstream/ring_hash_lb.h | 2 +- source/common/upstream/static_cluster.cc | 4 ++-- source/common/upstream/static_cluster.h | 4 ++-- 24 files changed, 38 insertions(+), 38 deletions(-) diff --git a/contrib/sip_proxy/filters/network/source/config.cc b/contrib/sip_proxy/filters/network/source/config.cc index 4b22a9c596eb0..dace041c2fcef 100644 --- a/contrib/sip_proxy/filters/network/source/config.cc +++ b/contrib/sip_proxy/filters/network/source/config.cc @@ -61,7 +61,7 @@ Network::FilterFactoryCb SipProxyFilterConfigFactory::createFilterFactoryFromPro */ auto transaction_infos = std::make_shared(); for (auto& cluster : unique_clusters) { - Stats::ScopeSharedPtr stats_scope = + Stats::ScopePtr stats_scope = context.scope().createScope(fmt::format("cluster.{}.sip_cluster", cluster)); auto transaction_info_ptr = std::make_shared( cluster, context.threadLocal(), diff --git a/envoy/server/admin.h b/envoy/server/admin.h index adf19e72af278..a3f21b29d3503 100644 --- a/envoy/server/admin.h +++ b/envoy/server/admin.h @@ -180,7 +180,7 @@ class Admin { const std::string& address_out_path, Network::Address::InstanceConstSharedPtr address, const Network::Socket::OptionsSharedPtr& socket_options, - Stats::ScopeSharedPtr&& listener_scope) PURE; + Stats::ScopePtr&& listener_scope) PURE; /** * Executes an admin request with the specified query params. Note: this must diff --git a/source/common/filter/config_discovery_impl.h b/source/common/filter/config_discovery_impl.h index f4b8c2d58035a..c07ab14a94fce 100644 --- a/source/common/filter/config_discovery_impl.h +++ b/source/common/filter/config_discovery_impl.h @@ -229,7 +229,7 @@ class FilterConfigSubscription Init::SharedTargetImpl init_target_; bool started_{false}; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; const std::string stat_prefix_; ExtensionConfigDiscoveryStats stats_; diff --git a/source/common/router/config_impl.h b/source/common/router/config_impl.h index 8c54e3ae8b937..56ee4d3c5b430 100644 --- a/source/common/router/config_impl.h +++ b/source/common/router/config_impl.h @@ -237,7 +237,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable struct VirtualClusterBase : public VirtualCluster { public: VirtualClusterBase(const absl::optional& name, Stats::StatName stat_name, - Stats::ScopeSharedPtr&& scope, const VirtualClusterStatNames& stat_names) + Stats::ScopePtr&& scope, const VirtualClusterStatNames& stat_names) : name_(name), stat_name_(stat_name), scope_(std::move(scope)), stats_(generateStats(*scope_, stat_names)) {} @@ -251,7 +251,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable private: const absl::optional name_; const Stats::StatName stat_name_; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; mutable VirtualClusterStats stats_; }; @@ -270,7 +270,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable static const std::shared_ptr SSL_REDIRECT_ROUTE; const Stats::StatNameManagedStorage stat_name_storage_; - Stats::ScopeSharedPtr vcluster_scope_; + Stats::ScopePtr vcluster_scope_; std::vector routes_; std::vector virtual_clusters_; SslRequirements ssl_requirements_; @@ -1156,7 +1156,7 @@ class RouteMatcher { const WildcardVirtualHosts& wildcard_virtual_hosts, SubstringFunction substring_function) const; - Stats::ScopeSharedPtr vhost_scope_; + Stats::ScopePtr vhost_scope_; absl::node_hash_map virtual_hosts_; // std::greater as a minor optimization to iterate from more to less specific // diff --git a/source/common/router/scoped_rds.h b/source/common/router/scoped_rds.h index 44c5990e76522..decd0d88a9282 100644 --- a/source/common/router/scoped_rds.h +++ b/source/common/router/scoped_rds.h @@ -227,7 +227,7 @@ class ScopedRdsConfigSubscription Server::Configuration::ServerFactoryContext& factory_context_; const std::string name_; // Stats must outlive subscription. - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; ScopedRdsStats stats_; Envoy::Config::SubscriptionPtr subscription_; const envoy::extensions::filters::network::http_connection_manager::v3::ScopedRoutes:: diff --git a/source/common/router/vhds.h b/source/common/router/vhds.h index 919afea87fbe4..41071ae4ee287 100644 --- a/source/common/router/vhds.h +++ b/source/common/router/vhds.h @@ -67,7 +67,7 @@ class VhdsSubscription : Envoy::Config::SubscriptionBase idle_timeout_; diff --git a/source/common/upstream/cds_api_impl.h b/source/common/upstream/cds_api_impl.h index b38c6686c40aa..63ca584eb06db 100644 --- a/source/common/upstream/cds_api_impl.h +++ b/source/common/upstream/cds_api_impl.h @@ -53,7 +53,7 @@ class CdsApiImpl : public CdsApi, CdsApiHelper helper_; ClusterManager& cm_; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; Config::SubscriptionPtr subscription_; std::function initialize_callback_; }; diff --git a/source/common/upstream/cluster_factory_impl.cc b/source/common/upstream/cluster_factory_impl.cc index 5a00af25c009a..b38f9cff04a08 100644 --- a/source/common/upstream/cluster_factory_impl.cc +++ b/source/common/upstream/cluster_factory_impl.cc @@ -16,8 +16,8 @@ namespace Upstream { namespace { -Stats::ScopeSharedPtr generateStatsScope(const envoy::config::cluster::v3::Cluster& config, - Stats::Store& stats) { +Stats::ScopePtr generateStatsScope(const envoy::config::cluster::v3::Cluster& config, + Stats::Store& stats) { return stats.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); } diff --git a/source/common/upstream/cluster_factory_impl.h b/source/common/upstream/cluster_factory_impl.h index 50a0cfdb4c341..1ff81b8503285 100644 --- a/source/common/upstream/cluster_factory_impl.h +++ b/source/common/upstream/cluster_factory_impl.h @@ -150,7 +150,7 @@ class ClusterFactoryImplBase : public ClusterFactory { virtual std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) PURE; + Stats::ScopePtr&& stats_scope) PURE; const std::string name_; }; @@ -174,7 +174,7 @@ template class ConfigurableClusterFactoryBase : public Clust std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override { + Stats::ScopePtr&& stats_scope) override { ProtobufTypes::MessagePtr config = createEmptyConfigProto(); Config::Utility::translateOpaqueConfig(cluster.cluster_type().typed_config(), socket_factory_context.messageValidationVisitor(), @@ -189,7 +189,7 @@ template class ConfigurableClusterFactoryBase : public Clust const envoy::config::cluster::v3::Cluster& cluster, const ConfigProto& proto_config, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) PURE; + Stats::ScopePtr&& stats_scope) PURE; }; } // namespace Upstream diff --git a/source/common/upstream/eds.cc b/source/common/upstream/eds.cc index 50e9d256c0888..3e6788d565df7 100644 --- a/source/common/upstream/eds.cc +++ b/source/common/upstream/eds.cc @@ -16,7 +16,7 @@ namespace Upstream { EdsClusterImpl::EdsClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) + Stats::ScopePtr&& stats_scope, bool added_via_api) : BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), Envoy::Config::SubscriptionBase( @@ -378,7 +378,7 @@ std::pair EdsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) { + Stats::ScopePtr&& stats_scope) { if (!cluster.has_eds_cluster_config()) { throw EnvoyException("cannot create an EDS cluster without an EDS config"); } diff --git a/source/common/upstream/eds.h b/source/common/upstream/eds.h index 4d25a888f0b06..476e783a32a58 100644 --- a/source/common/upstream/eds.h +++ b/source/common/upstream/eds.h @@ -32,7 +32,7 @@ class EdsClusterImpl public: EdsClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return initialize_phase_; } @@ -115,7 +115,7 @@ class EdsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/health_discovery_service.cc b/source/common/upstream/health_discovery_service.cc index 3e59df12f0eee..7bac0901a01ac 100644 --- a/source/common/upstream/health_discovery_service.cc +++ b/source/common/upstream/health_discovery_service.cc @@ -520,7 +520,7 @@ ClusterSharedPtr HdsCluster::create() { return nullptr; } ClusterInfoConstSharedPtr ProdClusterInfoFactory::createClusterInfo(const CreateClusterInfoParams& params) { - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/source/common/upstream/leds.h b/source/common/upstream/leds.h index d3893f5da184e..a58f31baa0f4d 100644 --- a/source/common/upstream/leds.h +++ b/source/common/upstream/leds.h @@ -65,7 +65,7 @@ class LedsSubscription const LocalInfo::LocalInfo& local_info_; const std::string cluster_name_; // LEDS stats scope must outlive the subscription. - Stats::ScopeSharedPtr stats_scope_; + Stats::ScopePtr stats_scope_; LedsStats stats_; // A map between a LEDS resource name to the LbEndpoint data. LbEndpointsMap endpoints_map_; diff --git a/source/common/upstream/logical_dns_cluster.cc b/source/common/upstream/logical_dns_cluster.cc index 54290881a3fe3..6e34bbb8fab91 100644 --- a/source/common/upstream/logical_dns_cluster.cc +++ b/source/common/upstream/logical_dns_cluster.cc @@ -48,7 +48,7 @@ LogicalDnsCluster::LogicalDnsCluster( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) + Stats::ScopePtr&& stats_scope, bool added_via_api) : ClusterImplBase(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), dns_resolver_(dns_resolver), @@ -182,7 +182,7 @@ std::pair LogicalDnsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) { + Stats::ScopePtr&& stats_scope) { auto selected_dns_resolver = selectDnsResolver(cluster, context); return std::make_pair(std::make_shared( diff --git a/source/common/upstream/logical_dns_cluster.h b/source/common/upstream/logical_dns_cluster.h index e30942df7e720..233244d03bbdf 100644 --- a/source/common/upstream/logical_dns_cluster.h +++ b/source/common/upstream/logical_dns_cluster.h @@ -36,7 +36,7 @@ class LogicalDnsCluster : public ClusterImplBase { LogicalDnsCluster(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); ~LogicalDnsCluster() override; @@ -85,7 +85,7 @@ class LogicalDnsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; DECLARE_FACTORY(LogicalDnsClusterFactory); diff --git a/source/common/upstream/maglev_lb.h b/source/common/upstream/maglev_lb.h index 0d1c6fc5f71e1..d2c4ed58109bd 100644 --- a/source/common/upstream/maglev_lb.h +++ b/source/common/upstream/maglev_lb.h @@ -99,7 +99,7 @@ class MaglevLoadBalancer : public ThreadAwareLoadBalancerBase, static MaglevLoadBalancerStats generateStats(Stats::Scope& scope); - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; MaglevLoadBalancerStats stats_; const uint64_t table_size_; const bool use_hostname_for_hashing_; diff --git a/source/common/upstream/original_dst_cluster.cc b/source/common/upstream/original_dst_cluster.cc index c60e977cd1524..00561a544a165 100644 --- a/source/common/upstream/original_dst_cluster.cc +++ b/source/common/upstream/original_dst_cluster.cc @@ -108,7 +108,7 @@ OriginalDstCluster::LoadBalancer::requestOverrideHost(LoadBalancerContext* conte OriginalDstCluster::OriginalDstCluster( const envoy::config::cluster::v3::Cluster& config, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) + Stats::ScopePtr&& stats_scope, bool added_via_api) : ClusterImplBase(config, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), dispatcher_(factory_context.mainThreadDispatcher()), @@ -182,7 +182,7 @@ std::pair OriginalDstClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) { + Stats::ScopePtr&& stats_scope) { if (cluster.lb_policy() != envoy::config::cluster::v3::Cluster::CLUSTER_PROVIDED) { throw EnvoyException( fmt::format("cluster: LB policy {} is not valid for Cluster type {}. Only " diff --git a/source/common/upstream/original_dst_cluster.h b/source/common/upstream/original_dst_cluster.h index a9cd8741c4d30..589991eb612f7 100644 --- a/source/common/upstream/original_dst_cluster.h +++ b/source/common/upstream/original_dst_cluster.h @@ -31,7 +31,7 @@ class OriginalDstCluster : public ClusterImplBase { public: OriginalDstCluster(const envoy::config::cluster::v3::Cluster& config, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -135,7 +135,7 @@ class OriginalDstClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/ring_hash_lb.h b/source/common/upstream/ring_hash_lb.h index aa861eb9fb92c..3369a7ba635a1 100644 --- a/source/common/upstream/ring_hash_lb.h +++ b/source/common/upstream/ring_hash_lb.h @@ -87,7 +87,7 @@ class RingHashLoadBalancer : public ThreadAwareLoadBalancerBase, static RingHashLoadBalancerStats generateStats(Stats::Scope& scope); - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; RingHashLoadBalancerStats stats_; static const uint64_t DefaultMinRingSize = 1024; diff --git a/source/common/upstream/static_cluster.cc b/source/common/upstream/static_cluster.cc index 4fdd3f9f7df34..b1656fe2ee698 100644 --- a/source/common/upstream/static_cluster.cc +++ b/source/common/upstream/static_cluster.cc @@ -10,7 +10,7 @@ namespace Upstream { StaticClusterImpl::StaticClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) + Stats::ScopePtr&& stats_scope, bool added_via_api) : ClusterImplBase(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), priority_state_manager_( @@ -65,7 +65,7 @@ std::pair StaticClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) { + Stats::ScopePtr&& stats_scope) { return std::make_pair( std::make_shared(cluster, context.runtime(), socket_factory_context, std::move(stats_scope), context.addedViaApi()), diff --git a/source/common/upstream/static_cluster.h b/source/common/upstream/static_cluster.h index 9ad812505aa5f..a6c710ac6aec6 100644 --- a/source/common/upstream/static_cluster.h +++ b/source/common/upstream/static_cluster.h @@ -16,7 +16,7 @@ class StaticClusterImpl : public ClusterImplBase { public: StaticClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -40,7 +40,7 @@ class StaticClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; DECLARE_FACTORY(StaticClusterFactory); From 97df8eefff15be6d216028b58a367cd0fb626018 Mon Sep 17 00:00:00 2001 From: Joshua Marantz Date: Sun, 20 Feb 2022 19:49:06 -0500 Subject: [PATCH 5/7] just to tthe rename under source/common/... Signed-off-by: Joshua Marantz --- source/common/filter/config_discovery_impl.h | 2 +- .../rds/rds_route_config_subscription.h | 2 +- source/common/router/config_impl.h | 8 +- source/common/router/scoped_rds.h | 2 +- source/common/router/vhds.h | 2 +- source/common/runtime/runtime_impl.h | 2 +- source/common/secret/sds_api.h | 2 +- source/common/tcp_proxy/tcp_proxy.h | 2 +- source/common/upstream/cds_api_impl.h | 2 +- .../common/upstream/cluster_factory_impl.cc | 4 +- source/common/upstream/cluster_factory_impl.h | 6 +- source/common/upstream/eds.cc | 4 +- source/common/upstream/eds.h | 4 +- .../upstream/health_discovery_service.cc | 2 +- source/common/upstream/leds.h | 2 +- source/common/upstream/logical_dns_cluster.cc | 4 +- source/common/upstream/logical_dns_cluster.h | 4 +- source/common/upstream/maglev_lb.h | 2 +- source/common/upstream/od_cds_api_impl.h | 2 +- .../common/upstream/original_dst_cluster.cc | 4 +- source/common/upstream/original_dst_cluster.h | 4 +- source/common/upstream/ring_hash_lb.h | 2 +- source/common/upstream/static_cluster.cc | 4 +- source/common/upstream/static_cluster.h | 4 +- source/common/upstream/strict_dns_cluster.cc | 4 +- source/common/upstream/strict_dns_cluster.h | 4 +- source/common/upstream/upstream_impl.cc | 6 +- source/common/upstream/upstream_impl.h | 6 +- test/common/stats/utility_fuzz_test.cc | 2 +- .../upstream/cluster_factory_impl_test.cc | 2 +- test/common/upstream/eds_speed_test.cc | 2 +- test/common/upstream/eds_test.cc | 2 +- test/common/upstream/hds_test.cc | 4 +- test/common/upstream/leds_test.cc | 2 +- .../upstream/logical_dns_cluster_test.cc | 2 +- .../upstream/original_dst_cluster_test.cc | 2 +- test/common/upstream/subset_lb_test.cc | 2 +- .../upstream/transport_socket_matcher_test.cc | 2 +- test/common/upstream/upstream_impl_test.cc | 78 +++++++++---------- 39 files changed, 98 insertions(+), 98 deletions(-) diff --git a/source/common/filter/config_discovery_impl.h b/source/common/filter/config_discovery_impl.h index c07ab14a94fce..f4b8c2d58035a 100644 --- a/source/common/filter/config_discovery_impl.h +++ b/source/common/filter/config_discovery_impl.h @@ -229,7 +229,7 @@ class FilterConfigSubscription Init::SharedTargetImpl init_target_; bool started_{false}; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; const std::string stat_prefix_; ExtensionConfigDiscoveryStats stats_; diff --git a/source/common/rds/rds_route_config_subscription.h b/source/common/rds/rds_route_config_subscription.h index d1753d105a783..98d5e9418f984 100644 --- a/source/common/rds/rds_route_config_subscription.h +++ b/source/common/rds/rds_route_config_subscription.h @@ -80,7 +80,7 @@ class RdsRouteConfigSubscription : Envoy::Config::SubscriptionCallbacks, protected: const std::string route_config_name_; // This scope must outlive the subscription_ below as the subscription has derived stats. - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; Envoy::Config::SubscriptionPtr subscription_; Server::Configuration::ServerFactoryContext& factory_context_; diff --git a/source/common/router/config_impl.h b/source/common/router/config_impl.h index 56ee4d3c5b430..8c54e3ae8b937 100644 --- a/source/common/router/config_impl.h +++ b/source/common/router/config_impl.h @@ -237,7 +237,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable struct VirtualClusterBase : public VirtualCluster { public: VirtualClusterBase(const absl::optional& name, Stats::StatName stat_name, - Stats::ScopePtr&& scope, const VirtualClusterStatNames& stat_names) + Stats::ScopeSharedPtr&& scope, const VirtualClusterStatNames& stat_names) : name_(name), stat_name_(stat_name), scope_(std::move(scope)), stats_(generateStats(*scope_, stat_names)) {} @@ -251,7 +251,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable private: const absl::optional name_; const Stats::StatName stat_name_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; mutable VirtualClusterStats stats_; }; @@ -270,7 +270,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable static const std::shared_ptr SSL_REDIRECT_ROUTE; const Stats::StatNameManagedStorage stat_name_storage_; - Stats::ScopePtr vcluster_scope_; + Stats::ScopeSharedPtr vcluster_scope_; std::vector routes_; std::vector virtual_clusters_; SslRequirements ssl_requirements_; @@ -1156,7 +1156,7 @@ class RouteMatcher { const WildcardVirtualHosts& wildcard_virtual_hosts, SubstringFunction substring_function) const; - Stats::ScopePtr vhost_scope_; + Stats::ScopeSharedPtr vhost_scope_; absl::node_hash_map virtual_hosts_; // std::greater as a minor optimization to iterate from more to less specific // diff --git a/source/common/router/scoped_rds.h b/source/common/router/scoped_rds.h index decd0d88a9282..44c5990e76522 100644 --- a/source/common/router/scoped_rds.h +++ b/source/common/router/scoped_rds.h @@ -227,7 +227,7 @@ class ScopedRdsConfigSubscription Server::Configuration::ServerFactoryContext& factory_context_; const std::string name_; // Stats must outlive subscription. - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; ScopedRdsStats stats_; Envoy::Config::SubscriptionPtr subscription_; const envoy::extensions::filters::network::http_connection_manager::v3::ScopedRoutes:: diff --git a/source/common/router/vhds.h b/source/common/router/vhds.h index 41071ae4ee287..919afea87fbe4 100644 --- a/source/common/router/vhds.h +++ b/source/common/router/vhds.h @@ -67,7 +67,7 @@ class VhdsSubscription : Envoy::Config::SubscriptionBase idle_timeout_; diff --git a/source/common/upstream/cds_api_impl.h b/source/common/upstream/cds_api_impl.h index 63ca584eb06db..b38c6686c40aa 100644 --- a/source/common/upstream/cds_api_impl.h +++ b/source/common/upstream/cds_api_impl.h @@ -53,7 +53,7 @@ class CdsApiImpl : public CdsApi, CdsApiHelper helper_; ClusterManager& cm_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; Config::SubscriptionPtr subscription_; std::function initialize_callback_; }; diff --git a/source/common/upstream/cluster_factory_impl.cc b/source/common/upstream/cluster_factory_impl.cc index b38f9cff04a08..5a00af25c009a 100644 --- a/source/common/upstream/cluster_factory_impl.cc +++ b/source/common/upstream/cluster_factory_impl.cc @@ -16,8 +16,8 @@ namespace Upstream { namespace { -Stats::ScopePtr generateStatsScope(const envoy::config::cluster::v3::Cluster& config, - Stats::Store& stats) { +Stats::ScopeSharedPtr generateStatsScope(const envoy::config::cluster::v3::Cluster& config, + Stats::Store& stats) { return stats.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); } diff --git a/source/common/upstream/cluster_factory_impl.h b/source/common/upstream/cluster_factory_impl.h index 1ff81b8503285..50a0cfdb4c341 100644 --- a/source/common/upstream/cluster_factory_impl.h +++ b/source/common/upstream/cluster_factory_impl.h @@ -150,7 +150,7 @@ class ClusterFactoryImplBase : public ClusterFactory { virtual std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) PURE; + Stats::ScopeSharedPtr&& stats_scope) PURE; const std::string name_; }; @@ -174,7 +174,7 @@ template class ConfigurableClusterFactoryBase : public Clust std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override { + Stats::ScopeSharedPtr&& stats_scope) override { ProtobufTypes::MessagePtr config = createEmptyConfigProto(); Config::Utility::translateOpaqueConfig(cluster.cluster_type().typed_config(), socket_factory_context.messageValidationVisitor(), @@ -189,7 +189,7 @@ template class ConfigurableClusterFactoryBase : public Clust const envoy::config::cluster::v3::Cluster& cluster, const ConfigProto& proto_config, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) PURE; + Stats::ScopeSharedPtr&& stats_scope) PURE; }; } // namespace Upstream diff --git a/source/common/upstream/eds.cc b/source/common/upstream/eds.cc index 3e6788d565df7..50e9d256c0888 100644 --- a/source/common/upstream/eds.cc +++ b/source/common/upstream/eds.cc @@ -16,7 +16,7 @@ namespace Upstream { EdsClusterImpl::EdsClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) : BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), Envoy::Config::SubscriptionBase( @@ -378,7 +378,7 @@ std::pair EdsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) { + Stats::ScopeSharedPtr&& stats_scope) { if (!cluster.has_eds_cluster_config()) { throw EnvoyException("cannot create an EDS cluster without an EDS config"); } diff --git a/source/common/upstream/eds.h b/source/common/upstream/eds.h index 476e783a32a58..4d25a888f0b06 100644 --- a/source/common/upstream/eds.h +++ b/source/common/upstream/eds.h @@ -32,7 +32,7 @@ class EdsClusterImpl public: EdsClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return initialize_phase_; } @@ -115,7 +115,7 @@ class EdsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/health_discovery_service.cc b/source/common/upstream/health_discovery_service.cc index 7bac0901a01ac..3e59df12f0eee 100644 --- a/source/common/upstream/health_discovery_service.cc +++ b/source/common/upstream/health_discovery_service.cc @@ -520,7 +520,7 @@ ClusterSharedPtr HdsCluster::create() { return nullptr; } ClusterInfoConstSharedPtr ProdClusterInfoFactory::createClusterInfo(const CreateClusterInfoParams& params) { - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/source/common/upstream/leds.h b/source/common/upstream/leds.h index a58f31baa0f4d..d3893f5da184e 100644 --- a/source/common/upstream/leds.h +++ b/source/common/upstream/leds.h @@ -65,7 +65,7 @@ class LedsSubscription const LocalInfo::LocalInfo& local_info_; const std::string cluster_name_; // LEDS stats scope must outlive the subscription. - Stats::ScopePtr stats_scope_; + Stats::ScopeSharedPtr stats_scope_; LedsStats stats_; // A map between a LEDS resource name to the LbEndpoint data. LbEndpointsMap endpoints_map_; diff --git a/source/common/upstream/logical_dns_cluster.cc b/source/common/upstream/logical_dns_cluster.cc index 6e34bbb8fab91..54290881a3fe3 100644 --- a/source/common/upstream/logical_dns_cluster.cc +++ b/source/common/upstream/logical_dns_cluster.cc @@ -48,7 +48,7 @@ LogicalDnsCluster::LogicalDnsCluster( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) : ClusterImplBase(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), dns_resolver_(dns_resolver), @@ -182,7 +182,7 @@ std::pair LogicalDnsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) { + Stats::ScopeSharedPtr&& stats_scope) { auto selected_dns_resolver = selectDnsResolver(cluster, context); return std::make_pair(std::make_shared( diff --git a/source/common/upstream/logical_dns_cluster.h b/source/common/upstream/logical_dns_cluster.h index 233244d03bbdf..e30942df7e720 100644 --- a/source/common/upstream/logical_dns_cluster.h +++ b/source/common/upstream/logical_dns_cluster.h @@ -36,7 +36,7 @@ class LogicalDnsCluster : public ClusterImplBase { LogicalDnsCluster(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); ~LogicalDnsCluster() override; @@ -85,7 +85,7 @@ class LogicalDnsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; DECLARE_FACTORY(LogicalDnsClusterFactory); diff --git a/source/common/upstream/maglev_lb.h b/source/common/upstream/maglev_lb.h index d2c4ed58109bd..0d1c6fc5f71e1 100644 --- a/source/common/upstream/maglev_lb.h +++ b/source/common/upstream/maglev_lb.h @@ -99,7 +99,7 @@ class MaglevLoadBalancer : public ThreadAwareLoadBalancerBase, static MaglevLoadBalancerStats generateStats(Stats::Scope& scope); - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; MaglevLoadBalancerStats stats_; const uint64_t table_size_; const bool use_hostname_for_hashing_; diff --git a/source/common/upstream/od_cds_api_impl.h b/source/common/upstream/od_cds_api_impl.h index 184cc6f5182e3..43f03d7d6db51 100644 --- a/source/common/upstream/od_cds_api_impl.h +++ b/source/common/upstream/od_cds_api_impl.h @@ -87,7 +87,7 @@ class OdCdsApiImpl : public OdCdsApi, CdsApiHelper helper_; ClusterManager& cm_; MissingClusterNotifier& notifier_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; StartStatus status_; absl::flat_hash_set awaiting_names_; Config::SubscriptionPtr subscription_; diff --git a/source/common/upstream/original_dst_cluster.cc b/source/common/upstream/original_dst_cluster.cc index 00561a544a165..c60e977cd1524 100644 --- a/source/common/upstream/original_dst_cluster.cc +++ b/source/common/upstream/original_dst_cluster.cc @@ -108,7 +108,7 @@ OriginalDstCluster::LoadBalancer::requestOverrideHost(LoadBalancerContext* conte OriginalDstCluster::OriginalDstCluster( const envoy::config::cluster::v3::Cluster& config, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) : ClusterImplBase(config, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), dispatcher_(factory_context.mainThreadDispatcher()), @@ -182,7 +182,7 @@ std::pair OriginalDstClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) { + Stats::ScopeSharedPtr&& stats_scope) { if (cluster.lb_policy() != envoy::config::cluster::v3::Cluster::CLUSTER_PROVIDED) { throw EnvoyException( fmt::format("cluster: LB policy {} is not valid for Cluster type {}. Only " diff --git a/source/common/upstream/original_dst_cluster.h b/source/common/upstream/original_dst_cluster.h index 589991eb612f7..a9cd8741c4d30 100644 --- a/source/common/upstream/original_dst_cluster.h +++ b/source/common/upstream/original_dst_cluster.h @@ -31,7 +31,7 @@ class OriginalDstCluster : public ClusterImplBase { public: OriginalDstCluster(const envoy::config::cluster::v3::Cluster& config, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -135,7 +135,7 @@ class OriginalDstClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/ring_hash_lb.h b/source/common/upstream/ring_hash_lb.h index 3369a7ba635a1..aa861eb9fb92c 100644 --- a/source/common/upstream/ring_hash_lb.h +++ b/source/common/upstream/ring_hash_lb.h @@ -87,7 +87,7 @@ class RingHashLoadBalancer : public ThreadAwareLoadBalancerBase, static RingHashLoadBalancerStats generateStats(Stats::Scope& scope); - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; RingHashLoadBalancerStats stats_; static const uint64_t DefaultMinRingSize = 1024; diff --git a/source/common/upstream/static_cluster.cc b/source/common/upstream/static_cluster.cc index b1656fe2ee698..4fdd3f9f7df34 100644 --- a/source/common/upstream/static_cluster.cc +++ b/source/common/upstream/static_cluster.cc @@ -10,7 +10,7 @@ namespace Upstream { StaticClusterImpl::StaticClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) : ClusterImplBase(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), priority_state_manager_( @@ -65,7 +65,7 @@ std::pair StaticClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) { + Stats::ScopeSharedPtr&& stats_scope) { return std::make_pair( std::make_shared(cluster, context.runtime(), socket_factory_context, std::move(stats_scope), context.addedViaApi()), diff --git a/source/common/upstream/static_cluster.h b/source/common/upstream/static_cluster.h index a6c710ac6aec6..9ad812505aa5f 100644 --- a/source/common/upstream/static_cluster.h +++ b/source/common/upstream/static_cluster.h @@ -16,7 +16,7 @@ class StaticClusterImpl : public ClusterImplBase { public: StaticClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -40,7 +40,7 @@ class StaticClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; DECLARE_FACTORY(StaticClusterFactory); diff --git a/source/common/upstream/strict_dns_cluster.cc b/source/common/upstream/strict_dns_cluster.cc index d641c31e781d9..2c26424ff6e73 100644 --- a/source/common/upstream/strict_dns_cluster.cc +++ b/source/common/upstream/strict_dns_cluster.cc @@ -12,7 +12,7 @@ StrictDnsClusterImpl::StrictDnsClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) : BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), load_assignment_(cluster.load_assignment()), local_info_(factory_context.localInfo()), @@ -198,7 +198,7 @@ std::pair StrictDnsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) { + Stats::ScopeSharedPtr&& stats_scope) { auto selected_dns_resolver = selectDnsResolver(cluster, context); return std::make_pair(std::make_shared( diff --git a/source/common/upstream/strict_dns_cluster.h b/source/common/upstream/strict_dns_cluster.h index 70c3040414524..d04fb5e833180 100644 --- a/source/common/upstream/strict_dns_cluster.h +++ b/source/common/upstream/strict_dns_cluster.h @@ -18,7 +18,7 @@ class StrictDnsClusterImpl : public BaseDynamicClusterImpl { StrictDnsClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api); + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -83,7 +83,7 @@ class StrictDnsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override; + Stats::ScopeSharedPtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/upstream_impl.cc b/source/common/upstream/upstream_impl.cc index d35d436c4a509..d68fd829cf53f 100644 --- a/source/common/upstream/upstream_impl.cc +++ b/source/common/upstream/upstream_impl.cc @@ -783,8 +783,8 @@ createOptions(const envoy::config::cluster::v3::Cluster& config, ClusterInfoImpl::ClusterInfoImpl( const envoy::config::cluster::v3::Cluster& config, const envoy::config::core::v3::BindConfig& bind_config, Runtime::Loader& runtime, - TransportSocketMatcherPtr&& socket_matcher, Stats::ScopePtr&& stats_scope, bool added_via_api, - Server::Configuration::TransportSocketFactoryContext& factory_context) + TransportSocketMatcherPtr&& socket_matcher, Stats::ScopeSharedPtr&& stats_scope, + bool added_via_api, Server::Configuration::TransportSocketFactoryContext& factory_context) : runtime_(runtime), name_(config.name()), observability_name_(PROTOBUF_GET_STRING_OR_DEFAULT(config, alt_stat_name, name_)), type_(config.type()), @@ -1050,7 +1050,7 @@ ClusterInfoImpl::upstreamHttpProtocol(absl::optional downstream_ ClusterImplBase::ClusterImplBase( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopePtr&& stats_scope, bool added_via_api, TimeSource& time_source) + Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, TimeSource& time_source) : init_manager_(fmt::format("Cluster {}", cluster.name())), init_watcher_("ClusterImplBase", [this]() { onInitDone(); }), runtime_(runtime), wait_for_warm_on_init_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(cluster, wait_for_warm_on_init, true)), diff --git a/source/common/upstream/upstream_impl.h b/source/common/upstream/upstream_impl.h index f54559954d7bc..802483a615e8f 100644 --- a/source/common/upstream/upstream_impl.h +++ b/source/common/upstream/upstream_impl.h @@ -598,7 +598,7 @@ class ClusterInfoImpl : public ClusterInfo, Envoy::Extensions::Upstreams::Http::ProtocolOptionsConfigImpl; ClusterInfoImpl(const envoy::config::cluster::v3::Cluster& config, const envoy::config::core::v3::BindConfig& bind_config, Runtime::Loader& runtime, - TransportSocketMatcherPtr&& socket_matcher, Stats::ScopePtr&& stats_scope, + TransportSocketMatcherPtr&& socket_matcher, Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, Server::Configuration::TransportSocketFactoryContext&); static ClusterStats generateStats(Stats::Scope& scope, @@ -793,7 +793,7 @@ class ClusterInfoImpl : public ClusterInfo, const float peekahead_ratio_; const uint32_t per_connection_buffer_limit_bytes_; TransportSocketMatcherPtr socket_matcher_; - Stats::ScopePtr stats_scope_; + Stats::ScopeSharedPtr stats_scope_; mutable ClusterStats stats_; Stats::IsolatedStoreImpl load_report_stats_store_; mutable ClusterLoadReportStats load_report_stats_; @@ -905,7 +905,7 @@ class ClusterImplBase : public Cluster, protected Logger::Loggable store = std::make_unique(symbol_table); Stats::StatNamePool pool(symbol_table); - Stats::ScopePtr scope = store->createScope(provider.ConsumeRandomLengthString(max_len)); + Stats::ScopeSharedPtr scope = store->createScope(provider.ConsumeRandomLengthString(max_len)); Stats::ElementVec ele_vec; Stats::StatNameVec sn_vec; Stats::StatNameTagVector tags; diff --git a/test/common/upstream/cluster_factory_impl_test.cc b/test/common/upstream/cluster_factory_impl_test.cc index 8ae0c5cad5f5c..8f63415707a66 100644 --- a/test/common/upstream/cluster_factory_impl_test.cc +++ b/test/common/upstream/cluster_factory_impl_test.cc @@ -43,7 +43,7 @@ class TestStaticClusterFactory : public Event::TestUsingSimulatedTime, std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopePtr&& stats_scope) override { + Stats::ScopeSharedPtr&& stats_scope) override { return std::make_pair(std::make_shared( cluster, context.runtime(), socket_factory_context, std::move(stats_scope), context.addedViaApi(), 1, "127.0.0.1", 80), diff --git a/test/common/upstream/eds_speed_test.cc b/test/common/upstream/eds_speed_test.cc index c3d6a43e27ef9..ba6e9bdb3ce9f 100644 --- a/test/common/upstream/eds_speed_test.cc +++ b/test/common/upstream/eds_speed_test.cc @@ -81,7 +81,7 @@ class EdsSpeedTest { void resetCluster(const std::string& yaml_config, Cluster::InitializePhase initialize_phase) { local_info_.node_.mutable_locality()->set_zone("us-east-1a"); eds_cluster_ = parseClusterFromV3Yaml(yaml_config); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", eds_cluster_.alt_stat_name().empty() ? eds_cluster_.name() : eds_cluster_.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/eds_test.cc b/test/common/upstream/eds_test.cc index c57da0bb13e12..3e4d94b126e32 100644 --- a/test/common/upstream/eds_test.cc +++ b/test/common/upstream/eds_test.cc @@ -121,7 +121,7 @@ class EdsTest : public testing::Test { void resetCluster(const std::string& yaml_config, Cluster::InitializePhase initialize_phase) { local_info_.node_.mutable_locality()->set_zone("us-east-1a"); eds_cluster_ = parseClusterFromV3Yaml(yaml_config); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", eds_cluster_.alt_stat_name().empty() ? eds_cluster_.name() : eds_cluster_.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/hds_test.cc b/test/common/upstream/hds_test.cc index 23da61c810cb6..b7c6d6b26b8a4 100644 --- a/test/common/upstream/hds_test.cc +++ b/test/common/upstream/hds_test.cc @@ -578,7 +578,7 @@ TEST_F(HdsTest, TestSocketContext) { EXPECT_CALL(test_factory_, createClusterInfo(_)) .WillRepeatedly(Invoke([&](const ClusterInfoFactory::CreateClusterInfoParams& params) { // Build scope, factory_context as does ProdClusterInfoFactory. - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( params.admin_, params.ssl_context_manager_, *scope, params.cm_, params.local_info_, @@ -1030,7 +1030,7 @@ TEST_F(HdsTest, TestUpdateSocketContext) { EXPECT_CALL(test_factory_, createClusterInfo(_)) .WillRepeatedly(Invoke([&](const ClusterInfoFactory::CreateClusterInfoParams& params) { // Build scope, factory_context as does ProdClusterInfoFactory. - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( params.admin_, params.ssl_context_manager_, *scope, params.cm_, params.local_info_, diff --git a/test/common/upstream/leds_test.cc b/test/common/upstream/leds_test.cc index 300c6c20ad8cd..a0dcdc671137f 100644 --- a/test/common/upstream/leds_test.cc +++ b/test/common/upstream/leds_test.cc @@ -156,7 +156,7 @@ class LedsTest : public testing::Test { Ssl::MockContextManager ssl_context_manager_; NiceMock cm_; NiceMock dispatcher_; - Envoy::Stats::ScopePtr cluster_scope_; + Envoy::Stats::ScopeSharedPtr cluster_scope_; LedsSubscriptionPtr leds_subscription_; NiceMock random_; NiceMock runtime_; diff --git a/test/common/upstream/logical_dns_cluster_test.cc b/test/common/upstream/logical_dns_cluster_test.cc index 9afdd78e71c92..8135cad9954bf 100644 --- a/test/common/upstream/logical_dns_cluster_test.cc +++ b/test/common/upstream/logical_dns_cluster_test.cc @@ -48,7 +48,7 @@ class LogicalDnsClusterTest : public Event::TestUsingSimulatedTime, public testi resolve_timer_ = new Event::MockTimer(&dispatcher_); NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/original_dst_cluster_test.cc b/test/common/upstream/original_dst_cluster_test.cc index 6fc86b2e056a8..369f4c19d01d2 100644 --- a/test/common/upstream/original_dst_cluster_test.cc +++ b/test/common/upstream/original_dst_cluster_test.cc @@ -75,7 +75,7 @@ class OriginalDstClusterTest : public Event::TestUsingSimulatedTime, public test void setup(const envoy::config::cluster::v3::Cluster& cluster_config) { NiceMock cm; - Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/subset_lb_test.cc b/test/common/upstream/subset_lb_test.cc index 133d15cacba90..b925294c25394 100644 --- a/test/common/upstream/subset_lb_test.cc +++ b/test/common/upstream/subset_lb_test.cc @@ -481,7 +481,7 @@ class SubsetLoadBalancerTest : public Event::TestUsingSimulatedTime, NiceMock runtime_; NiceMock random_; Stats::IsolatedStoreImpl stats_store_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; ClusterStatNames stat_names_; ClusterStats stats_; PrioritySetImpl local_priority_set_; diff --git a/test/common/upstream/transport_socket_matcher_test.cc b/test/common/upstream/transport_socket_matcher_test.cc index 4a3f8af0690c9..88d200f4e1404 100644 --- a/test/common/upstream/transport_socket_matcher_test.cc +++ b/test/common/upstream/transport_socket_matcher_test.cc @@ -107,7 +107,7 @@ class TransportSocketMatcherTest : public testing::Test { NiceMock mock_factory_context_; Network::TransportSocketFactoryPtr mock_default_factory_; Stats::IsolatedStoreImpl stats_store_; - Stats::ScopePtr stats_scope_; + Stats::ScopeSharedPtr stats_scope_; }; TEST_F(TransportSocketMatcherTest, ReturnDefaultSocketFactoryWhenNoMatch) { diff --git a/test/common/upstream/upstream_impl_test.cc b/test/common/upstream/upstream_impl_test.cc index a52916f4ef471..f66ce7daa6b97 100644 --- a/test/common/upstream/upstream_impl_test.cc +++ b/test/common/upstream/upstream_impl_test.cc @@ -190,7 +190,7 @@ TEST_P(StrictDnsParamTest, ImmediateResolve) { return nullptr; })); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -224,7 +224,7 @@ TEST_F(StrictDnsClusterImplTest, ZeroHostsIsInializedImmediately) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -259,7 +259,7 @@ TEST_F(StrictDnsClusterImplTest, ZeroHostsHealthChecker) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -305,7 +305,7 @@ TEST_F(StrictDnsClusterImplTest, DontWaitForDNSOnInit) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -380,7 +380,7 @@ TEST_F(StrictDnsClusterImplTest, Basic) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -536,7 +536,7 @@ TEST_F(StrictDnsClusterImplTest, HostRemovalActiveHealthSkipped) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -597,7 +597,7 @@ TEST_F(StrictDnsClusterImplTest, HostRemovalAfterHcFail) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -724,7 +724,7 @@ TEST_F(StrictDnsClusterImplTest, LoadAssignmentBasic) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -962,7 +962,7 @@ TEST_F(StrictDnsClusterImplTest, LoadAssignmentBasicMultiplePriorities) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1078,7 +1078,7 @@ TEST_F(StrictDnsClusterImplTest, CustomResolverFails) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -1113,7 +1113,7 @@ TEST_F(StrictDnsClusterImplTest, FailureRefreshRateBackoffResetsWhenSuccessHappe )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1162,7 +1162,7 @@ TEST_F(StrictDnsClusterImplTest, TtlAsDnsRefreshRate) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1242,7 +1242,7 @@ TEST_F(StrictDnsClusterImplTest, Http2UserDefinedSettingsParametersValidation) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1470,7 +1470,7 @@ TEST_F(StaticClusterImplTest, InitialHosts) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1505,7 +1505,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentEmptyHostname) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1540,7 +1540,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentNonEmptyHostname) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1575,7 +1575,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentNonEmptyHostnameWithHealthChecks) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1628,7 +1628,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentMultiplePriorities) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1673,7 +1673,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentLocality) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1719,7 +1719,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentEdsHealth) { NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1751,7 +1751,7 @@ TEST_F(StaticClusterImplTest, AltStatName) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1781,7 +1781,7 @@ TEST_F(StaticClusterImplTest, RingHash) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1819,7 +1819,7 @@ TEST_F(StaticClusterImplTest, RoundRobinWithSlowStart) { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1861,7 +1861,7 @@ TEST_F(StaticClusterImplTest, LeastRequestWithSlowStart) { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1901,7 +1901,7 @@ TEST_F(StaticClusterImplTest, OutlierDetector) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1959,7 +1959,7 @@ TEST_F(StaticClusterImplTest, HealthyStat) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2100,7 +2100,7 @@ TEST_F(StaticClusterImplTest, UrlConfig) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2152,7 +2152,7 @@ TEST_F(StaticClusterImplTest, UnsupportedLBType) { EXPECT_THROW_WITH_REGEX( { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); @@ -2195,7 +2195,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2240,7 +2240,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithOtherLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2283,7 +2283,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithoutLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2313,7 +2313,7 @@ TEST_F(StaticClusterImplTest, MalformedHostIP) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2341,7 +2341,7 @@ TEST_F(StaticClusterImplTest, NoHostsTest) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2360,7 +2360,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { { // If the cluster manager gets a source address from the bootstrap proto, use it. cm_.bind_config_.mutable_source_address()->set_address("1.2.3.5"); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2373,7 +2373,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { config.mutable_upstream_bind_config()->mutable_source_address()->set_address(cluster_address); { // Verify source address from cluster config is used when present. - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2385,7 +2385,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { { // The source address from cluster config takes precedence over one from the bootstrap proto. cm_.bind_config_.mutable_source_address()->set_address("1.2.3.5"); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2409,7 +2409,7 @@ TEST_F(StaticClusterImplTest, LedsUnsupported) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2445,7 +2445,7 @@ TEST_F(ClusterImplTest, CloseConnectionsOnHostHealthFailure) { port_value: 443 )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2683,7 +2683,7 @@ class ClusterInfoImplTest : public testing::Test { NiceMock tls_; ReadyWatcher initialized_; envoy::config::cluster::v3::Cluster cluster_config_; - Envoy::Stats::ScopePtr scope_; + Envoy::Stats::ScopeSharedPtr scope_; std::unique_ptr factory_context_; NiceMock validation_visitor_; Api::ApiPtr api_; From 74b0c22cb7066b126d7675605c38592df4843fb3 Mon Sep 17 00:00:00 2001 From: Joshua Marantz Date: Sun, 20 Feb 2022 21:44:16 -0500 Subject: [PATCH 6/7] back to ground state after source/common changes induced an error. Signed-off-by: Joshua Marantz --- source/common/filter/config_discovery_impl.h | 2 +- .../rds/rds_route_config_subscription.h | 2 +- source/common/router/config_impl.h | 8 +- source/common/router/scoped_rds.h | 2 +- source/common/router/vhds.h | 2 +- source/common/runtime/runtime_impl.h | 2 +- source/common/secret/sds_api.h | 2 +- source/common/tcp_proxy/tcp_proxy.h | 2 +- source/common/upstream/cds_api_impl.h | 2 +- .../common/upstream/cluster_factory_impl.cc | 4 +- source/common/upstream/cluster_factory_impl.h | 6 +- source/common/upstream/eds.cc | 4 +- source/common/upstream/eds.h | 4 +- .../upstream/health_discovery_service.cc | 2 +- source/common/upstream/leds.h | 2 +- source/common/upstream/logical_dns_cluster.cc | 4 +- source/common/upstream/logical_dns_cluster.h | 4 +- source/common/upstream/maglev_lb.h | 2 +- source/common/upstream/od_cds_api_impl.h | 2 +- .../common/upstream/original_dst_cluster.cc | 4 +- source/common/upstream/original_dst_cluster.h | 4 +- source/common/upstream/ring_hash_lb.h | 2 +- source/common/upstream/static_cluster.cc | 4 +- source/common/upstream/static_cluster.h | 4 +- source/common/upstream/strict_dns_cluster.cc | 4 +- source/common/upstream/strict_dns_cluster.h | 4 +- source/common/upstream/upstream_impl.cc | 6 +- source/common/upstream/upstream_impl.h | 6 +- test/common/stats/utility_fuzz_test.cc | 2 +- .../upstream/cluster_factory_impl_test.cc | 2 +- test/common/upstream/eds_speed_test.cc | 2 +- test/common/upstream/eds_test.cc | 2 +- test/common/upstream/hds_test.cc | 4 +- test/common/upstream/leds_test.cc | 2 +- .../upstream/logical_dns_cluster_test.cc | 2 +- .../upstream/original_dst_cluster_test.cc | 2 +- test/common/upstream/subset_lb_test.cc | 2 +- .../upstream/transport_socket_matcher_test.cc | 2 +- test/common/upstream/upstream_impl_test.cc | 78 +++++++++---------- 39 files changed, 98 insertions(+), 98 deletions(-) diff --git a/source/common/filter/config_discovery_impl.h b/source/common/filter/config_discovery_impl.h index f4b8c2d58035a..c07ab14a94fce 100644 --- a/source/common/filter/config_discovery_impl.h +++ b/source/common/filter/config_discovery_impl.h @@ -229,7 +229,7 @@ class FilterConfigSubscription Init::SharedTargetImpl init_target_; bool started_{false}; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; const std::string stat_prefix_; ExtensionConfigDiscoveryStats stats_; diff --git a/source/common/rds/rds_route_config_subscription.h b/source/common/rds/rds_route_config_subscription.h index 98d5e9418f984..d1753d105a783 100644 --- a/source/common/rds/rds_route_config_subscription.h +++ b/source/common/rds/rds_route_config_subscription.h @@ -80,7 +80,7 @@ class RdsRouteConfigSubscription : Envoy::Config::SubscriptionCallbacks, protected: const std::string route_config_name_; // This scope must outlive the subscription_ below as the subscription has derived stats. - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; Envoy::Config::SubscriptionPtr subscription_; Server::Configuration::ServerFactoryContext& factory_context_; diff --git a/source/common/router/config_impl.h b/source/common/router/config_impl.h index 8c54e3ae8b937..56ee4d3c5b430 100644 --- a/source/common/router/config_impl.h +++ b/source/common/router/config_impl.h @@ -237,7 +237,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable struct VirtualClusterBase : public VirtualCluster { public: VirtualClusterBase(const absl::optional& name, Stats::StatName stat_name, - Stats::ScopeSharedPtr&& scope, const VirtualClusterStatNames& stat_names) + Stats::ScopePtr&& scope, const VirtualClusterStatNames& stat_names) : name_(name), stat_name_(stat_name), scope_(std::move(scope)), stats_(generateStats(*scope_, stat_names)) {} @@ -251,7 +251,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable private: const absl::optional name_; const Stats::StatName stat_name_; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; mutable VirtualClusterStats stats_; }; @@ -270,7 +270,7 @@ class VirtualHostImpl : public VirtualHost, Logger::Loggable static const std::shared_ptr SSL_REDIRECT_ROUTE; const Stats::StatNameManagedStorage stat_name_storage_; - Stats::ScopeSharedPtr vcluster_scope_; + Stats::ScopePtr vcluster_scope_; std::vector routes_; std::vector virtual_clusters_; SslRequirements ssl_requirements_; @@ -1156,7 +1156,7 @@ class RouteMatcher { const WildcardVirtualHosts& wildcard_virtual_hosts, SubstringFunction substring_function) const; - Stats::ScopeSharedPtr vhost_scope_; + Stats::ScopePtr vhost_scope_; absl::node_hash_map virtual_hosts_; // std::greater as a minor optimization to iterate from more to less specific // diff --git a/source/common/router/scoped_rds.h b/source/common/router/scoped_rds.h index 44c5990e76522..decd0d88a9282 100644 --- a/source/common/router/scoped_rds.h +++ b/source/common/router/scoped_rds.h @@ -227,7 +227,7 @@ class ScopedRdsConfigSubscription Server::Configuration::ServerFactoryContext& factory_context_; const std::string name_; // Stats must outlive subscription. - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; ScopedRdsStats stats_; Envoy::Config::SubscriptionPtr subscription_; const envoy::extensions::filters::network::http_connection_manager::v3::ScopedRoutes:: diff --git a/source/common/router/vhds.h b/source/common/router/vhds.h index 919afea87fbe4..41071ae4ee287 100644 --- a/source/common/router/vhds.h +++ b/source/common/router/vhds.h @@ -67,7 +67,7 @@ class VhdsSubscription : Envoy::Config::SubscriptionBase idle_timeout_; diff --git a/source/common/upstream/cds_api_impl.h b/source/common/upstream/cds_api_impl.h index b38c6686c40aa..63ca584eb06db 100644 --- a/source/common/upstream/cds_api_impl.h +++ b/source/common/upstream/cds_api_impl.h @@ -53,7 +53,7 @@ class CdsApiImpl : public CdsApi, CdsApiHelper helper_; ClusterManager& cm_; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; Config::SubscriptionPtr subscription_; std::function initialize_callback_; }; diff --git a/source/common/upstream/cluster_factory_impl.cc b/source/common/upstream/cluster_factory_impl.cc index 5a00af25c009a..b38f9cff04a08 100644 --- a/source/common/upstream/cluster_factory_impl.cc +++ b/source/common/upstream/cluster_factory_impl.cc @@ -16,8 +16,8 @@ namespace Upstream { namespace { -Stats::ScopeSharedPtr generateStatsScope(const envoy::config::cluster::v3::Cluster& config, - Stats::Store& stats) { +Stats::ScopePtr generateStatsScope(const envoy::config::cluster::v3::Cluster& config, + Stats::Store& stats) { return stats.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); } diff --git a/source/common/upstream/cluster_factory_impl.h b/source/common/upstream/cluster_factory_impl.h index 50a0cfdb4c341..1ff81b8503285 100644 --- a/source/common/upstream/cluster_factory_impl.h +++ b/source/common/upstream/cluster_factory_impl.h @@ -150,7 +150,7 @@ class ClusterFactoryImplBase : public ClusterFactory { virtual std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) PURE; + Stats::ScopePtr&& stats_scope) PURE; const std::string name_; }; @@ -174,7 +174,7 @@ template class ConfigurableClusterFactoryBase : public Clust std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override { + Stats::ScopePtr&& stats_scope) override { ProtobufTypes::MessagePtr config = createEmptyConfigProto(); Config::Utility::translateOpaqueConfig(cluster.cluster_type().typed_config(), socket_factory_context.messageValidationVisitor(), @@ -189,7 +189,7 @@ template class ConfigurableClusterFactoryBase : public Clust const envoy::config::cluster::v3::Cluster& cluster, const ConfigProto& proto_config, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) PURE; + Stats::ScopePtr&& stats_scope) PURE; }; } // namespace Upstream diff --git a/source/common/upstream/eds.cc b/source/common/upstream/eds.cc index 50e9d256c0888..3e6788d565df7 100644 --- a/source/common/upstream/eds.cc +++ b/source/common/upstream/eds.cc @@ -16,7 +16,7 @@ namespace Upstream { EdsClusterImpl::EdsClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) + Stats::ScopePtr&& stats_scope, bool added_via_api) : BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), Envoy::Config::SubscriptionBase( @@ -378,7 +378,7 @@ std::pair EdsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) { + Stats::ScopePtr&& stats_scope) { if (!cluster.has_eds_cluster_config()) { throw EnvoyException("cannot create an EDS cluster without an EDS config"); } diff --git a/source/common/upstream/eds.h b/source/common/upstream/eds.h index 4d25a888f0b06..476e783a32a58 100644 --- a/source/common/upstream/eds.h +++ b/source/common/upstream/eds.h @@ -32,7 +32,7 @@ class EdsClusterImpl public: EdsClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return initialize_phase_; } @@ -115,7 +115,7 @@ class EdsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/health_discovery_service.cc b/source/common/upstream/health_discovery_service.cc index 3e59df12f0eee..7bac0901a01ac 100644 --- a/source/common/upstream/health_discovery_service.cc +++ b/source/common/upstream/health_discovery_service.cc @@ -520,7 +520,7 @@ ClusterSharedPtr HdsCluster::create() { return nullptr; } ClusterInfoConstSharedPtr ProdClusterInfoFactory::createClusterInfo(const CreateClusterInfoParams& params) { - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/source/common/upstream/leds.h b/source/common/upstream/leds.h index d3893f5da184e..a58f31baa0f4d 100644 --- a/source/common/upstream/leds.h +++ b/source/common/upstream/leds.h @@ -65,7 +65,7 @@ class LedsSubscription const LocalInfo::LocalInfo& local_info_; const std::string cluster_name_; // LEDS stats scope must outlive the subscription. - Stats::ScopeSharedPtr stats_scope_; + Stats::ScopePtr stats_scope_; LedsStats stats_; // A map between a LEDS resource name to the LbEndpoint data. LbEndpointsMap endpoints_map_; diff --git a/source/common/upstream/logical_dns_cluster.cc b/source/common/upstream/logical_dns_cluster.cc index 54290881a3fe3..6e34bbb8fab91 100644 --- a/source/common/upstream/logical_dns_cluster.cc +++ b/source/common/upstream/logical_dns_cluster.cc @@ -48,7 +48,7 @@ LogicalDnsCluster::LogicalDnsCluster( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) + Stats::ScopePtr&& stats_scope, bool added_via_api) : ClusterImplBase(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), dns_resolver_(dns_resolver), @@ -182,7 +182,7 @@ std::pair LogicalDnsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) { + Stats::ScopePtr&& stats_scope) { auto selected_dns_resolver = selectDnsResolver(cluster, context); return std::make_pair(std::make_shared( diff --git a/source/common/upstream/logical_dns_cluster.h b/source/common/upstream/logical_dns_cluster.h index e30942df7e720..233244d03bbdf 100644 --- a/source/common/upstream/logical_dns_cluster.h +++ b/source/common/upstream/logical_dns_cluster.h @@ -36,7 +36,7 @@ class LogicalDnsCluster : public ClusterImplBase { LogicalDnsCluster(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); ~LogicalDnsCluster() override; @@ -85,7 +85,7 @@ class LogicalDnsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; DECLARE_FACTORY(LogicalDnsClusterFactory); diff --git a/source/common/upstream/maglev_lb.h b/source/common/upstream/maglev_lb.h index 0d1c6fc5f71e1..d2c4ed58109bd 100644 --- a/source/common/upstream/maglev_lb.h +++ b/source/common/upstream/maglev_lb.h @@ -99,7 +99,7 @@ class MaglevLoadBalancer : public ThreadAwareLoadBalancerBase, static MaglevLoadBalancerStats generateStats(Stats::Scope& scope); - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; MaglevLoadBalancerStats stats_; const uint64_t table_size_; const bool use_hostname_for_hashing_; diff --git a/source/common/upstream/od_cds_api_impl.h b/source/common/upstream/od_cds_api_impl.h index 43f03d7d6db51..184cc6f5182e3 100644 --- a/source/common/upstream/od_cds_api_impl.h +++ b/source/common/upstream/od_cds_api_impl.h @@ -87,7 +87,7 @@ class OdCdsApiImpl : public OdCdsApi, CdsApiHelper helper_; ClusterManager& cm_; MissingClusterNotifier& notifier_; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; StartStatus status_; absl::flat_hash_set awaiting_names_; Config::SubscriptionPtr subscription_; diff --git a/source/common/upstream/original_dst_cluster.cc b/source/common/upstream/original_dst_cluster.cc index c60e977cd1524..00561a544a165 100644 --- a/source/common/upstream/original_dst_cluster.cc +++ b/source/common/upstream/original_dst_cluster.cc @@ -108,7 +108,7 @@ OriginalDstCluster::LoadBalancer::requestOverrideHost(LoadBalancerContext* conte OriginalDstCluster::OriginalDstCluster( const envoy::config::cluster::v3::Cluster& config, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) + Stats::ScopePtr&& stats_scope, bool added_via_api) : ClusterImplBase(config, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), dispatcher_(factory_context.mainThreadDispatcher()), @@ -182,7 +182,7 @@ std::pair OriginalDstClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) { + Stats::ScopePtr&& stats_scope) { if (cluster.lb_policy() != envoy::config::cluster::v3::Cluster::CLUSTER_PROVIDED) { throw EnvoyException( fmt::format("cluster: LB policy {} is not valid for Cluster type {}. Only " diff --git a/source/common/upstream/original_dst_cluster.h b/source/common/upstream/original_dst_cluster.h index a9cd8741c4d30..589991eb612f7 100644 --- a/source/common/upstream/original_dst_cluster.h +++ b/source/common/upstream/original_dst_cluster.h @@ -31,7 +31,7 @@ class OriginalDstCluster : public ClusterImplBase { public: OriginalDstCluster(const envoy::config::cluster::v3::Cluster& config, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -135,7 +135,7 @@ class OriginalDstClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/ring_hash_lb.h b/source/common/upstream/ring_hash_lb.h index aa861eb9fb92c..3369a7ba635a1 100644 --- a/source/common/upstream/ring_hash_lb.h +++ b/source/common/upstream/ring_hash_lb.h @@ -87,7 +87,7 @@ class RingHashLoadBalancer : public ThreadAwareLoadBalancerBase, static RingHashLoadBalancerStats generateStats(Stats::Scope& scope); - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; RingHashLoadBalancerStats stats_; static const uint64_t DefaultMinRingSize = 1024; diff --git a/source/common/upstream/static_cluster.cc b/source/common/upstream/static_cluster.cc index 4fdd3f9f7df34..b1656fe2ee698 100644 --- a/source/common/upstream/static_cluster.cc +++ b/source/common/upstream/static_cluster.cc @@ -10,7 +10,7 @@ namespace Upstream { StaticClusterImpl::StaticClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) + Stats::ScopePtr&& stats_scope, bool added_via_api) : ClusterImplBase(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), priority_state_manager_( @@ -65,7 +65,7 @@ std::pair StaticClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) { + Stats::ScopePtr&& stats_scope) { return std::make_pair( std::make_shared(cluster, context.runtime(), socket_factory_context, std::move(stats_scope), context.addedViaApi()), diff --git a/source/common/upstream/static_cluster.h b/source/common/upstream/static_cluster.h index 9ad812505aa5f..a6c710ac6aec6 100644 --- a/source/common/upstream/static_cluster.h +++ b/source/common/upstream/static_cluster.h @@ -16,7 +16,7 @@ class StaticClusterImpl : public ClusterImplBase { public: StaticClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -40,7 +40,7 @@ class StaticClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; DECLARE_FACTORY(StaticClusterFactory); diff --git a/source/common/upstream/strict_dns_cluster.cc b/source/common/upstream/strict_dns_cluster.cc index 2c26424ff6e73..d641c31e781d9 100644 --- a/source/common/upstream/strict_dns_cluster.cc +++ b/source/common/upstream/strict_dns_cluster.cc @@ -12,7 +12,7 @@ StrictDnsClusterImpl::StrictDnsClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api) + Stats::ScopePtr&& stats_scope, bool added_via_api) : BaseDynamicClusterImpl(cluster, runtime, factory_context, std::move(stats_scope), added_via_api, factory_context.mainThreadDispatcher().timeSource()), load_assignment_(cluster.load_assignment()), local_info_(factory_context.localInfo()), @@ -198,7 +198,7 @@ std::pair StrictDnsClusterFactory::createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) { + Stats::ScopePtr&& stats_scope) { auto selected_dns_resolver = selectDnsResolver(cluster, context); return std::make_pair(std::make_shared( diff --git a/source/common/upstream/strict_dns_cluster.h b/source/common/upstream/strict_dns_cluster.h index d04fb5e833180..70c3040414524 100644 --- a/source/common/upstream/strict_dns_cluster.h +++ b/source/common/upstream/strict_dns_cluster.h @@ -18,7 +18,7 @@ class StrictDnsClusterImpl : public BaseDynamicClusterImpl { StrictDnsClusterImpl(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Network::DnsResolverSharedPtr dns_resolver, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api); + Stats::ScopePtr&& stats_scope, bool added_via_api); // Upstream::Cluster InitializePhase initializePhase() const override { return InitializePhase::Primary; } @@ -83,7 +83,7 @@ class StrictDnsClusterFactory : public ClusterFactoryImplBase { std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override; + Stats::ScopePtr&& stats_scope) override; }; } // namespace Upstream diff --git a/source/common/upstream/upstream_impl.cc b/source/common/upstream/upstream_impl.cc index d68fd829cf53f..d35d436c4a509 100644 --- a/source/common/upstream/upstream_impl.cc +++ b/source/common/upstream/upstream_impl.cc @@ -783,8 +783,8 @@ createOptions(const envoy::config::cluster::v3::Cluster& config, ClusterInfoImpl::ClusterInfoImpl( const envoy::config::cluster::v3::Cluster& config, const envoy::config::core::v3::BindConfig& bind_config, Runtime::Loader& runtime, - TransportSocketMatcherPtr&& socket_matcher, Stats::ScopeSharedPtr&& stats_scope, - bool added_via_api, Server::Configuration::TransportSocketFactoryContext& factory_context) + TransportSocketMatcherPtr&& socket_matcher, Stats::ScopePtr&& stats_scope, bool added_via_api, + Server::Configuration::TransportSocketFactoryContext& factory_context) : runtime_(runtime), name_(config.name()), observability_name_(PROTOBUF_GET_STRING_OR_DEFAULT(config, alt_stat_name, name_)), type_(config.type()), @@ -1050,7 +1050,7 @@ ClusterInfoImpl::upstreamHttpProtocol(absl::optional downstream_ ClusterImplBase::ClusterImplBase( const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime, Server::Configuration::TransportSocketFactoryContextImpl& factory_context, - Stats::ScopeSharedPtr&& stats_scope, bool added_via_api, TimeSource& time_source) + Stats::ScopePtr&& stats_scope, bool added_via_api, TimeSource& time_source) : init_manager_(fmt::format("Cluster {}", cluster.name())), init_watcher_("ClusterImplBase", [this]() { onInitDone(); }), runtime_(runtime), wait_for_warm_on_init_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(cluster, wait_for_warm_on_init, true)), diff --git a/source/common/upstream/upstream_impl.h b/source/common/upstream/upstream_impl.h index 802483a615e8f..f54559954d7bc 100644 --- a/source/common/upstream/upstream_impl.h +++ b/source/common/upstream/upstream_impl.h @@ -598,7 +598,7 @@ class ClusterInfoImpl : public ClusterInfo, Envoy::Extensions::Upstreams::Http::ProtocolOptionsConfigImpl; ClusterInfoImpl(const envoy::config::cluster::v3::Cluster& config, const envoy::config::core::v3::BindConfig& bind_config, Runtime::Loader& runtime, - TransportSocketMatcherPtr&& socket_matcher, Stats::ScopeSharedPtr&& stats_scope, + TransportSocketMatcherPtr&& socket_matcher, Stats::ScopePtr&& stats_scope, bool added_via_api, Server::Configuration::TransportSocketFactoryContext&); static ClusterStats generateStats(Stats::Scope& scope, @@ -793,7 +793,7 @@ class ClusterInfoImpl : public ClusterInfo, const float peekahead_ratio_; const uint32_t per_connection_buffer_limit_bytes_; TransportSocketMatcherPtr socket_matcher_; - Stats::ScopeSharedPtr stats_scope_; + Stats::ScopePtr stats_scope_; mutable ClusterStats stats_; Stats::IsolatedStoreImpl load_report_stats_store_; mutable ClusterLoadReportStats load_report_stats_; @@ -905,7 +905,7 @@ class ClusterImplBase : public Cluster, protected Logger::Loggable store = std::make_unique(symbol_table); Stats::StatNamePool pool(symbol_table); - Stats::ScopeSharedPtr scope = store->createScope(provider.ConsumeRandomLengthString(max_len)); + Stats::ScopePtr scope = store->createScope(provider.ConsumeRandomLengthString(max_len)); Stats::ElementVec ele_vec; Stats::StatNameVec sn_vec; Stats::StatNameTagVector tags; diff --git a/test/common/upstream/cluster_factory_impl_test.cc b/test/common/upstream/cluster_factory_impl_test.cc index 8f63415707a66..8ae0c5cad5f5c 100644 --- a/test/common/upstream/cluster_factory_impl_test.cc +++ b/test/common/upstream/cluster_factory_impl_test.cc @@ -43,7 +43,7 @@ class TestStaticClusterFactory : public Event::TestUsingSimulatedTime, std::pair createClusterImpl( const envoy::config::cluster::v3::Cluster& cluster, ClusterFactoryContext& context, Server::Configuration::TransportSocketFactoryContextImpl& socket_factory_context, - Stats::ScopeSharedPtr&& stats_scope) override { + Stats::ScopePtr&& stats_scope) override { return std::make_pair(std::make_shared( cluster, context.runtime(), socket_factory_context, std::move(stats_scope), context.addedViaApi(), 1, "127.0.0.1", 80), diff --git a/test/common/upstream/eds_speed_test.cc b/test/common/upstream/eds_speed_test.cc index ba6e9bdb3ce9f..c3d6a43e27ef9 100644 --- a/test/common/upstream/eds_speed_test.cc +++ b/test/common/upstream/eds_speed_test.cc @@ -81,7 +81,7 @@ class EdsSpeedTest { void resetCluster(const std::string& yaml_config, Cluster::InitializePhase initialize_phase) { local_info_.node_.mutable_locality()->set_zone("us-east-1a"); eds_cluster_ = parseClusterFromV3Yaml(yaml_config); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", eds_cluster_.alt_stat_name().empty() ? eds_cluster_.name() : eds_cluster_.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/eds_test.cc b/test/common/upstream/eds_test.cc index 3e4d94b126e32..c57da0bb13e12 100644 --- a/test/common/upstream/eds_test.cc +++ b/test/common/upstream/eds_test.cc @@ -121,7 +121,7 @@ class EdsTest : public testing::Test { void resetCluster(const std::string& yaml_config, Cluster::InitializePhase initialize_phase) { local_info_.node_.mutable_locality()->set_zone("us-east-1a"); eds_cluster_ = parseClusterFromV3Yaml(yaml_config); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", eds_cluster_.alt_stat_name().empty() ? eds_cluster_.name() : eds_cluster_.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/hds_test.cc b/test/common/upstream/hds_test.cc index b7c6d6b26b8a4..23da61c810cb6 100644 --- a/test/common/upstream/hds_test.cc +++ b/test/common/upstream/hds_test.cc @@ -578,7 +578,7 @@ TEST_F(HdsTest, TestSocketContext) { EXPECT_CALL(test_factory_, createClusterInfo(_)) .WillRepeatedly(Invoke([&](const ClusterInfoFactory::CreateClusterInfoParams& params) { // Build scope, factory_context as does ProdClusterInfoFactory. - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( params.admin_, params.ssl_context_manager_, *scope, params.cm_, params.local_info_, @@ -1030,7 +1030,7 @@ TEST_F(HdsTest, TestUpdateSocketContext) { EXPECT_CALL(test_factory_, createClusterInfo(_)) .WillRepeatedly(Invoke([&](const ClusterInfoFactory::CreateClusterInfoParams& params) { // Build scope, factory_context as does ProdClusterInfoFactory. - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = params.stats_.createScope(fmt::format("cluster.{}.", params.cluster_.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( params.admin_, params.ssl_context_manager_, *scope, params.cm_, params.local_info_, diff --git a/test/common/upstream/leds_test.cc b/test/common/upstream/leds_test.cc index a0dcdc671137f..300c6c20ad8cd 100644 --- a/test/common/upstream/leds_test.cc +++ b/test/common/upstream/leds_test.cc @@ -156,7 +156,7 @@ class LedsTest : public testing::Test { Ssl::MockContextManager ssl_context_manager_; NiceMock cm_; NiceMock dispatcher_; - Envoy::Stats::ScopeSharedPtr cluster_scope_; + Envoy::Stats::ScopePtr cluster_scope_; LedsSubscriptionPtr leds_subscription_; NiceMock random_; NiceMock runtime_; diff --git a/test/common/upstream/logical_dns_cluster_test.cc b/test/common/upstream/logical_dns_cluster_test.cc index 8135cad9954bf..9afdd78e71c92 100644 --- a/test/common/upstream/logical_dns_cluster_test.cc +++ b/test/common/upstream/logical_dns_cluster_test.cc @@ -48,7 +48,7 @@ class LogicalDnsClusterTest : public Event::TestUsingSimulatedTime, public testi resolve_timer_ = new Event::MockTimer(&dispatcher_); NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/original_dst_cluster_test.cc b/test/common/upstream/original_dst_cluster_test.cc index 369f4c19d01d2..6fc86b2e056a8 100644 --- a/test/common/upstream/original_dst_cluster_test.cc +++ b/test/common/upstream/original_dst_cluster_test.cc @@ -75,7 +75,7 @@ class OriginalDstClusterTest : public Event::TestUsingSimulatedTime, public test void setup(const envoy::config::cluster::v3::Cluster& cluster_config) { NiceMock cm; - Envoy::Stats::ScopeSharedPtr scope = stats_store_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_store_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( diff --git a/test/common/upstream/subset_lb_test.cc b/test/common/upstream/subset_lb_test.cc index b925294c25394..133d15cacba90 100644 --- a/test/common/upstream/subset_lb_test.cc +++ b/test/common/upstream/subset_lb_test.cc @@ -481,7 +481,7 @@ class SubsetLoadBalancerTest : public Event::TestUsingSimulatedTime, NiceMock runtime_; NiceMock random_; Stats::IsolatedStoreImpl stats_store_; - Stats::ScopeSharedPtr scope_; + Stats::ScopePtr scope_; ClusterStatNames stat_names_; ClusterStats stats_; PrioritySetImpl local_priority_set_; diff --git a/test/common/upstream/transport_socket_matcher_test.cc b/test/common/upstream/transport_socket_matcher_test.cc index 88d200f4e1404..4a3f8af0690c9 100644 --- a/test/common/upstream/transport_socket_matcher_test.cc +++ b/test/common/upstream/transport_socket_matcher_test.cc @@ -107,7 +107,7 @@ class TransportSocketMatcherTest : public testing::Test { NiceMock mock_factory_context_; Network::TransportSocketFactoryPtr mock_default_factory_; Stats::IsolatedStoreImpl stats_store_; - Stats::ScopeSharedPtr stats_scope_; + Stats::ScopePtr stats_scope_; }; TEST_F(TransportSocketMatcherTest, ReturnDefaultSocketFactoryWhenNoMatch) { diff --git a/test/common/upstream/upstream_impl_test.cc b/test/common/upstream/upstream_impl_test.cc index f66ce7daa6b97..a52916f4ef471 100644 --- a/test/common/upstream/upstream_impl_test.cc +++ b/test/common/upstream/upstream_impl_test.cc @@ -190,7 +190,7 @@ TEST_P(StrictDnsParamTest, ImmediateResolve) { return nullptr; })); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -224,7 +224,7 @@ TEST_F(StrictDnsClusterImplTest, ZeroHostsIsInializedImmediately) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -259,7 +259,7 @@ TEST_F(StrictDnsClusterImplTest, ZeroHostsHealthChecker) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -305,7 +305,7 @@ TEST_F(StrictDnsClusterImplTest, DontWaitForDNSOnInit) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -380,7 +380,7 @@ TEST_F(StrictDnsClusterImplTest, Basic) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -536,7 +536,7 @@ TEST_F(StrictDnsClusterImplTest, HostRemovalActiveHealthSkipped) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -597,7 +597,7 @@ TEST_F(StrictDnsClusterImplTest, HostRemovalAfterHcFail) { ResolverData resolver(*dns_resolver_, dispatcher_); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -724,7 +724,7 @@ TEST_F(StrictDnsClusterImplTest, LoadAssignmentBasic) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -962,7 +962,7 @@ TEST_F(StrictDnsClusterImplTest, LoadAssignmentBasicMultiplePriorities) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1078,7 +1078,7 @@ TEST_F(StrictDnsClusterImplTest, CustomResolverFails) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -1113,7 +1113,7 @@ TEST_F(StrictDnsClusterImplTest, FailureRefreshRateBackoffResetsWhenSuccessHappe )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1162,7 +1162,7 @@ TEST_F(StrictDnsClusterImplTest, TtlAsDnsRefreshRate) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1242,7 +1242,7 @@ TEST_F(StrictDnsClusterImplTest, Http2UserDefinedSettingsParametersValidation) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1470,7 +1470,7 @@ TEST_F(StaticClusterImplTest, InitialHosts) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1505,7 +1505,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentEmptyHostname) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1540,7 +1540,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentNonEmptyHostname) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1575,7 +1575,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentNonEmptyHostnameWithHealthChecks) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1628,7 +1628,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentMultiplePriorities) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1673,7 +1673,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentLocality) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1719,7 +1719,7 @@ TEST_F(StaticClusterImplTest, LoadAssignmentEdsHealth) { NiceMock cm; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1751,7 +1751,7 @@ TEST_F(StaticClusterImplTest, AltStatName) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1781,7 +1781,7 @@ TEST_F(StaticClusterImplTest, RingHash) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1819,7 +1819,7 @@ TEST_F(StaticClusterImplTest, RoundRobinWithSlowStart) { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1861,7 +1861,7 @@ TEST_F(StaticClusterImplTest, LeastRequestWithSlowStart) { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1901,7 +1901,7 @@ TEST_F(StaticClusterImplTest, OutlierDetector) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -1959,7 +1959,7 @@ TEST_F(StaticClusterImplTest, HealthyStat) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2100,7 +2100,7 @@ TEST_F(StaticClusterImplTest, UrlConfig) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2152,7 +2152,7 @@ TEST_F(StaticClusterImplTest, UnsupportedLBType) { EXPECT_THROW_WITH_REGEX( { envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); @@ -2195,7 +2195,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2240,7 +2240,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithOtherLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2283,7 +2283,7 @@ TEST_F(StaticClusterImplTest, LoadBalancingPolicyWithoutLbPolicy) { Registry::InjectFactory registered_factory(factory); envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2313,7 +2313,7 @@ TEST_F(StaticClusterImplTest, MalformedHostIP) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2341,7 +2341,7 @@ TEST_F(StaticClusterImplTest, NoHostsTest) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format("cluster.{}.", cluster_config.name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2360,7 +2360,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { { // If the cluster manager gets a source address from the bootstrap proto, use it. cm_.bind_config_.mutable_source_address()->set_address("1.2.3.5"); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2373,7 +2373,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { config.mutable_upstream_bind_config()->mutable_source_address()->set_address(cluster_address); { // Verify source address from cluster config is used when present. - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2385,7 +2385,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { { // The source address from cluster config takes precedence over one from the bootstrap proto. cm_.bind_config_.mutable_source_address()->set_address("1.2.3.5"); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", config.alt_stat_name().empty() ? config.name() : config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( admin_, ssl_context_manager_, *scope, cm_, local_info_, dispatcher_, stats_, @@ -2409,7 +2409,7 @@ TEST_F(StaticClusterImplTest, LedsUnsupported) { )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2445,7 +2445,7 @@ TEST_F(ClusterImplTest, CloseConnectionsOnHostHealthFailure) { port_value: 443 )EOF"; envoy::config::cluster::v3::Cluster cluster_config = parseClusterFromV3Yaml(yaml); - Envoy::Stats::ScopeSharedPtr scope = stats_.createScope(fmt::format( + Envoy::Stats::ScopePtr scope = stats_.createScope(fmt::format( "cluster.{}.", cluster_config.alt_stat_name().empty() ? cluster_config.name() : cluster_config.alt_stat_name())); Envoy::Server::Configuration::TransportSocketFactoryContextImpl factory_context( @@ -2683,7 +2683,7 @@ class ClusterInfoImplTest : public testing::Test { NiceMock tls_; ReadyWatcher initialized_; envoy::config::cluster::v3::Cluster cluster_config_; - Envoy::Stats::ScopeSharedPtr scope_; + Envoy::Stats::ScopePtr scope_; std::unique_ptr factory_context_; NiceMock validation_visitor_; Api::ApiPtr api_; From 950275535b24fc6447670b076177a63d4307fe19 Mon Sep 17 00:00:00 2001 From: Joshua Marantz Date: Sun, 20 Feb 2022 22:00:54 -0500 Subject: [PATCH 7/7] server/... only name-change Signed-off-by: Joshua Marantz --- source/server/admin/admin.cc | 2 +- source/server/admin/admin.h | 6 +++--- source/server/api_listener_impl.h | 4 ++-- source/server/config_validation/admin.cc | 2 +- source/server/config_validation/admin.h | 2 +- source/server/filter_chain_manager_impl.h | 4 ++-- source/server/lds_api.h | 2 +- source/server/listener_impl.h | 4 ++-- source/server/listener_manager_impl.h | 2 +- source/server/server.h | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source/server/admin/admin.cc b/source/server/admin/admin.cc index 0deea69b0d197..63017443efcc3 100644 --- a/source/server/admin/admin.cc +++ b/source/server/admin/admin.cc @@ -120,7 +120,7 @@ void AdminImpl::startHttpListener(const std::list& const std::string& address_out_path, Network::Address::InstanceConstSharedPtr address, const Network::Socket::OptionsSharedPtr& socket_options, - Stats::ScopePtr&& listener_scope) { + Stats::ScopeSharedPtr&& listener_scope) { for (const auto& access_log : access_logs) { access_logs_.emplace_back(access_log); } diff --git a/source/server/admin/admin.h b/source/server/admin/admin.h index 15f1e8f5f1b18..0eccd8c349212 100644 --- a/source/server/admin/admin.h +++ b/source/server/admin/admin.h @@ -93,7 +93,7 @@ class AdminImpl : public Admin, const std::string& address_out_path, Network::Address::InstanceConstSharedPtr address, const Network::Socket::OptionsSharedPtr& socket_options, - Stats::ScopePtr&& listener_scope) override; + Stats::ScopeSharedPtr&& listener_scope) override; uint32_t concurrency() const override { return server_.options().concurrency(); } // Network::FilterChainManager @@ -370,7 +370,7 @@ class AdminImpl : public Admin, class AdminListener : public Network::ListenerConfig { public: - AdminListener(AdminImpl& parent, Stats::ScopePtr&& listener_scope) + AdminListener(AdminImpl& parent, Stats::ScopeSharedPtr&& listener_scope) : parent_(parent), name_("admin"), scope_(std::move(listener_scope)), stats_(Http::ConnectionManagerImpl::generateListenerStats("http.admin.", *scope_)), init_manager_(nullptr), ignore_global_conn_limit_(parent.ignore_global_conn_limit_) {} @@ -409,7 +409,7 @@ class AdminImpl : public Admin, AdminImpl& parent_; const std::string name_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; Http::ConnectionManagerListenerStats stats_; Network::NopConnectionBalancerImpl connection_balancer_; BasicResourceLimitImpl open_connections_; diff --git a/source/server/api_listener_impl.h b/source/server/api_listener_impl.h index 0cf13c6f16749..d96c8b4422680 100644 --- a/source/server/api_listener_impl.h +++ b/source/server/api_listener_impl.h @@ -180,8 +180,8 @@ class ApiListenerImplBase : public ApiListener, ListenerManagerImpl& parent_; const std::string name_; Network::Address::InstanceConstSharedPtr address_; - Stats::ScopePtr global_scope_; - Stats::ScopePtr listener_scope_; + Stats::ScopeSharedPtr global_scope_; + Stats::ScopeSharedPtr listener_scope_; FactoryContextImpl factory_context_; SyntheticReadCallbacks read_callbacks_; }; diff --git a/source/server/config_validation/admin.cc b/source/server/config_validation/admin.cc index 981ba4eab1da8..7d8de4ee819b8 100644 --- a/source/server/config_validation/admin.cc +++ b/source/server/config_validation/admin.cc @@ -22,7 +22,7 @@ void ValidationAdmin::startHttpListener(const std::list is_draining_{false}; }; diff --git a/source/server/lds_api.h b/source/server/lds_api.h index 05a4db0a29f56..72d441b80164a 100644 --- a/source/server/lds_api.h +++ b/source/server/lds_api.h @@ -47,7 +47,7 @@ class LdsApiImpl : public LdsApi, Config::SubscriptionPtr subscription_; std::string system_version_info_; ListenerManager& listener_manager_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; Upstream::ClusterManager& cm_; Init::TargetImpl init_target_; }; diff --git a/source/server/listener_impl.h b/source/server/listener_impl.h index da83dc5ff6878..cd858d6aaeebe 100644 --- a/source/server/listener_impl.h +++ b/source/server/listener_impl.h @@ -156,8 +156,8 @@ class ListenerFactoryContextBaseImpl final : public Configuration::FactoryContex const Envoy::Config::TypedMetadataImpl typed_metadata_; envoy::config::core::v3::TrafficDirection direction_; - Stats::ScopePtr global_scope_; - Stats::ScopePtr listener_scope_; // Stats with listener named scope. + Stats::ScopeSharedPtr global_scope_; + Stats::ScopeSharedPtr listener_scope_; // Stats with listener named scope. ProtobufMessage::ValidationVisitor& validation_visitor_; const Server::DrainManagerPtr drain_manager_; bool is_quic_; diff --git a/source/server/listener_manager_impl.h b/source/server/listener_manager_impl.h index 5711a988bd0ed..e6d93f80074cc 100644 --- a/source/server/listener_manager_impl.h +++ b/source/server/listener_manager_impl.h @@ -318,7 +318,7 @@ class ListenerManagerImpl : public ListenerManager, Logger::Loggable workers_; bool workers_started_{}; absl::optional stop_listeners_type_; - Stats::ScopePtr scope_; + Stats::ScopeSharedPtr scope_; ListenerManagerStats stats_; ConfigTracker::EntryOwnerPtr config_tracker_entry_; LdsApiPtr lds_api_; diff --git a/source/server/server.h b/source/server/server.h index 29f4944f74d41..eada46f57435e 100644 --- a/source/server/server.h +++ b/source/server/server.h @@ -216,7 +216,7 @@ class ServerFactoryContextImpl : public Configuration::ServerFactoryContext, private: Instance& server_; - Stats::ScopePtr server_scope_; + Stats::ScopeSharedPtr server_scope_; }; /**