Registry::FactoryRegistry<Server::Configuration::NamedNetworkFilterConfigFactory>::getFactory(
Registry::FactoryRegistry<Server::Configuration::NamedHttpFilterConfigFactory>::getFactory(
Registry::FactoryRegistry<Server::Configuration::ProtocolOptionsFactory>::getFactory(name);
// in the process (i.e., on a mobile client). Some OSes support handling it at the socket layer:
upstream_local_address.socket_options_ = std::make_shared<Network::ConnectionSocket::Options>();
local_address.socket_options_ = std::make_shared<::Envoy::Network::ConnectionSocket::Options>();
::Envoy::Network::Socket::appendOptions(local_address.socket_options_, base_socket_options);
const envoy::config::core::v3::TypedExtensionConfig* const local_address_selector_config =
envoy::config::upstream::local_address_selector::v3::DefaultLocalAddressSelector default_config;
// TODO(pianiststickman): this implementation takes a lock on the hot path and puts a copy of the
// stat name into every host that receives a copy of that metric. This can be improved by putting
// a single copy of the stat name into a thread-local key->index map so that the lock can be avoided
Network::Address::InstanceConstSharedPtr dest_address, MetadataConstSharedPtr endpoint_metadata,
Network::Address::InstanceConstSharedPtr dest_address, MetadataConstSharedPtr endpoint_metadata,
: HostDescriptionImplBase(cluster, hostname, dest_address, endpoint_metadata, locality_metadata,
Network::Address::InstanceConstSharedPtr dest_address, MetadataConstSharedPtr endpoint_metadata,
if (health_check_config.port_value() != 0 && dest_address->type() != Network::Address::Type::Ip) {
const Network::Address::InstanceConstSharedPtr& address, const AddressVector& address_list) {
Network::UpstreamTransportSocketFactory& HostDescriptionImplBase::resolveTransportSocketFactory(
return createConnection(dispatcher, cluster(), address(), addressListOrNull(), factory, options,
void HostImplBase::setEdsHealthFlag(envoy::config::core::v3::HealthStatus health_status) {
absl::optional<Network::Address::InstanceConstSharedPtr> HostImplBase::maybeGetProxyRedirectAddress(
if (transport_socket_options && transport_socket_options->http11ProxyInfo().has_value()) {
degraded_hosts_per_locality_ = std::move(update_hosts_params.degraded_hosts_per_locality);
excluded_hosts_per_locality_ = std::move(update_hosts_params.excluded_hosts_per_locality);
HostSetImplPtr host_set = createHostSet(i, weighted_priority_health, overprovisioning_factor);
// We wrap the update call with a lambda that tracks all the hosts that have been added/removed.
HostVector net_hosts_removed = filterHosts(scope.all_hosts_removed_, scope.all_hosts_added_);
parent_.updateHosts(priority, std::move(update_hosts_params), locality_weights, hosts_added,
void MainPrioritySetImpl::updateHosts(uint32_t priority, UpdateHostsParams&& update_hosts_params,
mutable_cross_priority_host_map_ = std::make_shared<HostMap>(*const_cross_priority_host_map_);
if (config.protocol_selection() == envoy::config::cluster::v3::Cluster::USE_CONFIGURED_PROTOCOL) {
Server::Configuration::ServerFactoryContext& factory_context, const ClusterProto& cluster) {
Server::Configuration::ServerFactoryContext& factory_context, const ClusterProto& cluster) {
stats_scope_, factory_context.serverFactoryContext().clusterManager().clusterStatNames(),
PROTOBUF_GET_WRAPPED_OR_DEFAULT(config, per_connection_buffer_limit_bytes, 1024 * 1024)),
config.upstream_connection_options().set_local_interface_name_on_upstream_connections()),
// Both LoadStatsReporter interface implementations and per_endpoint_stats need to `latch()` the
http_protocol_options_->common_http_protocol_options_.has_max_requests_per_connection()) {
config.lb_policy() == envoy::config::cluster::v3::Cluster::LOAD_BALANCING_POLICY_CONFIG) {
absl::optional<std::chrono::milliseconds> tcp_pool_idle_timeout(std::chrono::minutes(10));
optional_timeouts_.set<OptionalTimeoutNames::TcpPoolIdleTimeout>(*tcp_pool_idle_timeout);
if (http_protocol_options_->common_http_protocol_options_.has_max_connection_duration()) {
optional_timeouts_.set<OptionalTimeoutNames::MaxConnectionDuration>(*max_connection_duration);
ClusterInfoImpl::upstreamHttpProtocol(absl::optional<Http::Protocol> downstream_protocol) const {
ClusterInfoImpl::processHttpForOutlierDetection(Http::ResponseHeaderMap& headers) const {
http_protocol_options_->outlier_detection_http_error_matcher_[0]->onHttpResponseHeaders(headers,
return absl::optional<bool>(http_protocol_options_->outlier_detection_http_error_matcher_[0]
wait_for_warm_on_init_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(cluster, wait_for_warm_on_init, true)),
cluster_context.serverFactoryContext().clusterManager().localClusterName().value_or("") ==
auto socket_factory_or_error = createTransportSocketFactory(cluster, *transport_factory_context_);
creation_status = absl::InvalidArgumentError("HTTP3 configured but not enabled in the build.");
SET_AND_RETURN_IF_NOT_OK(parseDropOverloadConfig(cluster.load_assignment()), creation_status);
hosts.filter({[](const Host& host) { return host.coarseHealth() == Host::Health::Healthy; },
drop_ratio = std::min(drop_ratio, float(drop_ratio_runtime) / float(MAX_DROP_OVERLOAD_RUNTIME));
void ClusterImplBase::setOutlierDetector(const Outlier::DetectorSharedPtr& outlier_detector) {
// Every time a host changes Health Check state we cause a full healthy host recalculation which
HostsPerLocalityConstSharedPtr hosts_per_locality_copy = host_set->hostsPerLocality().clone();
auto make_gauge = [&stat_names, &scope, prefix](Stats::StatName stat_name) -> Stats::Gauge& {
std::pair<absl::optional<double>, absl::optional<uint32_t>> ClusterInfoImpl::getRetryBudgetParams(
[] { return std::make_shared<Filter::UpstreamNetworkFilterConfigProviderManagerImpl>(); });
std::tie(budget_percent, min_retry_concurrency) = ClusterInfoImpl::getRetryBudgetParams(*it);
runtime, runtime_prefix, max_connections, max_pending_requests, max_requests, max_retries,
if (locality_lb_endpoint.has_locality() && locality_lb_endpoint.has_load_balancing_weight()) {
const absl::optional<HostVector>& hosts_added, const absl::optional<HostVector>& hosts_removed,
priority_state_.size() > priority ? priority_state_[priority].second : empty_locality_map;
// TODO: have the load balancing extension indicate, programmatically, whether it needs locality
std::map<envoy::config::core::v3::Locality, HostVector, LocalityLess> hosts_per_locality;
std::make_shared<HostsPerLocalityImpl>(std::move(per_locality), non_empty_local_locality);
hosts_removed.value_or<HostVector>({}), weighted_priority_health, overprovisioning_factor);
// Go through and see if the list we have is different from what we just got. If it is, we make
const bool metadata_changed = host->metadataHash() != existing_host->second->metadataHash();
// a host from another priority into this one, so we should mark the priority as having changed.
auto address_or_error = Network::Address::resolveProtoAddress(health_check_config.address());