Skip to content

Commit

Permalink
enable circuit breaker statistics for tracking remaining (#6297)
Browse files Browse the repository at this point in the history
Added support for enabling circuit breaker statistics tracking.

Fixes 5794

Signed-off-by: Rajat Vig <rvig@etsy.com>
  • Loading branch information
rajatvig committed Apr 11, 2024
1 parent b7c7234 commit 6bdda0b
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 35 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/6297-rajatvig-small.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added support for enabling circuit breaker statistics tracking.
2 changes: 2 additions & 0 deletions internal/envoy/v3/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}},
},
}, {
Expand Down
60 changes: 40 additions & 20 deletions internal/envoy/v3/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
},
Expand Down Expand Up @@ -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
}
]
},
Expand Down Expand Up @@ -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
}
]
},
Expand Down Expand Up @@ -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
}
]
},
Expand Down Expand Up @@ -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
}
]
},
Expand Down Expand Up @@ -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
}
]
},
Expand Down Expand Up @@ -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
}
]
},
Expand Down Expand Up @@ -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
}
]
},
Expand Down Expand Up @@ -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
}
]
},
Expand Down Expand Up @@ -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
}
]
},
Expand Down
2 changes: 2 additions & 0 deletions internal/envoy/v3/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}},
}
}
Expand Down
29 changes: 22 additions & 7 deletions internal/envoy/v3/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{{}},
},
},
},
Expand Down Expand Up @@ -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{{}},
},
},
},
Expand All @@ -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{{}},
},
},
},
Expand All @@ -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{{}},
},
},
},
Expand All @@ -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,
}},
},
},
Expand Down
42 changes: 34 additions & 8 deletions internal/featuretests/v3/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}},
},
}),
Expand Down Expand Up @@ -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{{}},
},
}),
),
Expand Down Expand Up @@ -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{{}},
},
}),
),
Expand Down Expand Up @@ -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{{}},
},
}),
),
Expand Down Expand Up @@ -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{{}},
},
}),
),
Expand Down Expand Up @@ -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{{}},
},
}),
),
Expand Down Expand Up @@ -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{{}},
},
}),
),
Expand Down Expand Up @@ -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{{}},
},
}),
),
Expand Down Expand Up @@ -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{{}},
},
}),
),
Expand Down
Loading

0 comments on commit 6bdda0b

Please sign in to comment.