Skip to content

Commit dda057d

Browse files
aq-ikhwa-techludomikula
authored andcommitted
Publish server log event for ee plugin to consume
1 parent d8ed9c1 commit dda057d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

server/api-service/lowcoder-infra/src/main/java/org/lowcoder/infra/serverlog/ServerLogService.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.apache.commons.collections4.CollectionUtils;
1010
import org.lowcoder.infra.event.SystemCommonEvent;
1111
import org.lowcoder.infra.perf.PerfHelper;
12+
import org.lowcoder.plugin.events.ServerLogEvent;
1213
import org.springframework.beans.factory.annotation.Autowired;
1314
import org.springframework.context.ApplicationEventPublisher;
1415
import org.springframework.scheduling.annotation.Scheduled;
@@ -46,11 +47,13 @@ private void scheduledInsert() {
4647
.subscribe(result -> {
4748
int count = result.size();
4849
perfHelper.count(SERVER_LOG_BATCH_INSERT, Tags.of("size", String.valueOf(result.size())));
49-
applicationEventPublisher.publishEvent(SystemCommonEvent.builder()
50-
.apiCalls(count)
51-
.detail("apiCalls", Integer.toString(count))
52-
.build()
53-
);
50+
publishServerLogEvent(count);
5451
});
5552
}
53+
54+
private void publishServerLogEvent(int count) {
55+
ServerLogEvent event = new ServerLogEvent();
56+
event.setApiCallsCount(count);
57+
applicationEventPublisher.publishEvent(event);
58+
}
5659
}

0 commit comments

Comments
 (0)