修改统计时间为窗口开始时间。(GAL-371)
This commit is contained in:
@@ -5,6 +5,7 @@ import cn.hutool.log.LogFactory;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import com.zdjizhi.common.config.GlobalConfig;
|
||||
import com.zdjizhi.common.pojo.Fields;
|
||||
import com.zdjizhi.common.pojo.Metrics;
|
||||
import com.zdjizhi.common.pojo.Tags;
|
||||
import com.zdjizhi.utils.StringUtil;
|
||||
@@ -51,8 +52,6 @@ public class ResultFlatMap implements FlatMapFunction<Metrics, String> {
|
||||
}
|
||||
|
||||
private static String getResultJson(Metrics metrics) {
|
||||
return JSONObject.toJSONString(metrics
|
||||
, JSONWriter.Feature.WriteNullStringAsEmpty
|
||||
, JSONWriter.Feature.WriteNullNumberAsZero);
|
||||
return JSONObject.toJSONString(metrics);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class MergeCountWindow extends ProcessWindowFunction<Tuple2<Tags, Fields>
|
||||
@Override
|
||||
public void process(String windowKey, Context context, Iterable<Tuple2<Tags, Fields>> input, Collector<Metrics> output) throws Exception {
|
||||
try {
|
||||
Long endTime = context.window().getEnd() / 1000;
|
||||
Long endTime = context.window().getStart() / 1000;
|
||||
for (Tuple2<Tags, Fields> tuple : input) {
|
||||
Tags tags = tuple.f0;
|
||||
Fields fields = tuple.f1;
|
||||
|
||||
Reference in New Issue
Block a user