wu-sheng commented on a change in pull request #6888:
URL: https://github.com/apache/skywalking/pull/6888#discussion_r628841311
##########
File path:
oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/AlarmQuery.java
##########
@@ -50,23 +65,199 @@ private AlarmQueryService getQueryService() {
return queryService;
}
+ private EventQueryService getEventQueryService() {
+ if (eventQueryService == null) {
+ this.eventQueryService =
moduleManager.find(CoreModule.NAME).provider().getService(EventQueryService.class);
+ }
+ return eventQueryService;
+ }
+
+ private ForkJoinPool getForkJoinPool() {
+ if (forkJoinPool == null) {
+ this.forkJoinPool = new
ForkJoinPool(Runtime.getRuntime().availableProcessors());
+ }
+ return forkJoinPool;
+ }
+
public AlarmTrend getAlarmTrend(final Duration duration) {
return new AlarmTrend();
}
public Alarms getAlarm(final Duration duration, final Scope scope, final
String keyword,
- final Pagination paging, final List<Tag> tags)
throws IOException {
+ final Pagination paging, final List<Tag> tags)
throws Throwable {
Integer scopeId = null;
if (scope != null) {
scopeId = scope.getScopeId();
}
long startSecondTB = 0;
long endSecondTB = 0;
+ EventQueryCondition condition = new EventQueryCondition();
if (nonNull(duration)) {
startSecondTB = duration.getStartTimeBucketInSec();
endSecondTB = duration.getEndTimeBucketInSec();
+ condition.setTime(duration);
+ }
+ Alarms alarms = getQueryService().getAlarm(
+ scopeId, keyword, paging, startSecondTB, endSecondTB, tags);
+ return includeEvents2AlarmsByCondition(alarms, condition);
+ }
+
+ private Alarms includeEvents2AlarmsByCondition(Alarms alarms,
EventQueryCondition condition) throws Throwable {
+ if (alarms.getTotal() < 1) {
+ return alarms;
+ }
+ SearchEventTask searchEventTask = new
SearchEventTask(alarms.getMsgs(), condition);
+ ForkJoinTask<List<AlarmMessage>> queryEventTask =
getForkJoinPool().submit(searchEventTask);
Review comment:
Even some storage can't, I don't know whether InfluxDB can, its DAO
implementation could have the thread pool feature, provided by a util class.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]