-
Notifications
You must be signed in to change notification settings - Fork 3.9k
xds: ORCA to LRS propagation changes #12203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd have to look at some details more closely, but it is mostly just plumbing.
@@ -25,6 +25,7 @@ | |||
import com.google.common.collect.Sets; | |||
import io.grpc.Internal; | |||
import io.grpc.Status; | |||
import io.grpc.xds.BackendMetricPropagation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
io.grpc.xds.client can't depend on io.grpc.xds. We moved client into its own package so it could be used without the rest of grpc.
@@ -420,6 +421,29 @@ public void run() { | |||
return loadCounter; | |||
} | |||
|
|||
@Override | |||
public LoadStatsManager2.ClusterLocalityStats addClusterLocalityStats( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the old method just call this one with backendMetricPropagation
set to null
? (Feel free to do that in XdsClient.java)
Map<String, Struct> filterMetadata, @Nullable BackendMetricPropagation backendMetricPropagation, | ||
@Nullable OutlierDetection outlierDetection, Object endpointLbConfig, | ||
LoadBalancerRegistry lbRegistry, Map<String, | ||
Map<Locality, Integer>> prioritizedLocalityWeights, List<DropOverload> dropOverloads) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can we add backendMetricPropagation param to the end of the methods for better consistency ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will push it after outlierDetection
since all the arguments taken from ClusterState are together and then others.
if (memUtilization > 0) { | ||
boolean shouldPropagate = true; | ||
if (backendMetricPropagation != null) { | ||
shouldPropagate = backendMetricPropagation.propagateMemUtilization; | ||
} | ||
|
||
if (shouldPropagate) { | ||
String metricName = "mem_utilization"; | ||
if (!loadMetricStatsMap.containsKey(metricName)) { | ||
loadMetricStatsMap.put(metricName, new BackendLoadMetricStats(1, memUtilization)); | ||
} else { | ||
loadMetricStatsMap.get(metricName).addMetricValueAndIncrementRequestsFinished(memUtilization); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be extracted out to a separate function ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
|
||
public synchronized ClusterLocalityStats getClusterLocalityStats( | ||
String cluster, @Nullable String edsServiceName, Locality locality, | ||
@Nullable BackendMetricPropagation backendMetricPropagation) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should always pass the parsed object from the cluster resource. If the feature is not enabled then pass an empty instance.
*/ | ||
public synchronized void recordBackendLoadMetricStats(Map<String, Double> namedMetrics) { | ||
// If no propagation configuration is set, use the old behavior (propagate everything) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done only when the feature is not enabled. If the feature is enabled, only when the * is specified for named_metrics we should propate everything.
Prefixing "named_metrics" should also happen only when the feature is enabled.
Also in recordTopLevelMetrics
.
*/ | ||
public LoadStatsManager2.ClusterLocalityStats addClusterLocalityStats( | ||
Bootstrapper.ServerInfo serverInfo, String clusterName, @Nullable String edsServiceName, | ||
Locality locality, @Nullable BackendMetricPropagation backendMetricPropagation) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it non nullable and no need to create a new overloaded method. Parsed cluster resource will always have it.
@@ -227,6 +231,12 @@ private static StructOrError<CdsUpdate.Builder> parseNonAggregateCluster( | |||
UpstreamTlsContext upstreamTlsContext = null; | |||
OutlierDetection outlierDetection = null; | |||
boolean isHttp11ProxyAvailable = false; | |||
BackendMetricPropagation backendMetricPropagation = null; | |||
|
|||
if (isEnabledOrcaLrsPropagation) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set it to empty proto if not enabled so the null check is not required anywhere. c-core does the same https://github.com/markdroth/grpc/blob/0c1e889bb70b422899bda04166524c678d628c70/src/core/xds/grpc/xds_cluster_parser.cc#L486
Implements gRFC A85 (grpc/proposal#454).
TODO: Unit tests