Skip to content

Commit 80f872e

Browse files
authored
xds, rls: Experimental metrics are disabled by default (#11196) (#11197)
Experimental metrics (i.e WRR and RLS metrics) are disabled by default. Users are expected to explicitly enable while configuring metrics.
1 parent cc587e6 commit 80f872e

File tree

2 files changed

+35
-27
lines changed

2 files changed

+35
-27
lines changed

rls/src/main/java/io/grpc/rls/CachingRlsLbClient.java

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,25 +136,31 @@ final class CachingRlsLbClient {
136136
MetricInstrumentRegistry metricInstrumentRegistry
137137
= MetricInstrumentRegistry.getDefaultRegistry();
138138
DEFAULT_TARGET_PICKS_COUNTER = metricInstrumentRegistry.registerLongCounter(
139-
"grpc.lb.rls.default_target_picks", "Number of LB picks sent to the default target", "pick",
139+
"grpc.lb.rls.default_target_picks",
140+
"EXPERIMENTAL. Number of LB picks sent to the default target", "{pick}",
140141
Arrays.asList("grpc.target", "grpc.lb.rls.server_target",
141-
"grpc.lb.rls.data_plane_target", "grpc.lb.pick_result"), Collections.emptyList(), true);
142+
"grpc.lb.rls.data_plane_target", "grpc.lb.pick_result"), Collections.emptyList(),
143+
false);
142144
TARGET_PICKS_COUNTER = metricInstrumentRegistry.registerLongCounter("grpc.lb.rls.target_picks",
143-
"Number of LB picks sent to each RLS target", "pick",
144-
Arrays.asList("grpc.target", "grpc.lb.rls.server_target",
145-
"grpc.lb.rls.data_plane_target", "grpc.lb.pick_result"), Collections.emptyList(), true);
145+
"EXPERIMENTAL. Number of LB picks sent to each RLS target. Note that if the default "
146+
+ "target is also returned by the RLS server, RPCs sent to that target from the cache "
147+
+ "will be counted in this metric, not in grpc.rls.default_target_picks.", "{pick}",
148+
Arrays.asList("grpc.target", "grpc.lb.rls.server_target", "grpc.lb.rls.data_plane_target",
149+
"grpc.lb.pick_result"), Collections.emptyList(),
150+
false);
146151
FAILED_PICKS_COUNTER = metricInstrumentRegistry.registerLongCounter("grpc.lb.rls.failed_picks",
147-
"Number of LB picks failed due to either a failed RLS request or the RLS channel being "
148-
+ "throttled", "pick", Arrays.asList("grpc.target", "grpc.lb.rls.server_target"),
149-
Collections.emptyList(), true);
152+
"EXPERIMENTAL. Number of LB picks failed due to either a failed RLS request or the "
153+
+ "RLS channel being throttled", "{pick}",
154+
Arrays.asList("grpc.target", "grpc.lb.rls.server_target"),
155+
Collections.emptyList(), false);
150156
CACHE_ENTRIES_GAUGE = metricInstrumentRegistry.registerLongGauge("grpc.lb.rls.cache_entries",
151-
"Number of entries in the RLS cache", "entry",
152-
Arrays.asList("grpc.target", "grpc.lb.rls.server_target", "grpc.lb.rls.instance_id"),
153-
Collections.emptyList(), true);
157+
"EXPERIMENTAL. Number of entries in the RLS cache", "{entry}",
158+
Arrays.asList("grpc.target", "grpc.lb.rls.server_target", "grpc.lb.rls.instance_uuid"),
159+
Collections.emptyList(), false);
154160
CACHE_SIZE_GAUGE = metricInstrumentRegistry.registerLongGauge("grpc.lb.rls.cache_size",
155-
"The current size of the RLS cache", "byte",
156-
Arrays.asList("grpc.target", "grpc.lb.rls.server_target", "grpc.lb.rls.instance_id"),
157-
Collections.emptyList(), true);
161+
"EXPERIMENTAL. The current size of the RLS cache", "By",
162+
Arrays.asList("grpc.target", "grpc.lb.rls.server_target", "grpc.lb.rls.instance_uuid"),
163+
Collections.emptyList(), false);
158164
}
159165

160166
private CachingRlsLbClient(Builder builder) {

xds/src/main/java/io/grpc/xds/WeightedRoundRobinLoadBalancer.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,24 +89,26 @@ final class WeightedRoundRobinLoadBalancer extends RoundRobinLoadBalancer {
8989
MetricInstrumentRegistry metricInstrumentRegistry
9090
= MetricInstrumentRegistry.getDefaultRegistry();
9191
RR_FALLBACK_COUNTER = metricInstrumentRegistry.registerLongCounter("grpc.lb.wrr.rr_fallback",
92-
"Number of scheduler updates in which there were not enough endpoints with valid "
93-
+ "weight, which caused the WRR policy to fall back to RR behavior", "update",
94-
Lists.newArrayList("grpc.target"), Lists.newArrayList("grpc.lb.locality"), true);
92+
"EXPERIMENTAL. Number of scheduler updates in which there were not enough endpoints "
93+
+ "with valid weight, which caused the WRR policy to fall back to RR behavior",
94+
"{update}", Lists.newArrayList("grpc.target"), Lists.newArrayList("grpc.lb.locality"),
95+
false);
9596
ENDPOINT_WEIGHT_NOT_YET_USEABLE_COUNTER = metricInstrumentRegistry.registerLongCounter(
96-
"grpc.lb.wrr.endpoint_weight_not_yet_usable",
97-
"Number of endpoints from each scheduler update that don't yet have usable weight "
98-
+ "information", "endpoint", Lists.newArrayList("grpc.target"),
99-
Lists.newArrayList("grpc.lb.locality"), true);
97+
"grpc.lb.wrr.endpoint_weight_not_yet_usable", "EXPERIMENTAL. Number of endpoints "
98+
+ "from each scheduler update that don't yet have usable weight information",
99+
"{endpoint}", Lists.newArrayList("grpc.target"), Lists.newArrayList("grpc.lb.locality"),
100+
false);
100101
ENDPOINT_WEIGHT_STALE_COUNTER = metricInstrumentRegistry.registerLongCounter(
101102
"grpc.lb.wrr.endpoint_weight_stale",
102-
"Number of endpoints from each scheduler update whose latest weight is older than the "
103-
+ "expiration period", "endpoint", Lists.newArrayList("grpc.target"),
104-
Lists.newArrayList("grpc.lb.locality"), true);
103+
"EXPERIMENTAL. Number of endpoints from each scheduler update whose latest weight is "
104+
+ "older than the expiration period", "{endpoint}", Lists.newArrayList("grpc.target"),
105+
Lists.newArrayList("grpc.lb.locality"), false);
105106
ENDPOINT_WEIGHTS_HISTOGRAM = metricInstrumentRegistry.registerDoubleHistogram(
106-
"grpc.lb.wrr.endpoint_weights", "The histogram buckets will be endpoint weight ranges.",
107-
"weight", Lists.newArrayList(), Lists.newArrayList("grpc.target"),
107+
"grpc.lb.wrr.endpoint_weights",
108+
"EXPERIMENTAL. The histogram buckets will be endpoint weight ranges.",
109+
"{weight}", Lists.newArrayList(), Lists.newArrayList("grpc.target"),
108110
Lists.newArrayList("grpc.lb.locality"),
109-
true);
111+
false);
110112
}
111113

112114
public WeightedRoundRobinLoadBalancer(Helper helper, Ticker ticker) {

0 commit comments

Comments
 (0)