Skip to content

Commit

Permalink
fix log sample query
Browse files Browse the repository at this point in the history
  • Loading branch information
masaimu committed Aug 11, 2023
1 parent 427639d commit 6341796
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
import java.util.Set;
import java.util.stream.Collectors;

import static io.holoinsight.server.home.alert.service.data.load.RuleAlarmLoadData.filterConvert;

/**
* @author wangsiyuan
* @date 2022/3/28 9:32 下午
Expand Down Expand Up @@ -258,9 +260,9 @@ private QueryProto.Datasource buildSampleDatasource(DataSource dataSource, Trigg
long end = TimeRangeUtil.getEndTimestamp(alarmTime, dataSource);
String metric = dataSource.getMetric() + "_logsamples";

QueryProto.Datasource.Builder builder =
QueryProto.Datasource.newBuilder().setStart(start).setEnd(end).setMetric(metric)
.setAggregator("sample").addAllGroupBy(Collections.singletonList("app"));
QueryProto.Datasource.Builder builder = QueryProto.Datasource.newBuilder().setStart(start)
.setEnd(end).setMetric(metric).addAllFilters(filterConvert(dataSource.getFilters()))
.setAggregator("sample").addAllGroupBy(Collections.singletonList("app"));
return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
* @author wangsiyuan
Expand Down Expand Up @@ -166,7 +162,7 @@ private long parseTime(String downsample) {
return Long.parseLong(timeStr.substring(0, timeStr.length() - 1));
}

private List<QueryProto.QueryFilter> filterConvert(List<Filter> filters) {
public static List<QueryProto.QueryFilter> filterConvert(List<Filter> filters) {
if (filters == null) {
return new ArrayList<>();
}
Expand Down

0 comments on commit 6341796

Please sign in to comment.