Skip to content

Commit

Permalink
added log for empty load assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
nastassia-dailidava committed Dec 18, 2024
1 parent 868ea71 commit 3d17671
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class SnapshotProperties {
var tcpDumpsEnabled: Boolean = true
var shouldAuditGlobalSnapshot: Boolean = true
var compression: CompressionProperties = CompressionProperties()
var debugServiceNames: List<String> = emptyList()
}

class PathNormalizationProperties {
Expand Down

0 comments on commit 3d17671

Please sign in to comment.