File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
gateway-ha/src/main/java/io/trino/gateway/ha/module Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 6565import java .util .Map ;
6666
6767import 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 ;
6870import static java .util .Objects .requireNonNull ;
6971
7072public class HaGatewayProviderModule
@@ -223,9 +225,13 @@ public RoutingGroupSelector getRoutingGroupSelector(@ForRouter HttpClient httpCl
223225 public ClusterStatsMonitor getClusterStatsMonitor (@ ForMonitor HttpClient httpClient )
224226 {
225227 ClusterStatsConfiguration clusterStatsConfig = configuration .getClusterStatsConfiguration ();
226- if (configuration . getBackendState () == null ) {
228+ if (clusterStatsConfig == null ) {
227229 return new ClusterStatsInfoApiMonitor (httpClient , configuration .getMonitor ());
228230 }
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+ }
229235 return switch (clusterStatsConfig .getMonitorType ()) {
230236 case INFO_API -> new ClusterStatsInfoApiMonitor (httpClient , configuration .getMonitor ());
231237 case UI_API -> new ClusterStatsHttpMonitor (configuration .getBackendState ());
You can’t perform that action at this time.
0 commit comments