This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new 717ae57cf [Feature] Add dashboard distinguish teamId (#1901)
717ae57cf is described below
commit 717ae57cf314c9a79d65dc96ea63518c796ea256
Author: 1996fanrui <[email protected]>
AuthorDate: Wed Oct 26 01:20:32 2022 +0800
[Feature] Add dashboard distinguish teamId (#1901)
---
.../core/controller/ApplicationController.java | 4 +--
.../console/core/service/ApplicationService.java | 2 +-
.../core/service/impl/ApplicationServiceImpl.java | 31 ++++++++++++----------
3 files changed, 20 insertions(+), 17 deletions(-)
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java
index 97c7934a9..1e257e3c5 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java
@@ -123,8 +123,8 @@ public class ApplicationController {
}
@PostMapping("dashboard")
- public RestResponse dashboard() {
- Map<String, Serializable> map = applicationService.dashboard();
+ public RestResponse dashboard(Long teamId) {
+ Map<String, Serializable> map = applicationService.dashboard(teamId);
return RestResponse.success(map);
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/ApplicationService.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/ApplicationService.java
index a1076afbd..3c091c35e 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/ApplicationService.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/ApplicationService.java
@@ -69,7 +69,7 @@ public interface ApplicationService extends
IService<Application> {
boolean mapping(Application app);
- Map<String, Serializable> dashboard();
+ Map<String, Serializable> dashboard(Long teamId);
void tailMvnDownloading(Long id);
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java
index dc30a70c7..c7c9e6b91 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java
@@ -219,7 +219,7 @@ public class ApplicationServiceImpl extends
ServiceImpl<ApplicationMapper, Appli
private final Map<Long, CompletableFuture<CancelResponse>> cancelFutureMap
= new ConcurrentHashMap<>();
@Override
- public Map<String, Serializable> dashboard() {
+ public Map<String, Serializable> dashboard(Long teamId) {
JobsOverview.Task overview = new JobsOverview.Task();
Integer totalJmMemory = 0;
Integer totalTmMemory = 0;
@@ -229,26 +229,29 @@ public class ApplicationServiceImpl extends
ServiceImpl<ApplicationMapper, Appli
Integer runningJob = 0;
// stat metrics from other than kubernetes mode
- for (Application v : FlinkTrackingTask.getAllTrackingApp().values()) {
- if (v.getJmMemory() != null) {
- totalJmMemory += v.getJmMemory();
+ for (Application app : FlinkTrackingTask.getAllTrackingApp().values())
{
+ if (!teamId.equals(app.getTeamId())) {
+ continue;
}
- if (v.getTmMemory() != null) {
- totalTmMemory += v.getTmMemory() * (v.getTotalTM() == null ? 1
: v.getTotalTM());
+ if (app.getJmMemory() != null) {
+ totalJmMemory += app.getJmMemory();
}
- if (v.getTotalTM() != null) {
- totalTm += v.getTotalTM();
+ if (app.getTmMemory() != null) {
+ totalTmMemory += app.getTmMemory() * (app.getTotalTM() == null
? 1 : app.getTotalTM());
}
- if (v.getTotalSlot() != null) {
- totalSlot += v.getTotalSlot();
+ if (app.getTotalTM() != null) {
+ totalTm += app.getTotalTM();
}
- if (v.getAvailableSlot() != null) {
- availableSlot += v.getAvailableSlot();
+ if (app.getTotalSlot() != null) {
+ totalSlot += app.getTotalSlot();
}
- if (v.getState() == FlinkAppState.RUNNING.getValue()) {
+ if (app.getAvailableSlot() != null) {
+ availableSlot += app.getAvailableSlot();
+ }
+ if (app.getState() == FlinkAppState.RUNNING.getValue()) {
runningJob++;
}
- JobsOverview.Task task = v.getOverview();
+ JobsOverview.Task task = app.getOverview();
if (task != null) {
overview.setTotal(overview.getTotal() + task.getTotal());
overview.setCreated(overview.getCreated() + task.getCreated());