Commit 7adc97f 1 parent a2d2d3d commit 7adc97f Copy full SHA for 7adc97f
File tree 1 file changed +7
-1
lines changed
gateway-ha/src/main/java/io/trino/gateway/ha/module
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 65
65
import java .util .Map ;
66
66
67
67
import static io .airlift .jaxrs .JaxrsBinder .jaxrsBinder ;
68
+ import static io .trino .gateway .ha .config .ClusterStatsMonitorType .INFO_API ;
69
+ import static io .trino .gateway .ha .config .ClusterStatsMonitorType .NOOP ;
68
70
import static java .util .Objects .requireNonNull ;
69
71
70
72
public class HaGatewayProviderModule
@@ -223,9 +225,13 @@ public RoutingGroupSelector getRoutingGroupSelector(@ForRouter HttpClient httpCl
223
225
public ClusterStatsMonitor getClusterStatsMonitor (@ ForMonitor HttpClient httpClient )
224
226
{
225
227
ClusterStatsConfiguration clusterStatsConfig = configuration .getClusterStatsConfiguration ();
226
- if (configuration . getBackendState () == null ) {
228
+ if (clusterStatsConfig == null ) {
227
229
return new ClusterStatsInfoApiMonitor (httpClient , configuration .getMonitor ());
228
230
}
231
+ if (!(clusterStatsConfig .getMonitorType () == INFO_API || clusterStatsConfig .getMonitorType () == NOOP )
232
+ && configuration .getBackendState () == null ) {
233
+ throw new IllegalArgumentException ("BackendStateConfiguration is required for monitor type: " + clusterStatsConfig .getMonitorType ());
234
+ }
229
235
return switch (clusterStatsConfig .getMonitorType ()) {
230
236
case INFO_API -> new ClusterStatsInfoApiMonitor (httpClient , configuration .getMonitor ());
231
237
case UI_API -> new ClusterStatsHttpMonitor (configuration .getBackendState ());
You can’t perform that action at this time.
0 commit comments