diff --git a/changelogs/unreleased/6297-rajatvig-small.md b/changelogs/unreleased/6297-rajatvig-small.md new file mode 100644 index 00000000000..b62c0e8b429 --- /dev/null +++ b/changelogs/unreleased/6297-rajatvig-small.md @@ -0,0 +1 @@ +Added support for enabling circuit breaker statistics tracking. diff --git a/internal/envoy/v3/bootstrap.go b/internal/envoy/v3/bootstrap.go index 2552dee7602..a70d3268c8f 100644 --- a/internal/envoy/v3/bootstrap.go +++ b/internal/envoy/v3/bootstrap.go @@ -219,12 +219,14 @@ func bootstrapConfig(c *envoy.BootstrapConfig) *envoy_config_bootstrap_v3.Bootst MaxPendingRequests: wrapperspb.UInt32(100000), MaxRequests: wrapperspb.UInt32(60000000), MaxRetries: wrapperspb.UInt32(50), + TrackRemaining: true, }, { Priority: envoy_config_core_v3.RoutingPriority_DEFAULT, MaxConnections: wrapperspb.UInt32(100000), MaxPendingRequests: wrapperspb.UInt32(100000), MaxRequests: wrapperspb.UInt32(60000000), MaxRetries: wrapperspb.UInt32(50), + TrackRemaining: true, }}, }, }, { diff --git a/internal/envoy/v3/bootstrap_test.go b/internal/envoy/v3/bootstrap_test.go index 2012179f900..cc1c9a9fd87 100644 --- a/internal/envoy/v3/bootstrap_test.go +++ b/internal/envoy/v3/bootstrap_test.go @@ -74,13 +74,15 @@ func TestBootstrap(t *testing.T) { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true }, { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true } ] }, @@ -253,13 +255,15 @@ func TestBootstrap(t *testing.T) { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true }, { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true } ] }, @@ -432,13 +436,15 @@ func TestBootstrap(t *testing.T) { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true }, { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true } ] }, @@ -612,13 +618,15 @@ func TestBootstrap(t *testing.T) { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true }, { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true } ] }, @@ -792,13 +800,15 @@ func TestBootstrap(t *testing.T) { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true }, { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true } ] }, @@ -972,13 +982,15 @@ func TestBootstrap(t *testing.T) { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true }, { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true } ] }, @@ -1153,13 +1165,15 @@ func TestBootstrap(t *testing.T) { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true }, { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true } ] }, @@ -1336,13 +1350,15 @@ func TestBootstrap(t *testing.T) { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true }, { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true } ] }, @@ -1553,13 +1569,15 @@ func TestBootstrap(t *testing.T) { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true }, { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true } ] }, @@ -1810,13 +1828,15 @@ func TestBootstrap(t *testing.T) { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true }, { "max_connections": 100000, "max_pending_requests": 100000, "max_requests": 60000000, - "max_retries": 50 + "max_retries": 50, + "track_remaining": true } ] }, diff --git a/internal/envoy/v3/cluster.go b/internal/envoy/v3/cluster.go index 8a388799b06..40fe15afd52 100644 --- a/internal/envoy/v3/cluster.go +++ b/internal/envoy/v3/cluster.go @@ -86,9 +86,11 @@ func Cluster(c *dag.Cluster) *envoy_config_cluster_v3.Cluster { MaxPendingRequests: protobuf.UInt32OrNil(service.MaxPendingRequests), MaxRequests: protobuf.UInt32OrNil(service.MaxRequests), MaxRetries: protobuf.UInt32OrNil(service.MaxRetries), + TrackRemaining: true, }}, PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ MaxConnections: protobuf.UInt32OrNil(service.PerHostMaxConnections), + TrackRemaining: true, }}, } } diff --git a/internal/envoy/v3/cluster_test.go b/internal/envoy/v3/cluster_test.go index 79ea1525873..ff6bf79a012 100644 --- a/internal/envoy/v3/cluster_test.go +++ b/internal/envoy/v3/cluster_test.go @@ -427,8 +427,11 @@ func TestCluster(t *testing.T) { CircuitBreakers: &envoy_config_cluster_v3.CircuitBreakers{ Thresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ MaxConnections: wrapperspb.UInt32(9000), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }, }, @@ -456,8 +459,11 @@ func TestCluster(t *testing.T) { CircuitBreakers: &envoy_config_cluster_v3.CircuitBreakers{ Thresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ MaxPendingRequests: wrapperspb.UInt32(4096), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }, }, @@ -484,9 +490,12 @@ func TestCluster(t *testing.T) { }, CircuitBreakers: &envoy_config_cluster_v3.CircuitBreakers{ Thresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ - MaxRequests: wrapperspb.UInt32(404), + MaxRequests: wrapperspb.UInt32(404), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }, }, @@ -513,9 +522,12 @@ func TestCluster(t *testing.T) { }, CircuitBreakers: &envoy_config_cluster_v3.CircuitBreakers{ Thresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ - MaxRetries: wrapperspb.UInt32(7), + MaxRetries: wrapperspb.UInt32(7), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }, }, @@ -541,9 +553,12 @@ func TestCluster(t *testing.T) { ServiceName: "default/kuard/http", }, CircuitBreakers: &envoy_config_cluster_v3.CircuitBreakers{ - Thresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, + Thresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, + }}, PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ MaxConnections: wrapperspb.UInt32(45), + TrackRemaining: true, }}, }, }, diff --git a/internal/featuretests/v3/cluster_test.go b/internal/featuretests/v3/cluster_test.go index 6569461cf04..ff4eb77c07d 100644 --- a/internal/featuretests/v3/cluster_test.go +++ b/internal/featuretests/v3/cluster_test.go @@ -461,9 +461,11 @@ func TestClusterCircuitbreakerAnnotationsIngress(t *testing.T) { MaxPendingRequests: wrapperspb.UInt32(4096), MaxRequests: wrapperspb.UInt32(404), MaxRetries: wrapperspb.UInt32(7), + TrackRemaining: true, }}, PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ MaxConnections: wrapperspb.UInt32(45), + TrackRemaining: true, }}, }, }), @@ -497,8 +499,11 @@ func TestClusterCircuitbreakerAnnotationsIngress(t *testing.T) { MaxConnections: wrapperspb.UInt32(13), MaxRequests: wrapperspb.UInt32(15), MaxRetries: wrapperspb.UInt32(17), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }), ), @@ -531,8 +536,11 @@ func TestClusterCircuitbreakerAnnotationsIngress(t *testing.T) { MaxPendingRequests: wrapperspb.UInt32(14), MaxRequests: wrapperspb.UInt32(15), MaxRetries: wrapperspb.UInt32(17), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }), ), @@ -597,8 +605,11 @@ func TestClusterCircuitbreakerAnnotationsHTTPProxy(t *testing.T) { MaxPendingRequests: wrapperspb.UInt32(4096), MaxRequests: wrapperspb.UInt32(404), MaxRetries: wrapperspb.UInt32(7), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }), ), @@ -631,8 +642,11 @@ func TestClusterCircuitbreakerAnnotationsHTTPProxy(t *testing.T) { MaxConnections: wrapperspb.UInt32(13), MaxRequests: wrapperspb.UInt32(15), MaxRetries: wrapperspb.UInt32(17), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }), ), @@ -665,8 +679,11 @@ func TestClusterCircuitbreakerAnnotationsHTTPProxy(t *testing.T) { MaxPendingRequests: wrapperspb.UInt32(14), MaxRequests: wrapperspb.UInt32(15), MaxRetries: wrapperspb.UInt32(17), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }), ), @@ -774,8 +791,11 @@ func TestClusterCircuitbreakerAnnotationsGateway(t *testing.T) { MaxPendingRequests: wrapperspb.UInt32(4096), MaxRequests: wrapperspb.UInt32(404), MaxRetries: wrapperspb.UInt32(7), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }), ), @@ -808,8 +828,11 @@ func TestClusterCircuitbreakerAnnotationsGateway(t *testing.T) { MaxConnections: wrapperspb.UInt32(13), MaxRequests: wrapperspb.UInt32(15), MaxRetries: wrapperspb.UInt32(17), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }), ), @@ -842,8 +865,11 @@ func TestClusterCircuitbreakerAnnotationsGateway(t *testing.T) { MaxPendingRequests: wrapperspb.UInt32(14), MaxRequests: wrapperspb.UInt32(15), MaxRetries: wrapperspb.UInt32(17), + TrackRemaining: true, + }}, + PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ + TrackRemaining: true, }}, - PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{}}, }, }), ), diff --git a/internal/xdscache/v3/cluster_test.go b/internal/xdscache/v3/cluster_test.go index fca970072af..585c3bfea57 100644 --- a/internal/xdscache/v3/cluster_test.go +++ b/internal/xdscache/v3/cluster_test.go @@ -772,9 +772,11 @@ func TestClusterVisit(t *testing.T) { MaxPendingRequests: wrapperspb.UInt32(4096), MaxRequests: wrapperspb.UInt32(404), MaxRetries: wrapperspb.UInt32(7), + TrackRemaining: true, }}, PerHostThresholds: []*envoy_config_cluster_v3.CircuitBreakers_Thresholds{{ MaxConnections: wrapperspb.UInt32(45), + TrackRemaining: true, }}, }, },