From 868ea71c914017ae6e8ceedfb0b3819a74d7cdec Mon Sep 17 00:00:00 2001 From: "nastassia.dailidava" Date: Mon, 16 Dec 2024 21:32:16 +0100 Subject: [PATCH 1/2] added log for empty load assignment --- .../envoycontrol/snapshot/EnvoySnapshotFactory.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt index 4e80857d7..3f8fb3a7b 100644 --- a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt +++ b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt @@ -337,7 +337,19 @@ class EnvoySnapshotFactory( val endpoints = getServicesEndpointsForGroup( group.proxySettings.incoming.rateLimitEndpoints, globalSnapshot, egressRouteSpecification - ) + ).also { e -> + val list = e.mapNotNull { el -> el.endpointsList.find { x -> x.lbEndpointsList.isEmpty() } } + val rPolicy = group.proxySettings.outgoing.defaultServiceSettings.routingPolicy + if (list.isNotEmpty() && + list.none { it.locality.zone.contains(properties.loadBalancing.trafficSplitting.zoneName) } && + rPolicy.autoServiceTag + ) { + logger.warn( + "Some of service ${group.serviceName} dependencies have ClusterLoadAssignment with empty " + + "lbEndpoints: $list, routingPolicy: $rPolicy, all endpoints: $e" + ) + } + } val version = snapshotsVersions.version(group, clusters, endpoints, listeners, routes) return createSnapshot( From 3d17671817d7130a1506a40b11d17ac13c43823d Mon Sep 17 00:00:00 2001 From: "nastassia.dailidava" Date: Wed, 18 Dec 2024 13:38:10 +0100 Subject: [PATCH 2/2] added log for empty load assignment --- .../snapshot/EnvoySnapshotFactory.kt | 41 +++++++++++-------- .../snapshot/SnapshotProperties.kt | 1 + 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt index 3f8fb3a7b..69dc4d637 100644 --- a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt +++ b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt @@ -280,9 +280,30 @@ class EnvoySnapshotFactory( // endpointsFactory.filterEndpoints() can use this cache to prevent computing the same // ClusterLoadAssignments many times - it may reduce MEM, CPU and latency if some serviceTags are // commonly used - endpointsFactory.filterEndpoints(endpoints, routeSpec.settings.routingPolicy).let { - endpointsFactory.assignLocalityWeights(routeSpec, it) - } + endpointsFactory.filterEndpoints(endpoints, routeSpec.settings.routingPolicy) + .also { + if (it.endpointsList.isEmpty() && + properties.debugServiceNames.contains(routeSpec.clusterName) + ) { + logger.warn( + "Filtering endpoints resulted in empty list for ${routeSpec.clusterName}. " + + "Endpoints before filter: $endpoints" + ) + } + } + .let { + endpointsFactory.assignLocalityWeights(routeSpec, it) + } + .also { + if (it.endpointsList.isEmpty() && + properties.debugServiceNames.contains(routeSpec.clusterName) + ) { + logger.warn( + "Assigning weights resulted in empty endpoints for ${routeSpec.clusterName}. " + + "Endpoints before filter: $endpoints\"" + ) + } + } } } val rateLimitClusters = @@ -337,19 +358,7 @@ class EnvoySnapshotFactory( val endpoints = getServicesEndpointsForGroup( group.proxySettings.incoming.rateLimitEndpoints, globalSnapshot, egressRouteSpecification - ).also { e -> - val list = e.mapNotNull { el -> el.endpointsList.find { x -> x.lbEndpointsList.isEmpty() } } - val rPolicy = group.proxySettings.outgoing.defaultServiceSettings.routingPolicy - if (list.isNotEmpty() && - list.none { it.locality.zone.contains(properties.loadBalancing.trafficSplitting.zoneName) } && - rPolicy.autoServiceTag - ) { - logger.warn( - "Some of service ${group.serviceName} dependencies have ClusterLoadAssignment with empty " + - "lbEndpoints: $list, routingPolicy: $rPolicy, all endpoints: $e" - ) - } - } + ) val version = snapshotsVersions.version(group, clusters, endpoints, listeners, routes) return createSnapshot( 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 d6998c036..5c481633a 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 @@ -39,6 +39,7 @@ class SnapshotProperties { var tcpDumpsEnabled: Boolean = true var shouldAuditGlobalSnapshot: Boolean = true var compression: CompressionProperties = CompressionProperties() + var debugServiceNames: List = emptyList() } class PathNormalizationProperties {