@@ -133,7 +133,7 @@ PerPacketLoadBalancingUdpProxyFilter::onDataInternal(Network::UdpRecvData& data)
133
133
auto host = cluster->chooseHost (data.addresses_ .peer_ , nullptr );
134
134
if (host == nullptr ) {
135
135
ENVOY_LOG (debug, " cannot find any valid host." );
136
- cluster->cluster_ . info () ->trafficStats ()->upstream_cx_none_healthy_ .inc ();
136
+ cluster->cluster_info_ ->trafficStats ()->upstream_cx_none_healthy_ .inc ();
137
137
return Network::FilterStatus::StopIteration;
138
138
}
139
139
@@ -204,7 +204,7 @@ void UdpProxyFilter::removeSession(ActiveSession* session) {
204
204
UdpProxyFilter::ClusterInfo::ClusterInfo (UdpProxyFilter& filter,
205
205
Upstream::ThreadLocalCluster& cluster,
206
206
absl::flat_hash_set<ActiveSession*>&& sessions)
207
- : filter_(filter), cluster_(cluster),
207
+ : filter_(filter), cluster_(cluster), cluster_info_(cluster.info()),
208
208
cluster_stats_(generateStats(cluster.info()->statsScope())), sessions_(std::move(sessions)),
209
209
member_update_cb_handle_(cluster.prioritySet().addMemberUpdateCb(
210
210
[this ](const Upstream::HostVector&, const Upstream::HostVector& hosts_removed) {
@@ -269,7 +269,7 @@ UdpProxyFilter::createSession(Network::UdpRecvData::LocalPeerAddresses&& address
269
269
auto host = cluster->chooseHost (addresses.peer_ , nullptr );
270
270
if (host == nullptr ) {
271
271
ENVOY_LOG (debug, " cannot find any valid host." );
272
- cluster->cluster_ . info () ->trafficStats ()->upstream_cx_none_healthy_ .inc ();
272
+ cluster->cluster_info_ ->trafficStats ()->upstream_cx_none_healthy_ .inc ();
273
273
return nullptr ;
274
274
}
275
275
@@ -345,8 +345,7 @@ void UdpProxyFilter::ActiveSession::onSessionComplete() {
345
345
346
346
filter_.config_ ->stats ().downstream_sess_active_ .dec ();
347
347
if (cluster_connections_inc_) {
348
- cluster_->cluster_ .info ()
349
- ->resourceManager (Upstream::ResourcePriority::Default)
348
+ cluster_->cluster_info_ ->resourceManager (Upstream::ResourcePriority::Default)
350
349
.connections ()
351
350
.dec ();
352
351
}
@@ -385,7 +384,7 @@ void UdpProxyFilter::ActiveSession::fillSessionStreamInfo() {
385
384
ProtobufWkt::Struct stats_obj;
386
385
auto & fields_map = *stats_obj.mutable_fields ();
387
386
if (cluster_ != nullptr ) {
388
- fields_map[" cluster_name" ] = ValueUtil::stringValue (cluster_->cluster_ . info () ->name ());
387
+ fields_map[" cluster_name" ] = ValueUtil::stringValue (cluster_->cluster_info_ ->name ());
389
388
}
390
389
fields_map[" bytes_sent" ] = ValueUtil::numberValue (session_stats_.downstream_sess_tx_bytes_ );
391
390
fields_map[" bytes_received" ] = ValueUtil::numberValue (session_stats_.downstream_sess_rx_bytes_ );
@@ -551,7 +550,7 @@ void UdpProxyFilter::UdpActiveSession::writeUpstream(Network::UdpRecvData& data)
551
550
cluster_->cluster_stats_ .sess_tx_errors_ .inc ();
552
551
} else {
553
552
cluster_->cluster_stats_ .sess_tx_datagrams_ .inc ();
554
- cluster_->cluster_ . info () ->trafficStats ()->upstream_cx_tx_bytes_total_ .add (tx_buffer_length);
553
+ cluster_->cluster_info_ ->trafficStats ()->upstream_cx_tx_bytes_total_ .add (tx_buffer_length);
555
554
}
556
555
}
557
556
@@ -592,7 +591,7 @@ bool UdpProxyFilter::UdpActiveSession::createUpstream() {
592
591
host_ = cluster_->chooseHost (addresses_.peer_ , &udp_session_info_);
593
592
if (host_ == nullptr ) {
594
593
ENVOY_LOG (debug, " cannot find any valid host." );
595
- cluster_->cluster_ . info () ->trafficStats ()->upstream_cx_none_healthy_ .inc ();
594
+ cluster_->cluster_info_ ->trafficStats ()->upstream_cx_none_healthy_ .inc ();
596
595
return false ;
597
596
}
598
597
}
@@ -687,7 +686,7 @@ void UdpProxyFilter::UdpActiveSession::processPacket(
687
686
host_ != nullptr ? host_->address ()->asStringView () : " unknown" );
688
687
689
688
cluster_->cluster_stats_ .sess_rx_datagrams_ .inc ();
690
- cluster_->cluster_ . info () ->trafficStats ()->upstream_cx_rx_bytes_total_ .add (rx_buffer_length);
689
+ cluster_->cluster_info_ ->trafficStats ()->upstream_cx_rx_bytes_total_ .add (rx_buffer_length);
691
690
692
691
Network::UdpRecvData recv_data{{std::move (local_address), std::move (peer_address)},
693
692
std::move (buffer),
@@ -784,20 +783,16 @@ bool UdpProxyFilter::ActiveSession::setClusterInfo() {
784
783
return false ;
785
784
}
786
785
787
- if (!cluster_->cluster_ .info ()
788
- ->resourceManager (Upstream::ResourcePriority::Default)
786
+ if (!cluster_->cluster_info_ ->resourceManager (Upstream::ResourcePriority::Default)
789
787
.connections ()
790
788
.canCreate ()) {
791
789
ENVOY_LOG (debug, " cannot create new connection." );
792
790
udp_session_info_.setResponseFlag (StreamInfo::CoreResponseFlag::UpstreamOverflow);
793
- cluster_->cluster_ . info () ->trafficStats ()->upstream_cx_overflow_ .inc ();
791
+ cluster_->cluster_info_ ->trafficStats ()->upstream_cx_overflow_ .inc ();
794
792
return false ;
795
793
}
796
794
797
- cluster_->cluster_ .info ()
798
- ->resourceManager (Upstream::ResourcePriority::Default)
799
- .connections ()
800
- .inc ();
795
+ cluster_->cluster_info_ ->resourceManager (Upstream::ResourcePriority::Default).connections ().inc ();
801
796
802
797
cluster_connections_inc_ = true ;
803
798
return true ;
@@ -1003,21 +998,20 @@ bool UdpProxyFilter::TunnelingActiveSession::createConnectionPool() {
1003
998
1004
999
// Check this here because the TCP conn pool will queue our request waiting for a connection that
1005
1000
// will never be released.
1006
- if (!cluster_->cluster_ .info ()
1007
- ->resourceManager (Upstream::ResourcePriority::Default)
1001
+ if (!cluster_->cluster_info_ ->resourceManager (Upstream::ResourcePriority::Default)
1008
1002
.connections ()
1009
1003
.canCreate ()) {
1010
1004
udp_session_info_.setResponseFlag (StreamInfo::CoreResponseFlag::UpstreamOverflow);
1011
- cluster_->cluster_ . info () ->trafficStats ()->upstream_cx_overflow_ .inc ();
1005
+ cluster_->cluster_info_ ->trafficStats ()->upstream_cx_overflow_ .inc ();
1012
1006
return false ;
1013
1007
}
1014
1008
1015
1009
if (connect_attempts_ >= filter_.config_ ->tunnelingConfig ()->maxConnectAttempts ()) {
1016
1010
udp_session_info_.setResponseFlag (StreamInfo::CoreResponseFlag::UpstreamRetryLimitExceeded);
1017
- cluster_->cluster_ . info () ->trafficStats ()->upstream_cx_connect_attempts_exceeded_ .inc ();
1011
+ cluster_->cluster_info_ ->trafficStats ()->upstream_cx_connect_attempts_exceeded_ .inc ();
1018
1012
return false ;
1019
1013
} else if (connect_attempts_ >= 1 ) {
1020
- cluster_->cluster_ . info () ->trafficStats ()->upstream_rq_retry_ .inc ();
1014
+ cluster_->cluster_info_ ->trafficStats ()->upstream_rq_retry_ .inc ();
1021
1015
}
1022
1016
1023
1017
conn_pool_ = conn_pool_factory_->createConnPool (cluster_->cluster_ , load_balancer_context_.get (),
@@ -1170,7 +1164,7 @@ void UdpProxyFilter::TunnelingActiveSession::onUpstreamData(Buffer::Instance& da
1170
1164
1171
1165
ASSERT (cluster_);
1172
1166
cluster_->cluster_stats_ .sess_rx_datagrams_ .inc ();
1173
- cluster_->cluster_ . info () ->trafficStats ()->upstream_cx_rx_bytes_total_ .add (rx_buffer_length);
1167
+ cluster_->cluster_info_ ->trafficStats ()->upstream_cx_rx_bytes_total_ .add (rx_buffer_length);
1174
1168
resetIdleTimer ();
1175
1169
1176
1170
Network::UdpRecvData recv_data{{addresses_.local_ , addresses_.peer_ },
0 commit comments