From 96d31c15ecbf10cb5414d62c6a2282ea95191154 Mon Sep 17 00:00:00 2001 From: "nastassia.dailidava" Date: Thu, 14 Mar 2024 20:28:20 +0100 Subject: [PATCH 1/3] #601 Added track_remaining setting --- .../servicemesh/envoycontrol/snapshot/SnapshotProperties.kt | 1 + .../snapshot/resource/clusters/EnvoyClustersFactory.kt | 1 + .../envoycontrol/ClusterCircuitBreakerDefaultSettingsTest.kt | 3 +++ 3 files changed, 5 insertions(+) diff --git a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotProperties.kt b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotProperties.kt index 913e8ba43..b85ffe283 100644 --- a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotProperties.kt +++ b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotProperties.kt @@ -323,6 +323,7 @@ class Threshold(var priority: String) { var maxPendingRequests = 1024 var maxRequests = 1024 var maxRetries = 3 + var trackRemaining = true } class Http2Properties { diff --git a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/clusters/EnvoyClustersFactory.kt b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/clusters/EnvoyClustersFactory.kt index f06ab030d..846b6381c 100644 --- a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/clusters/EnvoyClustersFactory.kt +++ b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/clusters/EnvoyClustersFactory.kt @@ -567,6 +567,7 @@ class EnvoyClustersFactory( "HIGH" -> thresholdsBuilder.priority = RoutingPriority.HIGH else -> thresholdsBuilder.priority = RoutingPriority.UNRECOGNIZED } + thresholdsBuilder.setTrackRemaining(threshold.trackRemaining) return thresholdsBuilder.build() } diff --git a/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/ClusterCircuitBreakerDefaultSettingsTest.kt b/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/ClusterCircuitBreakerDefaultSettingsTest.kt index 35e76a3ce..b7ba6abb4 100644 --- a/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/ClusterCircuitBreakerDefaultSettingsTest.kt +++ b/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/ClusterCircuitBreakerDefaultSettingsTest.kt @@ -27,6 +27,7 @@ internal class ClusterCircuitBreakerDefaultSettingsTest { it.maxPendingRequests = 6 it.maxRequests = 7 it.maxRetries = 8 + it.trackRemaining = true } ) @@ -59,9 +60,11 @@ internal class ClusterCircuitBreakerDefaultSettingsTest { // when val maxRequestsSetting = envoy.container.admin().circuitBreakerSetting("echo", "max_requests", "default_priority") val maxRetriesSetting = envoy.container.admin().circuitBreakerSetting("echo", "max_retries", "high_priority") + val remainingSetting = envoy.container.admin().statValue("cluster.echo.circuit_breakers.default.remaining_pending") // then assertThat(maxRequestsSetting).isEqualTo(3) assertThat(maxRetriesSetting).isEqualTo(8) + assertThat(remainingSetting).isNotNull() } } From 880d41299f3c8c746154650209b3ea9f196ad89c Mon Sep 17 00:00:00 2001 From: "nastassia.dailidava" Date: Fri, 15 Mar 2024 18:17:18 +0100 Subject: [PATCH 2/3] #601 Added track_remaining setting --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dc168411..f60061aa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Lists all changes with user impact. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). +## [0.20.12] +### Changed +- Added "trackRemaining" flag to enable possibility of tracking additional circuit breaker metrics +- ## [0.20.11] ### Changed - Implemented adding a header for locality weighted load balancing From 683458e73b74523699a852789094381ebef4dc32 Mon Sep 17 00:00:00 2001 From: "nastassia.dailidava" Date: Tue, 19 Mar 2024 12:29:48 +0100 Subject: [PATCH 3/3] #601 Added track_remaining setting --- .../ClusterCircuitBreakerDefaultSettingsTest.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/ClusterCircuitBreakerDefaultSettingsTest.kt b/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/ClusterCircuitBreakerDefaultSettingsTest.kt index b7ba6abb4..d9b35f66a 100644 --- a/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/ClusterCircuitBreakerDefaultSettingsTest.kt +++ b/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/ClusterCircuitBreakerDefaultSettingsTest.kt @@ -60,11 +60,13 @@ internal class ClusterCircuitBreakerDefaultSettingsTest { // when val maxRequestsSetting = envoy.container.admin().circuitBreakerSetting("echo", "max_requests", "default_priority") val maxRetriesSetting = envoy.container.admin().circuitBreakerSetting("echo", "max_retries", "high_priority") - val remainingSetting = envoy.container.admin().statValue("cluster.echo.circuit_breakers.default.remaining_pending") + val remainingPendingMetric = envoy.container.admin().statValue("cluster.echo.circuit_breakers.default.remaining_pending") + val remainingRqMetric = envoy.container.admin().statValue("cluster.echo.circuit_breakers.default.remaining_rq") // then assertThat(maxRequestsSetting).isEqualTo(3) assertThat(maxRetriesSetting).isEqualTo(8) - assertThat(remainingSetting).isNotNull() + assertThat(remainingPendingMetric).isNotNull() + assertThat(remainingRqMetric).isNotNull() } }