luoluoyuyu commented on code in PR #3795:
URL: https://github.com/apache/streampipes/pull/3795#discussion_r2463829811
##########
streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/health/ServiceHealthCheck.java:
##########
@@ -97,4 +113,19 @@ private String makeHealthCheckUrl(SpServiceRegistration
service) {
private List<SpServiceRegistration> getRegisteredServices() {
return serviceRegistrationManager.getAllServices();
}
-}
+
+ public static List<SpServiceRegistration> getService(String tag,
List<SpServiceRegistration> activeServices) {
+ return activeServices
+ .stream()
+ .filter(service -> filtersSupported(service, tag))
+ .filter(service -> service.getStatus() !=
SpServiceStatus.UNHEALTHY)
Review Comment:
service -> service.getStatus() == SpServiceStatus.HEALTHY
##########
streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/loadbalance/LoadManager.java:
##########
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.streampipes.manager.loadbalance;
+
+import org.apache.streampipes.commons.environment.Environment;
+import org.apache.streampipes.commons.environment.Environments;
+import
org.apache.streampipes.commons.prometheus.loadbalancer.LoadBalancerStats;
+import org.apache.streampipes.manager.loadbalance.impl.*;
+import
org.apache.streampipes.manager.loadbalance.unit.PipelineElementPartitioner;
+import org.apache.streampipes.manager.loadbalance.unit.ResourceUnitScanner;
+import org.apache.streampipes.model.base.InvocableStreamPipesEntity;
+import org.apache.streampipes.model.connect.adapter.AdapterDescription;
+import
org.apache.streampipes.model.extensions.svcdiscovery.SpServiceRegistration;
+import org.apache.streampipes.model.loadbalancer.LoadBalanceResourceUnit;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * Load manager for handling load balancing operations.
+ */
+public class LoadManager {
+
+ private static LoadBalancer loadBalancer;
+
+ private static ReadWriteLock lock;
+
+ private static LoadBalancerStats loadBalancerStats;
+
+ /**
+ * Initialize the load balancer with configuration from environment.
+ */
+ public static void initialize() {
+ Environment environment = Environments.getEnvironment();
+ ExtensionServiceSelector selector;
+ PipelineMigrator migrator;
+
+ LoadBalancerConfig.LoadTargetStd =
environment.getLoadTargetStd().getValueOrDefault();
Review Comment:
New configuration needs to be added. Users may not want to enable dynamic
load balancing, and the current method is unstable. Please set
```LoadManageEnable``` to false
##########
streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/health/ServiceRegistrationManager.java:
##########
@@ -69,6 +69,11 @@ public List<SpServiceRegistration> getAllServices() {
return storage.findAll();
}
+ public List<SpServiceRegistration> getAivServices() {
Review Comment:
getActiveService
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]