analysis mock finish
This commit is contained in:
parent
f377cfb824
commit
a2924fad04
|
|
@ -76,6 +76,10 @@ public class WorkerConfig extends ClusterConfig {
|
|||
public static class GlobalTraceSave {
|
||||
public static int Size = 1024;
|
||||
}
|
||||
|
||||
public static class GlobalTraceAnalysis {
|
||||
public static int Size = 1024;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Segment {
|
||||
|
|
@ -166,10 +170,18 @@ public class WorkerConfig extends ClusterConfig {
|
|||
public static class NodeRefResSumMinuteSave {
|
||||
public static int Size = 1024;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ResponseSummaryAnalysis {
|
||||
public static int Size = 1024;
|
||||
public static class NodeRefResSumDayAnalysis {
|
||||
public static int Size = 1024;
|
||||
}
|
||||
|
||||
public static class NodeRefResSumHourAnalysis {
|
||||
public static int Size = 1024;
|
||||
}
|
||||
|
||||
public static class NodeRefResSumMinuteAnalysis {
|
||||
public static int Size = 1024;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
|||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.actor.selector.WorkerSelector;
|
||||
import com.a.eye.skywalking.collector.worker.MergeAnalysisMember;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.globaltrace.GlobalTraceIndex;
|
||||
import com.a.eye.skywalking.collector.worker.globaltrace.persistence.GlobalTraceAgg;
|
||||
import com.a.eye.skywalking.collector.worker.segment.SegmentPost;
|
||||
|
|
@ -64,7 +65,7 @@ public class GlobalTraceAnalysis extends MergeAnalysisMember {
|
|||
|
||||
@Override
|
||||
public int queueSize() {
|
||||
return 1024;
|
||||
return WorkerConfig.Queue.GlobalTrace.GlobalTraceAnalysis.Size;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
|||
import com.a.eye.skywalking.collector.actor.selector.WorkerSelector;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.node.persistence.NodeCompAgg;
|
||||
import com.a.eye.skywalking.collector.worker.segment.SegmentPost;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.a.eye.skywalking.trace.TraceSegment;
|
||||
|
||||
|
|
@ -21,8 +22,9 @@ public class NodeCompAnalysis extends AbstractNodeCompAnalysis {
|
|||
|
||||
@Override
|
||||
public void analyse(Object message) throws Exception {
|
||||
if (message instanceof TraceSegment) {
|
||||
TraceSegment segment = (TraceSegment) message;
|
||||
if (message instanceof SegmentPost.SegmentWithTimeSlice) {
|
||||
SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice = (SegmentPost.SegmentWithTimeSlice) message;
|
||||
TraceSegment segment = segmentWithTimeSlice.getTraceSegment();
|
||||
analyseSpans(segment);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import com.a.eye.skywalking.trace.TraceSegment;
|
|||
*/
|
||||
public class NodeMappingHourAnalysis extends AbstractNodeMappingAnalysis {
|
||||
|
||||
public NodeMappingHourAnalysis(com.a.eye.skywalking.collector.actor.Role role, ClusterWorkerContext clusterContext, LocalWorkerContext selfContext) {
|
||||
NodeMappingHourAnalysis(com.a.eye.skywalking.collector.actor.Role role, ClusterWorkerContext clusterContext, LocalWorkerContext selfContext) {
|
||||
super(role, clusterContext, selfContext);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import com.a.eye.skywalking.trace.TraceSegment;
|
|||
*/
|
||||
public class NodeMappingMinuteAnalysis extends AbstractNodeMappingAnalysis {
|
||||
|
||||
public NodeMappingMinuteAnalysis(com.a.eye.skywalking.collector.actor.Role role, ClusterWorkerContext clusterContext, LocalWorkerContext selfContext) {
|
||||
NodeMappingMinuteAnalysis(com.a.eye.skywalking.collector.actor.Role role, ClusterWorkerContext clusterContext, LocalWorkerContext selfContext) {
|
||||
super(role, clusterContext, selfContext);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ abstract class AbstractNodeRefResSumAnalysis extends MetricAnalysisMember {
|
|||
setMetric(nodeRefRes.nodeRefId, NodeRefResSumIndex.Summary, 1L);
|
||||
}
|
||||
|
||||
static class NodeRefResRecord extends AbstractTimeSlice {
|
||||
public static class NodeRefResRecord extends AbstractTimeSlice {
|
||||
private String nodeRefId;
|
||||
private long startTime;
|
||||
private long endTime;
|
||||
|
|
@ -65,5 +65,9 @@ abstract class AbstractNodeRefResSumAnalysis extends MetricAnalysisMember {
|
|||
void setError(Boolean error) {
|
||||
isError = error;
|
||||
}
|
||||
|
||||
String getNodeRefId() {
|
||||
return nodeRefId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import com.a.eye.skywalking.collector.worker.storage.MetricData;
|
|||
*/
|
||||
public class NodeRefResSumDayAnalysis extends AbstractNodeRefResSumAnalysis {
|
||||
|
||||
private NodeRefResSumDayAnalysis(com.a.eye.skywalking.collector.actor.Role role, ClusterWorkerContext clusterContext, LocalWorkerContext selfContext) {
|
||||
NodeRefResSumDayAnalysis(com.a.eye.skywalking.collector.actor.Role role, ClusterWorkerContext clusterContext, LocalWorkerContext selfContext) {
|
||||
super(role, clusterContext, selfContext);
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ public class NodeRefResSumDayAnalysis extends AbstractNodeRefResSumAnalysis {
|
|||
|
||||
@Override
|
||||
public int queueSize() {
|
||||
return WorkerConfig.Queue.ResponseSummaryAnalysis.Size;
|
||||
return WorkerConfig.Queue.NodeRef.NodeRefResSumDayAnalysis.Size;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import com.a.eye.skywalking.collector.worker.storage.MetricData;
|
|||
*/
|
||||
public class NodeRefResSumHourAnalysis extends AbstractNodeRefResSumAnalysis {
|
||||
|
||||
private NodeRefResSumHourAnalysis(com.a.eye.skywalking.collector.actor.Role role, ClusterWorkerContext clusterContext, LocalWorkerContext selfContext) {
|
||||
NodeRefResSumHourAnalysis(com.a.eye.skywalking.collector.actor.Role role, ClusterWorkerContext clusterContext, LocalWorkerContext selfContext) {
|
||||
super(role, clusterContext, selfContext);
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ public class NodeRefResSumHourAnalysis extends AbstractNodeRefResSumAnalysis {
|
|||
|
||||
@Override
|
||||
public int queueSize() {
|
||||
return WorkerConfig.Queue.ResponseSummaryAnalysis.Size;
|
||||
return WorkerConfig.Queue.NodeRef.NodeRefResSumHourAnalysis.Size;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import com.a.eye.skywalking.collector.worker.storage.MetricData;
|
|||
*/
|
||||
public class NodeRefResSumMinuteAnalysis extends AbstractNodeRefResSumAnalysis {
|
||||
|
||||
private NodeRefResSumMinuteAnalysis(com.a.eye.skywalking.collector.actor.Role role, ClusterWorkerContext clusterContext, LocalWorkerContext selfContext) {
|
||||
NodeRefResSumMinuteAnalysis(com.a.eye.skywalking.collector.actor.Role role, ClusterWorkerContext clusterContext, LocalWorkerContext selfContext) {
|
||||
super(role, clusterContext, selfContext);
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ public class NodeRefResSumMinuteAnalysis extends AbstractNodeRefResSumAnalysis {
|
|||
|
||||
@Override
|
||||
public int queueSize() {
|
||||
return WorkerConfig.Queue.ResponseSummaryAnalysis.Size;
|
||||
return WorkerConfig.Queue.NodeRef.NodeRefResSumMinuteAnalysis.Size;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class SegmentPost extends AbstractPost {
|
|||
getSelfContext().lookup(GlobalTraceAnalysis.Role.INSTANCE).tell(segmentWithTimeSlice);
|
||||
getSelfContext().lookup(SegmentExceptionSave.Role.INSTANCE).tell(segmentWithTimeSlice);
|
||||
|
||||
getSelfContext().lookup(NodeCompAnalysis.Role.INSTANCE).tell(newSegment);
|
||||
getSelfContext().lookup(NodeCompAnalysis.Role.INSTANCE).tell(segmentWithTimeSlice);
|
||||
|
||||
tellNodeRef(segmentWithTimeSlice);
|
||||
tellNodeMapping(segmentWithTimeSlice);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class DateTools {
|
|||
}
|
||||
|
||||
public static long getMinuteSlice(long time) {
|
||||
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+8:00"));
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(time);
|
||||
String timeStr = minuteDateFormat.format(calendar.getTime());
|
||||
return Long.valueOf(timeStr);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
package com.a.eye.skywalking.collector.worker.datamerge;
|
||||
|
||||
import com.a.eye.skywalking.collector.worker.tools.DateTools;
|
||||
import com.a.eye.skywalking.collector.worker.tools.JsonFileReader;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
public enum JsonDataMerge {
|
||||
INSTANCE;
|
||||
|
||||
private String path = this.getClass().getResource("/").getPath();
|
||||
|
||||
public void merge(String expectJsonFile, JsonArray actualData) throws FileNotFoundException{
|
||||
Gson gson = new Gson();
|
||||
String jsonStrData = JsonFileReader.INSTANCE.read(path + expectJsonFile);
|
||||
JsonArray expectJsonArray = gson.fromJson(jsonStrData, JsonArray.class);
|
||||
|
||||
for (int i = 0; i < expectJsonArray.size(); i++) {
|
||||
JsonObject expectJson = expectJsonArray.get(i).getAsJsonObject();
|
||||
mergeData(expectJson, actualData.get(i).getAsJsonObject());
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeData(JsonObject expectData, JsonObject actualData) {
|
||||
Iterator<Map.Entry<String, JsonElement>> iterator = expectData.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, JsonElement> entry = iterator.next();
|
||||
String key = entry.getKey();
|
||||
String value = null;
|
||||
if (!entry.getValue().isJsonNull()) {
|
||||
value = entry.getValue().getAsString();
|
||||
}
|
||||
System.out.printf("key: %s, value: %s \n", key, value);
|
||||
|
||||
if (entry.getValue().isJsonNull()) {
|
||||
Assert.assertEquals(true, actualData.get(key).isJsonNull());
|
||||
} else {
|
||||
if (key.equals("timeSlice") || key.equals("startTime") || key.equals("endTime") || key.equals("minute") || key.equals("hour") || key.equals("day")) {
|
||||
value = String.valueOf(DateTools.changeToUTCSlice(Long.valueOf(value)));
|
||||
}
|
||||
Assert.assertEquals(value, actualData.get(key).getAsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.a.eye.skywalking.collector.worker.datamerge;
|
||||
|
||||
import com.a.eye.skywalking.collector.worker.Const;
|
||||
import com.a.eye.skywalking.collector.worker.storage.MetricData;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.a.eye.skywalking.collector.worker.tools.DateTools;
|
||||
import com.a.eye.skywalking.collector.worker.tools.JsonFileReader;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
public enum MetricDataMergeJson {
|
||||
INSTANCE;
|
||||
|
||||
private String path = this.getClass().getResource("/").getPath();
|
||||
|
||||
public void merge(String expectJsonFile, List<MetricData> metricDataList) throws FileNotFoundException {
|
||||
Gson gson = new Gson();
|
||||
String jsonStrData = JsonFileReader.INSTANCE.read(path + expectJsonFile);
|
||||
JsonArray expectJsonArray = gson.fromJson(jsonStrData, JsonArray.class);
|
||||
Assert.assertEquals(expectJsonArray.size(), metricDataList.size());
|
||||
|
||||
Map<String, JsonObject> recordDataMap = recordData2Map(metricDataList);
|
||||
|
||||
for (int i = 0; i < expectJsonArray.size(); i++) {
|
||||
JsonObject rowData = expectJsonArray.get(i).getAsJsonObject();
|
||||
String id = rowData.get("id").getAsString();
|
||||
id = id2UTCSlice(id);
|
||||
|
||||
JsonObject data = rowData.get("data").getAsJsonObject();
|
||||
if (recordDataMap.containsKey(id)) {
|
||||
mergeData(data, recordDataMap.get(id));
|
||||
} else {
|
||||
Assert.fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeData(JsonObject expectData, JsonObject actualData) {
|
||||
Iterator<Map.Entry<String, JsonElement>> iterator = expectData.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, JsonElement> entry = iterator.next();
|
||||
String key = entry.getKey();
|
||||
String value = null;
|
||||
if (!entry.getValue().isJsonNull()) {
|
||||
value = entry.getValue().getAsString();
|
||||
}
|
||||
System.out.printf("key: %s, value: %s \n", key, value);
|
||||
|
||||
if (entry.getValue().isJsonNull()) {
|
||||
Assert.assertEquals(true, actualData.get(key).isJsonNull());
|
||||
} else {
|
||||
if (key.equals("timeSlice")) {
|
||||
value = String.valueOf(DateTools.changeToUTCSlice(Long.valueOf(value)));
|
||||
}
|
||||
Assert.assertEquals(value, actualData.get(key).getAsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, JsonObject> recordData2Map(List<MetricData> recordDataList) {
|
||||
Map<String, JsonObject> recordDataMap = new HashMap<>();
|
||||
Gson gson = new Gson();
|
||||
for (MetricData metricData : recordDataList) {
|
||||
JsonObject jsonObject = gson.fromJson(gson.toJson(metricData.toMap()), JsonObject.class);
|
||||
recordDataMap.put(metricData.getId(), jsonObject);
|
||||
}
|
||||
return recordDataMap;
|
||||
}
|
||||
|
||||
private String id2UTCSlice(String id) {
|
||||
String[] ids = id.split(Const.IDS_SPLIT);
|
||||
long changedSlice = DateTools.changeToUTCSlice(Long.valueOf(ids[0]));
|
||||
|
||||
String changedId = "";
|
||||
|
||||
for (int i = 1; i < ids.length; i++) {
|
||||
changedId = changedId + Const.ID_SPLIT + ids[i];
|
||||
}
|
||||
changedId = String.valueOf(changedSlice) + changedId;
|
||||
System.out.printf("changedId: %s", changedId);
|
||||
return changedId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.a.eye.skywalking.collector.worker.datamerge;
|
||||
|
||||
import com.a.eye.skywalking.collector.worker.Const;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.a.eye.skywalking.collector.worker.tools.DateTools;
|
||||
import com.a.eye.skywalking.collector.worker.tools.JsonFileReader;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
public enum RecordDataMergeJson {
|
||||
INSTANCE;
|
||||
|
||||
private String path = this.getClass().getResource("/").getPath();
|
||||
|
||||
public void merge(String expectJsonFile, List<RecordData> recordDataList) throws FileNotFoundException {
|
||||
Gson gson = new Gson();
|
||||
String jsonStrData = JsonFileReader.INSTANCE.read(path + expectJsonFile);
|
||||
JsonArray expectJsonArray = gson.fromJson(jsonStrData, JsonArray.class);
|
||||
Assert.assertEquals(expectJsonArray.size(), recordDataList.size());
|
||||
|
||||
Map<String, JsonObject> recordDataMap = recordData2Map(recordDataList);
|
||||
|
||||
for (int i = 0; i < expectJsonArray.size(); i++) {
|
||||
JsonObject rowData = expectJsonArray.get(i).getAsJsonObject();
|
||||
String id = rowData.get("id").getAsString();
|
||||
id = id2UTCSlice(id);
|
||||
|
||||
JsonObject data = rowData.get("data").getAsJsonObject();
|
||||
if (recordDataMap.containsKey(id)) {
|
||||
mergeData(data, recordDataMap.get(id));
|
||||
} else {
|
||||
Assert.fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeData(JsonObject expectData, JsonObject actualData) {
|
||||
Iterator<Map.Entry<String, JsonElement>> iterator = expectData.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, JsonElement> entry = iterator.next();
|
||||
String key = entry.getKey();
|
||||
String value = null;
|
||||
if (!entry.getValue().isJsonNull()) {
|
||||
value = entry.getValue().getAsString();
|
||||
}
|
||||
System.out.printf("key: %s, value: %s \n", key, value);
|
||||
|
||||
if (entry.getValue().isJsonNull()) {
|
||||
Assert.assertEquals(true, actualData.get(key).isJsonNull());
|
||||
} else {
|
||||
if (key.equals("timeSlice")) {
|
||||
value = String.valueOf(DateTools.changeToUTCSlice(Long.valueOf(value)));
|
||||
}
|
||||
Assert.assertEquals(value, actualData.get(key).getAsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, JsonObject> recordData2Map(List<RecordData> recordDataList) {
|
||||
Map<String, JsonObject> recordDataMap = new HashMap<>();
|
||||
for (RecordData recordData : recordDataList) {
|
||||
recordDataMap.put(recordData.getId(), recordData.getRecord());
|
||||
}
|
||||
return recordDataMap;
|
||||
}
|
||||
|
||||
private String id2UTCSlice(String id) {
|
||||
String[] ids = id.split(Const.IDS_SPLIT);
|
||||
if (ids.length > 1) {
|
||||
long changedSlice = DateTools.changeToUTCSlice(Long.valueOf(ids[0]));
|
||||
String changedId = "";
|
||||
|
||||
for (int i = 1; i < ids.length; i++) {
|
||||
changedId = changedId + Const.ID_SPLIT + ids[i];
|
||||
}
|
||||
changedId = String.valueOf(changedSlice) + changedId;
|
||||
System.out.printf("changedId: %s", changedId);
|
||||
return changedId;
|
||||
} else {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.a.eye.skywalking.collector.worker.globaltrace.analysis;
|
||||
|
||||
import com.a.eye.skywalking.collector.actor.ClusterWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.WorkerRefs;
|
||||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.globaltrace.persistence.GlobalTraceAgg;
|
||||
import com.a.eye.skywalking.collector.worker.mock.MergeDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.segment.mock.SegmentMock;
|
||||
import com.a.eye.skywalking.collector.worker.storage.MergeData;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({ClusterWorkerContext.class})
|
||||
@PowerMockIgnore({"javax.management.*"})
|
||||
public class GlobalTraceAnalysisTestCase {
|
||||
|
||||
private GlobalTraceAnalysis analysis;
|
||||
private SegmentMock segmentMock = new SegmentMock();
|
||||
private MergeDataAnswer answer;
|
||||
private ClusterWorkerContext clusterWorkerContext;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
WorkerRefs workerRefs = mock(WorkerRefs.class);
|
||||
answer = new MergeDataAnswer();
|
||||
doAnswer(answer).when(workerRefs).tell(Mockito.any(MergeData.class));
|
||||
|
||||
when(clusterWorkerContext.lookup(GlobalTraceAgg.Role.INSTANCE)).thenReturn(workerRefs);
|
||||
|
||||
LocalWorkerContext localWorkerContext = new LocalWorkerContext();
|
||||
analysis = new GlobalTraceAnalysis(GlobalTraceAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRole() {
|
||||
Assert.assertEquals(GlobalTraceAnalysis.class.getSimpleName(), GlobalTraceAnalysis.Role.INSTANCE.roleName());
|
||||
Assert.assertEquals(RollingSelector.class.getSimpleName(), GlobalTraceAnalysis.Role.INSTANCE.workerSelector().getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFactory() {
|
||||
Assert.assertEquals(GlobalTraceAnalysis.class.getSimpleName(), GlobalTraceAnalysis.Factory.INSTANCE.role().roleName());
|
||||
Assert.assertEquals(GlobalTraceAnalysis.class.getSimpleName(), GlobalTraceAnalysis.Factory.INSTANCE.workerInstance(null).getClass().getSimpleName());
|
||||
|
||||
int testSize = 10;
|
||||
WorkerConfig.Queue.GlobalTrace.GlobalTraceAnalysis.Size = testSize;
|
||||
Assert.assertEquals(testSize, GlobalTraceAnalysis.Factory.INSTANCE.queueSize());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAnalyse() throws Exception {
|
||||
segmentMock.executeAnalysis(analysis);
|
||||
|
||||
Assert.assertEquals(1, answer.getMergeDataList().size());
|
||||
MergeData mergeData = answer.getMergeDataList().get(0);
|
||||
Assert.assertEquals(id, mergeData.getId());
|
||||
String subSegIds = mergeData.toMap().get("subSegIds");
|
||||
Assert.assertEquals(cacheServiceSubSegIds, subSegIds);
|
||||
}
|
||||
|
||||
private String id = "Trace.1490922929254.1797892356.6003.69.2";
|
||||
private String cacheServiceSubSegIds = "Segment.1490922929298.927784221.5991.28.1,Segment.1490922929274.1382198130.5997.47.1,Segment.1490922929258.927784221.5991.27.1,Segment.1490922929254.1797892356.6003.69.1";
|
||||
}
|
||||
|
|
@ -4,7 +4,8 @@ import com.a.eye.skywalking.collector.worker.storage.MergeData;
|
|||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -12,16 +13,21 @@ import java.util.Map;
|
|||
*/
|
||||
public class MergeDataAnswer implements Answer<Object> {
|
||||
|
||||
public Map<String, String> mergeObj = new HashMap<>();
|
||||
private List<MergeData> mergeDataList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
MergeData mergeData = (MergeData) invocation.getArguments()[0];
|
||||
System.out.printf("id: %s \n", mergeData.getId());
|
||||
|
||||
for (Map.Entry<String, String> entry : mergeData.toMap().entrySet()) {
|
||||
System.out.printf("key: %s, value: %s \n", entry.getKey(), entry.getValue());
|
||||
mergeObj.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
mergeDataList.add(mergeData);
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<MergeData> getMergeDataList() {
|
||||
return mergeDataList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
package com.a.eye.skywalking.collector.worker.mock;
|
||||
|
||||
import com.a.eye.skywalking.collector.worker.storage.MetricData;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -12,14 +15,21 @@ import java.util.Map;
|
|||
*/
|
||||
public class MetricDataAnswer implements Answer<Object> {
|
||||
|
||||
public Map<String, Object> metricObj = new HashMap<>();
|
||||
private List<MetricData> metricDataList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
MetricData metricData = (MetricData) invocation.getArguments()[0];
|
||||
for (Map.Entry<String, Object> entry : metricData.toMap().entrySet()) {
|
||||
metricObj.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
System.out.printf("id: %s \n", metricData.getId());
|
||||
metricDataList.add(metricData);
|
||||
Gson gson = new Gson();
|
||||
String jsonStr = gson.toJson(metricData.toMap());
|
||||
System.out.printf("data: %s \n", jsonStr);
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<MetricData> getMetricDataList() {
|
||||
return metricDataList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,40 +1,33 @@
|
|||
package com.a.eye.skywalking.collector.worker.mock;
|
||||
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.google.gson.JsonElement;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
public class RecordDataAnswer implements Answer<Object> {
|
||||
|
||||
public RecordObj recordObj = new RecordObj();
|
||||
private List<RecordData> recordDataList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
RecordData recordData = (RecordData) invocation.getArguments()[0];
|
||||
recordObj.setSource(recordData);
|
||||
System.out.printf("id: %s \n", recordData.getId());
|
||||
System.out.println(recordData.getRecord().toString());
|
||||
|
||||
recordDataList.add(recordData);
|
||||
return null;
|
||||
}
|
||||
|
||||
public class RecordObj {
|
||||
private List<RecordData> recordDataList;
|
||||
|
||||
private RecordObj() {
|
||||
recordDataList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<RecordData> getRecordData() {
|
||||
return recordDataList;
|
||||
}
|
||||
|
||||
private void setSource(RecordData recordData) {
|
||||
this.recordDataList.add(recordData);
|
||||
System.out.printf("id: %s, data: %s \n", recordData.getId(), recordData.getRecord().toString());
|
||||
}
|
||||
public List<RecordData> getRecordDataList() {
|
||||
return recordDataList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
package com.a.eye.skywalking.collector.worker.node.analysis;
|
||||
|
||||
import com.a.eye.skywalking.collector.actor.ClusterWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.WorkerRefs;
|
||||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.datamerge.RecordDataMergeJson;
|
||||
import com.a.eye.skywalking.collector.worker.mock.RecordDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.node.persistence.NodeCompAgg;
|
||||
import com.a.eye.skywalking.collector.worker.segment.mock.SegmentMock;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({ClusterWorkerContext.class})
|
||||
@PowerMockIgnore({"javax.management.*"})
|
||||
public class NodeCompAnalysisTestCase {
|
||||
|
||||
private NodeCompAnalysis analysis;
|
||||
private SegmentMock segmentMock = new SegmentMock();
|
||||
private RecordDataAnswer answer;
|
||||
private ClusterWorkerContext clusterWorkerContext;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
WorkerRefs workerRefs = mock(WorkerRefs.class);
|
||||
answer = new RecordDataAnswer();
|
||||
doAnswer(answer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
|
||||
when(clusterWorkerContext.lookup(NodeCompAgg.Role.INSTANCE)).thenReturn(workerRefs);
|
||||
|
||||
LocalWorkerContext localWorkerContext = new LocalWorkerContext();
|
||||
analysis = new NodeCompAnalysis(NodeCompAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRole() {
|
||||
Assert.assertEquals(NodeCompAnalysis.class.getSimpleName(), NodeCompAnalysis.Role.INSTANCE.roleName());
|
||||
Assert.assertEquals(RollingSelector.class.getSimpleName(), NodeCompAnalysis.Role.INSTANCE.workerSelector().getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFactory() {
|
||||
Assert.assertEquals(NodeCompAnalysis.class.getSimpleName(), NodeCompAnalysis.Factory.INSTANCE.role().roleName());
|
||||
Assert.assertEquals(NodeCompAnalysis.class.getSimpleName(), NodeCompAnalysis.Factory.INSTANCE.workerInstance(null).getClass().getSimpleName());
|
||||
|
||||
int testSize = 10;
|
||||
WorkerConfig.Queue.Node.NodeCompAnalysis.Size = testSize;
|
||||
Assert.assertEquals(testSize, NodeCompAnalysis.Factory.INSTANCE.queueSize());
|
||||
}
|
||||
|
||||
String jsonFile = "/json/node/analysis/node_comp_analysis.json";
|
||||
|
||||
@Test
|
||||
public void testAnalyse() throws Exception {
|
||||
segmentMock.executeAnalysis(analysis);
|
||||
|
||||
List<RecordData> recordDataList = answer.getRecordDataList();
|
||||
RecordDataMergeJson.INSTANCE.merge(jsonFile, recordDataList);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package com.a.eye.skywalking.collector.worker.node.analysis;
|
||||
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.a.eye.skywalking.collector.worker.tools.RecordDataTool;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
public enum NodeMappingAnalysisVerify {
|
||||
INSTANCE;
|
||||
|
||||
public void verify(List<RecordData> recordDataList, long timeSlice) {
|
||||
Assert.assertEquals(2, recordDataList.size());
|
||||
|
||||
RecordData data_1 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..persistence-service..-..[10.128.35.80:20880]");
|
||||
Assert.assertEquals("persistence-service", data_1.getRecord().get("code").getAsString());
|
||||
Assert.assertEquals("[10.128.35.80:20880]", data_1.getRecord().get("peers").getAsString());
|
||||
Assert.assertEquals("persistence-service..-..[10.128.35.80:20880]", data_1.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_1.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_2 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..cache-service..-..[127.0.0.1:8002]");
|
||||
Assert.assertEquals("cache-service", data_2.getRecord().get("code").getAsString());
|
||||
Assert.assertEquals("[127.0.0.1:8002]", data_2.getRecord().get("peers").getAsString());
|
||||
Assert.assertEquals("cache-service..-..[127.0.0.1:8002]", data_2.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_2.getRecord().get("timeSlice").getAsLong());
|
||||
}
|
||||
}
|
||||
|
|
@ -5,15 +5,13 @@ import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
|||
import com.a.eye.skywalking.collector.actor.ProviderNotFoundException;
|
||||
import com.a.eye.skywalking.collector.actor.WorkerRefs;
|
||||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.queue.EndOfBatchCommand;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.datamerge.RecordDataMergeJson;
|
||||
import com.a.eye.skywalking.collector.worker.mock.RecordDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.node.persistence.NodeMappingDayAgg;
|
||||
import com.a.eye.skywalking.collector.worker.noderef.analysis.NodeRefResSumDayAnalysis;
|
||||
import com.a.eye.skywalking.collector.worker.segment.SegmentPost;
|
||||
import com.a.eye.skywalking.collector.worker.segment.mock.SegmentMock;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.a.eye.skywalking.collector.worker.tools.DateTools;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
@ -27,7 +25,6 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
|||
import java.util.List;
|
||||
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
|
|
@ -39,22 +36,22 @@ import static org.powermock.api.mockito.PowerMockito.when;
|
|||
@PowerMockIgnore({"javax.management.*"})
|
||||
public class NodeMappingDayAnalysisTestCase {
|
||||
|
||||
private NodeMappingDayAnalysis nodeMappingDayAnalysis;
|
||||
private NodeMappingDayAnalysis analysis;
|
||||
private SegmentMock segmentMock = new SegmentMock();
|
||||
private RecordDataAnswer recordDataAnswer;
|
||||
private RecordDataAnswer answer;
|
||||
private ClusterWorkerContext clusterWorkerContext;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
WorkerRefs workerRefs = mock(WorkerRefs.class);
|
||||
recordDataAnswer = new RecordDataAnswer();
|
||||
doAnswer(recordDataAnswer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
answer = new RecordDataAnswer();
|
||||
doAnswer(answer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
|
||||
when(clusterWorkerContext.lookup(NodeMappingDayAgg.Role.INSTANCE)).thenReturn(workerRefs);
|
||||
|
||||
LocalWorkerContext localWorkerContext = new LocalWorkerContext();
|
||||
nodeMappingDayAnalysis = new NodeMappingDayAnalysis(NodeMappingDayAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
analysis = new NodeMappingDayAnalysis(NodeMappingDayAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -76,34 +73,16 @@ public class NodeMappingDayAnalysisTestCase {
|
|||
@Test(expected = Exception.class)
|
||||
public void testPreStart() throws ProviderNotFoundException {
|
||||
when(clusterWorkerContext.findProvider(NodeRefResSumDayAnalysis.Role.INSTANCE)).thenThrow(new Exception());
|
||||
nodeMappingDayAnalysis.preStart();
|
||||
analysis.preStart();
|
||||
}
|
||||
|
||||
String jsonFile = "/json/node/analysis/node_mapping_day_analysis.json";
|
||||
|
||||
@Test
|
||||
public void testAnalyse() throws Exception {
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceSegment = segmentMock.mockCacheServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceSegment) {
|
||||
nodeMappingDayAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalService = segmentMock.mockPortalServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalService) {
|
||||
nodeMappingDayAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> persistenceService = segmentMock.mockPersistenceServiceSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : persistenceService) {
|
||||
nodeMappingDayAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceException = segmentMock.mockCacheServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceException) {
|
||||
nodeMappingDayAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalServiceException = segmentMock.mockPortalServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalServiceException) {
|
||||
nodeMappingDayAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
segmentMock.executeAnalysis(analysis);
|
||||
|
||||
nodeMappingDayAnalysis.onWork(new EndOfBatchCommand());
|
||||
|
||||
NodeMappingAnalysisVerify.INSTANCE.verify(recordDataAnswer.recordObj.getRecordData(), DateTools.changeToUTCSlice(201703310000L));
|
||||
List<RecordData> recordDataList = answer.getRecordDataList();
|
||||
RecordDataMergeJson.INSTANCE.merge(jsonFile, recordDataList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,12 @@ import com.a.eye.skywalking.collector.actor.ClusterWorkerContext;
|
|||
import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.WorkerRefs;
|
||||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.queue.EndOfBatchCommand;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.datamerge.RecordDataMergeJson;
|
||||
import com.a.eye.skywalking.collector.worker.mock.RecordDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.node.persistence.NodeMappingDayAgg;
|
||||
import com.a.eye.skywalking.collector.worker.node.persistence.NodeMappingHourAgg;
|
||||
import com.a.eye.skywalking.collector.worker.segment.SegmentPost;
|
||||
import com.a.eye.skywalking.collector.worker.segment.mock.SegmentMock;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.a.eye.skywalking.collector.worker.tools.DateTools;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
@ -37,21 +34,21 @@ import static org.powermock.api.mockito.PowerMockito.when;
|
|||
@PowerMockIgnore({"javax.management.*"})
|
||||
public class NodeMappingHourAnalysisTestCase {
|
||||
|
||||
private NodeMappingHourAnalysis nodeMappingHourAnalysis;
|
||||
private NodeMappingHourAnalysis analysis;
|
||||
private SegmentMock segmentMock = new SegmentMock();
|
||||
private RecordDataAnswer recordDataAnswer;
|
||||
private RecordDataAnswer answer;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
ClusterWorkerContext clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
WorkerRefs workerRefs = mock(WorkerRefs.class);
|
||||
recordDataAnswer = new RecordDataAnswer();
|
||||
doAnswer(recordDataAnswer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
answer = new RecordDataAnswer();
|
||||
doAnswer(answer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
|
||||
when(clusterWorkerContext.lookup(NodeMappingHourAgg.Role.INSTANCE)).thenReturn(workerRefs);
|
||||
|
||||
LocalWorkerContext localWorkerContext = new LocalWorkerContext();
|
||||
nodeMappingHourAnalysis = new NodeMappingHourAnalysis(NodeMappingHourAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
analysis = new NodeMappingHourAnalysis(NodeMappingHourAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -70,31 +67,13 @@ public class NodeMappingHourAnalysisTestCase {
|
|||
Assert.assertEquals(testSize, NodeMappingHourAnalysis.Factory.INSTANCE.queueSize());
|
||||
}
|
||||
|
||||
String jsonFile = "/json/node/analysis/node_mapping_hour_analysis.json";
|
||||
|
||||
@Test
|
||||
public void testAnalyse() throws Exception {
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceSegment = segmentMock.mockCacheServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceSegment) {
|
||||
nodeMappingHourAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalService = segmentMock.mockPortalServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalService) {
|
||||
nodeMappingHourAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> persistenceService = segmentMock.mockPersistenceServiceSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : persistenceService) {
|
||||
nodeMappingHourAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceException = segmentMock.mockCacheServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceException) {
|
||||
nodeMappingHourAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalServiceException = segmentMock.mockPortalServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalServiceException) {
|
||||
nodeMappingHourAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
segmentMock.executeAnalysis(analysis);
|
||||
|
||||
nodeMappingHourAnalysis.onWork(new EndOfBatchCommand());
|
||||
|
||||
NodeMappingAnalysisVerify.INSTANCE.verify(recordDataAnswer.recordObj.getRecordData(), DateTools.changeToUTCSlice(201703310900L));
|
||||
List<RecordData> recordDataList = answer.getRecordDataList();
|
||||
RecordDataMergeJson.INSTANCE.merge(jsonFile, recordDataList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,12 @@ import com.a.eye.skywalking.collector.actor.ClusterWorkerContext;
|
|||
import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.WorkerRefs;
|
||||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.queue.EndOfBatchCommand;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.datamerge.RecordDataMergeJson;
|
||||
import com.a.eye.skywalking.collector.worker.mock.RecordDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.node.persistence.NodeMappingMinuteAgg;
|
||||
import com.a.eye.skywalking.collector.worker.segment.SegmentPost;
|
||||
import com.a.eye.skywalking.collector.worker.segment.mock.SegmentMock;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.a.eye.skywalking.collector.worker.tools.DateTools;
|
||||
import com.a.eye.skywalking.collector.worker.tools.RecordDataTool;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
@ -37,21 +34,21 @@ import static org.powermock.api.mockito.PowerMockito.when;
|
|||
@PowerMockIgnore({"javax.management.*"})
|
||||
public class NodeMappingMinuteAnalysisTestCase {
|
||||
|
||||
private NodeMappingMinuteAnalysis nodeMappingMinuteAnalysis;
|
||||
private NodeMappingMinuteAnalysis analysis;
|
||||
private SegmentMock segmentMock = new SegmentMock();
|
||||
private RecordDataAnswer recordDataAnswer;
|
||||
private RecordDataAnswer answer;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
ClusterWorkerContext clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
WorkerRefs workerRefs = mock(WorkerRefs.class);
|
||||
recordDataAnswer = new RecordDataAnswer();
|
||||
doAnswer(recordDataAnswer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
answer = new RecordDataAnswer();
|
||||
doAnswer(answer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
|
||||
when(clusterWorkerContext.lookup(NodeMappingMinuteAgg.Role.INSTANCE)).thenReturn(workerRefs);
|
||||
|
||||
LocalWorkerContext localWorkerContext = new LocalWorkerContext();
|
||||
nodeMappingMinuteAnalysis = new NodeMappingMinuteAnalysis(NodeMappingMinuteAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
analysis = new NodeMappingMinuteAnalysis(NodeMappingMinuteAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -70,55 +67,13 @@ public class NodeMappingMinuteAnalysisTestCase {
|
|||
Assert.assertEquals(testSize, NodeMappingMinuteAnalysis.Factory.INSTANCE.queueSize());
|
||||
}
|
||||
|
||||
String jsonFile = "/json/node/analysis/node_mapping_minute_analysis.json";
|
||||
|
||||
@Test
|
||||
public void testAnalyse() throws Exception {
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceSegment = segmentMock.mockCacheServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceSegment) {
|
||||
nodeMappingMinuteAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalService = segmentMock.mockPortalServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalService) {
|
||||
nodeMappingMinuteAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> persistenceService = segmentMock.mockPersistenceServiceSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : persistenceService) {
|
||||
nodeMappingMinuteAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceException = segmentMock.mockCacheServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceException) {
|
||||
nodeMappingMinuteAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalServiceException = segmentMock.mockPortalServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalServiceException) {
|
||||
nodeMappingMinuteAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
segmentMock.executeAnalysis(analysis);
|
||||
|
||||
nodeMappingMinuteAnalysis.onWork(new EndOfBatchCommand());
|
||||
|
||||
Assert.assertEquals(3, recordDataAnswer.recordObj.getRecordData().size());
|
||||
this.verify_1(recordDataAnswer.recordObj.getRecordData(), DateTools.changeToUTCSlice(201703310915L));
|
||||
this.verify_2(recordDataAnswer.recordObj.getRecordData(), DateTools.changeToUTCSlice(201703310916L));
|
||||
}
|
||||
|
||||
public void verify_1(List<RecordData> recordDataList, long timeSlice) {
|
||||
RecordData data_1 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..persistence-service..-..[10.128.35.80:20880]");
|
||||
Assert.assertEquals("persistence-service", data_1.getRecord().get("code").getAsString());
|
||||
Assert.assertEquals("[10.128.35.80:20880]", data_1.getRecord().get("peers").getAsString());
|
||||
Assert.assertEquals("persistence-service..-..[10.128.35.80:20880]", data_1.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_1.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_2 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..cache-service..-..[127.0.0.1:8002]");
|
||||
Assert.assertEquals("cache-service", data_2.getRecord().get("code").getAsString());
|
||||
Assert.assertEquals("[127.0.0.1:8002]", data_2.getRecord().get("peers").getAsString());
|
||||
Assert.assertEquals("cache-service..-..[127.0.0.1:8002]", data_2.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_2.getRecord().get("timeSlice").getAsLong());
|
||||
}
|
||||
|
||||
public void verify_2(List<RecordData> recordDataList, long timeSlice) {
|
||||
RecordData data_2 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..cache-service..-..[127.0.0.1:8002]");
|
||||
Assert.assertEquals("cache-service", data_2.getRecord().get("code").getAsString());
|
||||
Assert.assertEquals("[127.0.0.1:8002]", data_2.getRecord().get("peers").getAsString());
|
||||
Assert.assertEquals("cache-service..-..[127.0.0.1:8002]", data_2.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_2.getRecord().get("timeSlice").getAsLong());
|
||||
List<RecordData> recordDataList = answer.getRecordDataList();
|
||||
RecordDataMergeJson.INSTANCE.merge(jsonFile, recordDataList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.a.eye.skywalking.collector.worker.noderef.analysis;
|
||||
|
||||
import com.a.eye.skywalking.collector.worker.datamerge.JsonDataMerge;
|
||||
import com.a.eye.skywalking.collector.worker.datamerge.RecordDataMergeJson;
|
||||
import com.a.eye.skywalking.collector.worker.mock.RecordDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.segment.mock.SegmentMock;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
public enum NodeRefAnalyse {
|
||||
INSTANCE;
|
||||
|
||||
public void analyse(String resSumJsonFile, String jsonFile, AbstractNodeRefAnalysis analysis, RecordDataAnswer answer, NodeRefResRecordAnswer recordAnswer) throws Exception {
|
||||
SegmentMock segmentMock = new SegmentMock();
|
||||
segmentMock.executeAnalysis(analysis);
|
||||
|
||||
List<RecordData> recordDataList = answer.getRecordDataList();
|
||||
RecordDataMergeJson.INSTANCE.merge(jsonFile, recordDataList);
|
||||
|
||||
Gson gson = new Gson();
|
||||
String recordJsonStr = gson.toJson(recordAnswer.getNodeRefResRecordList());
|
||||
System.out.println(recordJsonStr);
|
||||
|
||||
System.out.println("--------------------------------");
|
||||
JsonArray recordJsonArray = gson.fromJson(recordJsonStr, JsonArray.class);
|
||||
JsonDataMerge.INSTANCE.merge(resSumJsonFile, recordJsonArray);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
package com.a.eye.skywalking.collector.worker.noderef.analysis;
|
||||
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.a.eye.skywalking.collector.worker.tools.RecordDataTool;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
public enum NodeRefAnalysisVerify {
|
||||
INSTANCE;
|
||||
|
||||
public void verify(List<RecordData> recordDataList, long timeSlice) {
|
||||
Assert.assertEquals(6, recordDataList.size());
|
||||
|
||||
RecordData data_1 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..portal-service..-..[10.128.35.80:20880]");
|
||||
Assert.assertEquals(true, data_1.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(false, data_1.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("portal-service", data_1.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("[10.128.35.80:20880]", data_1.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("portal-service..-..[10.128.35.80:20880]", data_1.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_1.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_2 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..cache-service..-..[127.0.0.1:6379]");
|
||||
Assert.assertEquals(true, data_2.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(false, data_2.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("cache-service", data_2.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("[127.0.0.1:6379]", data_2.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("cache-service..-..[127.0.0.1:6379]", data_2.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_2.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_3 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..cache-service..-..[localhost:-1]");
|
||||
Assert.assertEquals(true, data_3.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(false, data_3.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("cache-service", data_3.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("[localhost:-1]", data_3.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("cache-service..-..[localhost:-1]", data_3.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_3.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_4 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..User..-..portal-service");
|
||||
Assert.assertEquals(true, data_4.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(true, data_4.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("User", data_4.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("portal-service", data_4.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("User..-..portal-service", data_4.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_4.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_5 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..portal-service..-..[127.0.0.1:8002]");
|
||||
Assert.assertEquals(true, data_5.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(false, data_5.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("portal-service", data_5.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("[127.0.0.1:8002]", data_5.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("portal-service..-..[127.0.0.1:8002]", data_5.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_5.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_6 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..persistence-service..-..[127.0.0.1:3307]");
|
||||
Assert.assertEquals(true, data_6.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(false, data_6.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("persistence-service", data_6.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("[127.0.0.1:3307]", data_6.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("persistence-service..-..[127.0.0.1:3307]", data_6.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_6.getRecord().get("timeSlice").getAsLong());
|
||||
}
|
||||
}
|
||||
|
|
@ -2,30 +2,25 @@ package com.a.eye.skywalking.collector.worker.noderef.analysis;
|
|||
|
||||
import com.a.eye.skywalking.collector.actor.ClusterWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.ProviderNotFoundException;
|
||||
import com.a.eye.skywalking.collector.actor.WorkerRefs;
|
||||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.queue.EndOfBatchCommand;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.mock.RecordDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.noderef.persistence.NodeRefDayAgg;
|
||||
import com.a.eye.skywalking.collector.worker.segment.SegmentPost;
|
||||
import com.a.eye.skywalking.collector.worker.segment.mock.SegmentMock;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.a.eye.skywalking.collector.worker.tools.DateTools;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
/**
|
||||
|
|
@ -36,23 +31,28 @@ import static org.powermock.api.mockito.PowerMockito.when;
|
|||
@PowerMockIgnore({"javax.management.*"})
|
||||
public class NodeRefDayAnalysisTestCase {
|
||||
|
||||
private NodeRefDayAnalysis nodeRefDayAnalysis;
|
||||
private SegmentMock segmentMock = new SegmentMock();
|
||||
private RecordDataAnswer recordDataAnswer;
|
||||
private NodeRefDayAnalysis analysis;
|
||||
private RecordDataAnswer answer;
|
||||
private ClusterWorkerContext clusterWorkerContext;
|
||||
private NodeRefResRecordAnswer recordAnswer;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
ClusterWorkerContext clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
WorkerRefs workerRefs = mock(WorkerRefs.class);
|
||||
recordDataAnswer = new RecordDataAnswer();
|
||||
doAnswer(recordDataAnswer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
answer = new RecordDataAnswer();
|
||||
doAnswer(answer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
|
||||
when(clusterWorkerContext.lookup(NodeRefDayAgg.Role.INSTANCE)).thenReturn(workerRefs);
|
||||
|
||||
LocalWorkerContext localWorkerContext = PowerMockito.mock(LocalWorkerContext.class);
|
||||
|
||||
WorkerRefs nodeRefResSumWorkerRefs = mock(WorkerRefs.class);
|
||||
recordAnswer = new NodeRefResRecordAnswer();
|
||||
doAnswer(recordAnswer).when(nodeRefResSumWorkerRefs).tell(Mockito.any(AbstractNodeRefResSumAnalysis.NodeRefResRecord.class));
|
||||
|
||||
when(localWorkerContext.lookup(NodeRefResSumDayAnalysis.Role.INSTANCE)).thenReturn(nodeRefResSumWorkerRefs);
|
||||
nodeRefDayAnalysis = new NodeRefDayAnalysis(NodeRefDayAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
analysis = new NodeRefDayAnalysis(NodeRefDayAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -71,32 +71,20 @@ public class NodeRefDayAnalysisTestCase {
|
|||
Assert.assertEquals(testSize, NodeRefDayAnalysis.Factory.INSTANCE.queueSize());
|
||||
}
|
||||
|
||||
String jsonFile = "/json/noderef/analysis/noderef_day_analysis.json";
|
||||
String resSumJsonFile = "/json/noderef/analysis/noderef_ressum_day_analysis_request.json";
|
||||
|
||||
@Test
|
||||
public void testAnalyse() throws Exception {
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceSegment = segmentMock.mockCacheServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceSegment) {
|
||||
nodeRefDayAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalService = segmentMock.mockPortalServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalService) {
|
||||
nodeRefDayAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> persistenceService = segmentMock.mockPersistenceServiceSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : persistenceService) {
|
||||
nodeRefDayAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceException = segmentMock.mockCacheServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceException) {
|
||||
nodeRefDayAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalServiceException = segmentMock.mockPortalServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalServiceException) {
|
||||
nodeRefDayAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
NodeRefAnalyse.INSTANCE.analyse(resSumJsonFile, jsonFile, analysis, answer, recordAnswer);
|
||||
}
|
||||
|
||||
nodeRefDayAnalysis.onWork(new EndOfBatchCommand());
|
||||
@Test
|
||||
public void testPreStart() throws ProviderNotFoundException {
|
||||
Mockito.when(clusterWorkerContext.findProvider(NodeRefResSumDayAnalysis.Role.INSTANCE)).thenReturn(NodeRefResSumDayAnalysis.Factory.INSTANCE);
|
||||
|
||||
List<RecordData> recordDataList = recordDataAnswer.recordObj.getRecordData();
|
||||
NodeRefAnalysisVerify.INSTANCE.verify(recordDataList, DateTools.changeToUTCSlice(201703310000L));
|
||||
ArgumentCaptor<NodeRefResSumDayAnalysis.Role> argumentCaptor = ArgumentCaptor.forClass(NodeRefResSumDayAnalysis.Role.class);
|
||||
analysis.preStart();
|
||||
verify(clusterWorkerContext).findProvider(argumentCaptor.capture());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,31 +2,25 @@ package com.a.eye.skywalking.collector.worker.noderef.analysis;
|
|||
|
||||
import com.a.eye.skywalking.collector.actor.ClusterWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.ProviderNotFoundException;
|
||||
import com.a.eye.skywalking.collector.actor.WorkerRefs;
|
||||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.queue.EndOfBatchCommand;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.mock.RecordDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.node.analysis.NodeAnalysisVerify;
|
||||
import com.a.eye.skywalking.collector.worker.noderef.persistence.NodeRefHourAgg;
|
||||
import com.a.eye.skywalking.collector.worker.segment.SegmentPost;
|
||||
import com.a.eye.skywalking.collector.worker.segment.mock.SegmentMock;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.a.eye.skywalking.collector.worker.tools.DateTools;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
/**
|
||||
|
|
@ -37,23 +31,27 @@ import static org.powermock.api.mockito.PowerMockito.when;
|
|||
@PowerMockIgnore({"javax.management.*"})
|
||||
public class NodeRefHourAnalysisTestCase {
|
||||
|
||||
private NodeRefHourAnalysis nodeRefHourAnalysis;
|
||||
private SegmentMock segmentMock = new SegmentMock();
|
||||
private RecordDataAnswer recordDataAnswer;
|
||||
private NodeRefHourAnalysis analysis;
|
||||
private RecordDataAnswer answer;
|
||||
private ClusterWorkerContext clusterWorkerContext;
|
||||
private NodeRefResRecordAnswer recordAnswer;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
ClusterWorkerContext clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
WorkerRefs workerRefs = mock(WorkerRefs.class);
|
||||
recordDataAnswer = new RecordDataAnswer();
|
||||
doAnswer(recordDataAnswer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
answer = new RecordDataAnswer();
|
||||
doAnswer(answer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
|
||||
when(clusterWorkerContext.lookup(NodeRefHourAgg.Role.INSTANCE)).thenReturn(workerRefs);
|
||||
|
||||
LocalWorkerContext localWorkerContext = PowerMockito.mock(LocalWorkerContext.class);
|
||||
|
||||
WorkerRefs nodeRefResSumWorkerRefs = mock(WorkerRefs.class);
|
||||
recordAnswer = new NodeRefResRecordAnswer();
|
||||
doAnswer(recordAnswer).when(nodeRefResSumWorkerRefs).tell(Mockito.any(AbstractNodeRefResSumAnalysis.NodeRefResRecord.class));
|
||||
|
||||
when(localWorkerContext.lookup(NodeRefResSumHourAnalysis.Role.INSTANCE)).thenReturn(nodeRefResSumWorkerRefs);
|
||||
nodeRefHourAnalysis = new NodeRefHourAnalysis(NodeRefHourAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
analysis = new NodeRefHourAnalysis(NodeRefHourAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -72,31 +70,20 @@ public class NodeRefHourAnalysisTestCase {
|
|||
Assert.assertEquals(testSize, NodeRefHourAnalysis.Factory.INSTANCE.queueSize());
|
||||
}
|
||||
|
||||
String jsonFile = "/json/noderef/analysis/noderef_hour_analysis.json";
|
||||
String resSumJsonFile = "/json/noderef/analysis/noderef_ressum_hour_analysis_request.json";
|
||||
|
||||
@Test
|
||||
public void testAnalyse() throws Exception {
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceSegment = segmentMock.mockCacheServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceSegment) {
|
||||
nodeRefHourAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalService = segmentMock.mockPortalServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalService) {
|
||||
nodeRefHourAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> persistenceService = segmentMock.mockPersistenceServiceSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : persistenceService) {
|
||||
nodeRefHourAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceException = segmentMock.mockCacheServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceException) {
|
||||
nodeRefHourAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalServiceException = segmentMock.mockPortalServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalServiceException) {
|
||||
nodeRefHourAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
NodeRefAnalyse.INSTANCE.analyse(resSumJsonFile, jsonFile, analysis, answer, recordAnswer);
|
||||
}
|
||||
|
||||
nodeRefHourAnalysis.onWork(new EndOfBatchCommand());
|
||||
@Test
|
||||
public void testPreStart() throws ProviderNotFoundException {
|
||||
Mockito.when(clusterWorkerContext.findProvider(NodeRefResSumHourAnalysis.Role.INSTANCE)).thenReturn(NodeRefResSumHourAnalysis.Factory.INSTANCE);
|
||||
|
||||
NodeRefAnalysisVerify.INSTANCE.verify(recordDataAnswer.recordObj.getRecordData(), DateTools.changeToUTCSlice(201703310900L));
|
||||
ArgumentCaptor<NodeRefResSumHourAnalysis.Role> argumentCaptor = ArgumentCaptor.forClass(NodeRefResSumHourAnalysis.Role.class);
|
||||
analysis.preStart();
|
||||
verify(clusterWorkerContext).findProvider(argumentCaptor.capture());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,33 +2,25 @@ package com.a.eye.skywalking.collector.worker.noderef.analysis;
|
|||
|
||||
import com.a.eye.skywalking.collector.actor.ClusterWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.ProviderNotFoundException;
|
||||
import com.a.eye.skywalking.collector.actor.WorkerRefs;
|
||||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.queue.EndOfBatchCommand;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.mock.RecordDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.node.analysis.NodeAnalysisVerify;
|
||||
import com.a.eye.skywalking.collector.worker.noderef.persistence.NodeRefMinuteAgg;
|
||||
import com.a.eye.skywalking.collector.worker.segment.SegmentPost;
|
||||
import com.a.eye.skywalking.collector.worker.segment.mock.SegmentMock;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import com.a.eye.skywalking.collector.worker.tools.DateTools;
|
||||
import com.a.eye.skywalking.collector.worker.tools.RecordDataTool;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
/**
|
||||
|
|
@ -39,23 +31,28 @@ import static org.powermock.api.mockito.PowerMockito.when;
|
|||
@PowerMockIgnore({"javax.management.*"})
|
||||
public class NodeRefMinuteAnalysisTestCase {
|
||||
|
||||
private NodeRefMinuteAnalysis nodeRefMinuteAnalysis;
|
||||
private SegmentMock segmentMock = new SegmentMock();
|
||||
private RecordDataAnswer recordDataAnswer;
|
||||
private NodeRefMinuteAnalysis analysis;
|
||||
private RecordDataAnswer answer;
|
||||
private ClusterWorkerContext clusterWorkerContext;
|
||||
private NodeRefResRecordAnswer recordAnswer;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
ClusterWorkerContext clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
WorkerRefs workerRefs = mock(WorkerRefs.class);
|
||||
recordDataAnswer = new RecordDataAnswer();
|
||||
doAnswer(recordDataAnswer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
answer = new RecordDataAnswer();
|
||||
doAnswer(answer).when(workerRefs).tell(Mockito.any(RecordData.class));
|
||||
|
||||
when(clusterWorkerContext.lookup(NodeRefMinuteAgg.Role.INSTANCE)).thenReturn(workerRefs);
|
||||
|
||||
LocalWorkerContext localWorkerContext = PowerMockito.mock(LocalWorkerContext.class);
|
||||
|
||||
WorkerRefs nodeRefResSumWorkerRefs = mock(WorkerRefs.class);
|
||||
recordAnswer = new NodeRefResRecordAnswer();
|
||||
doAnswer(recordAnswer).when(nodeRefResSumWorkerRefs).tell(Mockito.any(AbstractNodeRefResSumAnalysis.NodeRefResRecord.class));
|
||||
|
||||
when(localWorkerContext.lookup(NodeRefResSumMinuteAnalysis.Role.INSTANCE)).thenReturn(nodeRefResSumWorkerRefs);
|
||||
nodeRefMinuteAnalysis = new NodeRefMinuteAnalysis(NodeRefMinuteAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
analysis = new NodeRefMinuteAnalysis(NodeRefMinuteAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -74,101 +71,20 @@ public class NodeRefMinuteAnalysisTestCase {
|
|||
Assert.assertEquals(testSize, NodeRefMinuteAnalysis.Factory.INSTANCE.queueSize());
|
||||
}
|
||||
|
||||
String jsonFile = "/json/noderef/analysis/noderef_minute_analysis.json";
|
||||
String resSumJsonFile = "/json/noderef/analysis/noderef_ressum_minute_analysis_request.json";
|
||||
|
||||
@Test
|
||||
public void testAnalyse() throws Exception {
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceSegment = segmentMock.mockCacheServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceSegment) {
|
||||
nodeRefMinuteAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalService = segmentMock.mockPortalServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalService) {
|
||||
nodeRefMinuteAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> persistenceService = segmentMock.mockPersistenceServiceSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : persistenceService) {
|
||||
nodeRefMinuteAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceException = segmentMock.mockCacheServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceException) {
|
||||
nodeRefMinuteAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalServiceException = segmentMock.mockPortalServiceExceptionSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalServiceException) {
|
||||
nodeRefMinuteAnalysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
|
||||
nodeRefMinuteAnalysis.onWork(new EndOfBatchCommand());
|
||||
|
||||
Assert.assertEquals(8, recordDataAnswer.recordObj.getRecordData().size());
|
||||
this.verify_1(recordDataAnswer.recordObj.getRecordData(), DateTools.changeToUTCSlice(201703310915L));
|
||||
this.verify_2(recordDataAnswer.recordObj.getRecordData(), DateTools.changeToUTCSlice(201703310916L));
|
||||
NodeRefAnalyse.INSTANCE.analyse(resSumJsonFile, jsonFile, analysis, answer, recordAnswer);
|
||||
}
|
||||
|
||||
public void verify_1(List<RecordData> recordDataList, long timeSlice) {
|
||||
RecordData data_5 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..portal-service..-..[127.0.0.1:8002]");
|
||||
Assert.assertEquals(true, data_5.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(false, data_5.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("portal-service", data_5.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("[127.0.0.1:8002]", data_5.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("portal-service..-..[127.0.0.1:8002]", data_5.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_5.getRecord().get("timeSlice").getAsLong());
|
||||
@Test
|
||||
public void testPreStart() throws ProviderNotFoundException {
|
||||
Mockito.when(clusterWorkerContext.findProvider(NodeRefResSumMinuteAnalysis.Role.INSTANCE)).thenReturn(NodeRefResSumMinuteAnalysis.Factory.INSTANCE);
|
||||
|
||||
RecordData data_3 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..cache-service..-..[localhost:-1]");
|
||||
Assert.assertEquals(true, data_3.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(false, data_3.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("cache-service", data_3.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("[localhost:-1]", data_3.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("cache-service..-..[localhost:-1]", data_3.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_3.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_4 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..User..-..portal-service");
|
||||
Assert.assertEquals(true, data_4.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(true, data_4.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("User", data_4.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("portal-service", data_4.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("User..-..portal-service", data_4.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_4.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_2 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..cache-service..-..[127.0.0.1:6379]");
|
||||
Assert.assertEquals(true, data_2.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(false, data_2.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("cache-service", data_2.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("[127.0.0.1:6379]", data_2.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("cache-service..-..[127.0.0.1:6379]", data_2.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_2.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_1 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..portal-service..-..[10.128.35.80:20880]");
|
||||
Assert.assertEquals(true, data_1.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(false, data_1.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("portal-service", data_1.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("[10.128.35.80:20880]", data_1.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("portal-service..-..[10.128.35.80:20880]", data_1.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_1.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_6 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..persistence-service..-..[127.0.0.1:3307]");
|
||||
Assert.assertEquals(true, data_6.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(false, data_6.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("persistence-service", data_6.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("[127.0.0.1:3307]", data_6.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("persistence-service..-..[127.0.0.1:3307]", data_6.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_6.getRecord().get("timeSlice").getAsLong());
|
||||
}
|
||||
|
||||
public void verify_2(List<RecordData> recordDataList, long timeSlice) {
|
||||
RecordData data_5 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..portal-service..-..[127.0.0.1:8002]");
|
||||
Assert.assertEquals(true, data_5.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(false, data_5.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("portal-service", data_5.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("[127.0.0.1:8002]", data_5.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("portal-service..-..[127.0.0.1:8002]", data_5.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_5.getRecord().get("timeSlice").getAsLong());
|
||||
|
||||
RecordData data_4 = RecordDataTool.INSTANCE.getRecord(recordDataList, timeSlice + "..-..User..-..portal-service");
|
||||
Assert.assertEquals(true, data_4.getRecord().get("frontIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals(true, data_4.getRecord().get("behindIsRealCode").getAsBoolean());
|
||||
Assert.assertEquals("User", data_4.getRecord().get("front").getAsString());
|
||||
Assert.assertEquals("portal-service", data_4.getRecord().get("behind").getAsString());
|
||||
Assert.assertEquals("User..-..portal-service", data_4.getRecord().get("aggId").getAsString());
|
||||
Assert.assertEquals(timeSlice, data_4.getRecord().get("timeSlice").getAsLong());
|
||||
ArgumentCaptor<NodeRefResSumMinuteAnalysis.Role> argumentCaptor = ArgumentCaptor.forClass(NodeRefResSumMinuteAnalysis.Role.class);
|
||||
analysis.preStart();
|
||||
verify(clusterWorkerContext).findProvider(argumentCaptor.capture());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.a.eye.skywalking.collector.worker.noderef.analysis;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
public class NodeRefResRecordAnswer implements Answer<Object> {
|
||||
|
||||
private Gson gson = new Gson();
|
||||
private List<JsonObject> nodeRefResRecordList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
AbstractNodeRefResSumAnalysis.NodeRefResRecord nodeRefResRecord = (AbstractNodeRefResSumAnalysis.NodeRefResRecord) invocation.getArguments()[0];
|
||||
String recordJsonStr = gson.toJson(nodeRefResRecord);
|
||||
JsonObject recordJsonObj = gson.fromJson(recordJsonStr, JsonObject.class);
|
||||
|
||||
System.out.printf("NodeRefId: %s \n", nodeRefResRecord.getNodeRefId());
|
||||
System.out.printf("NodeRefResRecord data: %s \n", recordJsonStr);
|
||||
nodeRefResRecordList.add(recordJsonObj);
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<JsonObject> getNodeRefResRecordList() {
|
||||
return nodeRefResRecordList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.a.eye.skywalking.collector.worker.noderef.analysis;
|
||||
|
||||
import com.a.eye.skywalking.collector.queue.EndOfBatchCommand;
|
||||
import com.a.eye.skywalking.collector.worker.datamerge.MetricDataMergeJson;
|
||||
import com.a.eye.skywalking.collector.worker.mock.MetricDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.segment.mock.SegmentMock;
|
||||
import com.a.eye.skywalking.collector.worker.storage.MetricData;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
public enum NodeRefResSumAnalyse {
|
||||
INSTANCE;
|
||||
|
||||
public void analyse(String requestJsonFile, String jsonFile, AbstractNodeRefResSumAnalysis analysis, MetricDataAnswer answer) throws Exception {
|
||||
SegmentMock segmentMock = new SegmentMock();
|
||||
String requestJsonStr = segmentMock.loadJsonFile(requestJsonFile);
|
||||
Gson gson = new Gson();
|
||||
List<AbstractNodeRefResSumAnalysis.NodeRefResRecord> resRecordList = gson.fromJson(requestJsonStr, new TypeToken<List<AbstractNodeRefResSumAnalysis.NodeRefResRecord>>() {
|
||||
}.getType());
|
||||
|
||||
for (AbstractNodeRefResSumAnalysis.NodeRefResRecord resRecord : resRecordList) {
|
||||
analysis.analyse(resRecord);
|
||||
}
|
||||
|
||||
analysis.onWork(new EndOfBatchCommand());
|
||||
List<MetricData> metricDataList = answer.getMetricDataList();
|
||||
MetricDataMergeJson.INSTANCE.merge(jsonFile, metricDataList);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.a.eye.skywalking.collector.worker.noderef.analysis;
|
||||
|
||||
import com.a.eye.skywalking.collector.actor.ClusterWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.WorkerRefs;
|
||||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.mock.MetricDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.noderef.persistence.NodeRefResSumDayAgg;
|
||||
import com.a.eye.skywalking.collector.worker.storage.MetricData;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({ClusterWorkerContext.class})
|
||||
@PowerMockIgnore({"javax.management.*"})
|
||||
public class NodeRefResSumDayAnalysisTestCase {
|
||||
|
||||
private NodeRefResSumDayAnalysis analysis;
|
||||
private MetricDataAnswer answer;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
ClusterWorkerContext clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
WorkerRefs workerRefs = mock(WorkerRefs.class);
|
||||
answer = new MetricDataAnswer();
|
||||
doAnswer(answer).when(workerRefs).tell(Mockito.any(MetricData.class));
|
||||
|
||||
when(clusterWorkerContext.lookup(NodeRefResSumDayAgg.Role.INSTANCE)).thenReturn(workerRefs);
|
||||
|
||||
LocalWorkerContext localWorkerContext = PowerMockito.mock(LocalWorkerContext.class);
|
||||
analysis = new NodeRefResSumDayAnalysis(NodeRefResSumDayAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRole() {
|
||||
Assert.assertEquals(NodeRefResSumDayAnalysis.class.getSimpleName(), NodeRefResSumDayAnalysis.Role.INSTANCE.roleName());
|
||||
Assert.assertEquals(RollingSelector.class.getSimpleName(), NodeRefResSumDayAnalysis.Role.INSTANCE.workerSelector().getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFactory() {
|
||||
Assert.assertEquals(NodeRefResSumDayAnalysis.class.getSimpleName(), NodeRefResSumDayAnalysis.Factory.INSTANCE.role().roleName());
|
||||
Assert.assertEquals(NodeRefResSumDayAnalysis.class.getSimpleName(), NodeRefResSumDayAnalysis.Factory.INSTANCE.workerInstance(null).getClass().getSimpleName());
|
||||
|
||||
int testSize = 10;
|
||||
WorkerConfig.Queue.NodeRef.NodeRefResSumDayAnalysis.Size = testSize;
|
||||
Assert.assertEquals(testSize, NodeRefResSumDayAnalysis.Factory.INSTANCE.queueSize());
|
||||
}
|
||||
|
||||
String jsonFile = "/json/noderef/analysis/noderef_ressum_day_analysis.json";
|
||||
String requestJsonFile = "/json/noderef/analysis/noderef_ressum_day_analysis_request.json";
|
||||
|
||||
@Test
|
||||
public void testAnalyse() throws Exception {
|
||||
NodeRefResSumAnalyse.INSTANCE.analyse(requestJsonFile, jsonFile, analysis, answer);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.a.eye.skywalking.collector.worker.noderef.analysis;
|
||||
|
||||
import com.a.eye.skywalking.collector.actor.ClusterWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.WorkerRefs;
|
||||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.mock.MetricDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.noderef.persistence.NodeRefResSumHourAgg;
|
||||
import com.a.eye.skywalking.collector.worker.storage.MetricData;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({ClusterWorkerContext.class})
|
||||
@PowerMockIgnore({"javax.management.*"})
|
||||
public class NodeRefResSumHourAnalysisTestCase {
|
||||
|
||||
private NodeRefResSumHourAnalysis analysis;
|
||||
private MetricDataAnswer answer;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
ClusterWorkerContext clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
WorkerRefs workerRefs = mock(WorkerRefs.class);
|
||||
answer = new MetricDataAnswer();
|
||||
doAnswer(answer).when(workerRefs).tell(Mockito.any(MetricData.class));
|
||||
|
||||
when(clusterWorkerContext.lookup(NodeRefResSumHourAgg.Role.INSTANCE)).thenReturn(workerRefs);
|
||||
|
||||
LocalWorkerContext localWorkerContext = PowerMockito.mock(LocalWorkerContext.class);
|
||||
analysis = new NodeRefResSumHourAnalysis(NodeRefResSumHourAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRole() {
|
||||
Assert.assertEquals(NodeRefResSumHourAnalysis.class.getSimpleName(), NodeRefResSumHourAnalysis.Role.INSTANCE.roleName());
|
||||
Assert.assertEquals(RollingSelector.class.getSimpleName(), NodeRefResSumHourAnalysis.Role.INSTANCE.workerSelector().getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFactory() {
|
||||
Assert.assertEquals(NodeRefResSumHourAnalysis.class.getSimpleName(), NodeRefResSumHourAnalysis.Factory.INSTANCE.role().roleName());
|
||||
Assert.assertEquals(NodeRefResSumHourAnalysis.class.getSimpleName(), NodeRefResSumHourAnalysis.Factory.INSTANCE.workerInstance(null).getClass().getSimpleName());
|
||||
|
||||
int testSize = 10;
|
||||
WorkerConfig.Queue.NodeRef.NodeRefResSumHourAnalysis.Size = testSize;
|
||||
Assert.assertEquals(testSize, NodeRefResSumHourAnalysis.Factory.INSTANCE.queueSize());
|
||||
}
|
||||
|
||||
String jsonFile = "/json/noderef/analysis/noderef_ressum_hour_analysis.json";
|
||||
String requestJsonFile = "/json/noderef/analysis/noderef_ressum_hour_analysis_request.json";
|
||||
|
||||
@Test
|
||||
public void testAnalyse() throws Exception {
|
||||
NodeRefResSumAnalyse.INSTANCE.analyse(requestJsonFile, jsonFile, analysis, answer);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.a.eye.skywalking.collector.worker.noderef.analysis;
|
||||
|
||||
import com.a.eye.skywalking.collector.actor.ClusterWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.LocalWorkerContext;
|
||||
import com.a.eye.skywalking.collector.actor.WorkerRefs;
|
||||
import com.a.eye.skywalking.collector.actor.selector.RollingSelector;
|
||||
import com.a.eye.skywalking.collector.worker.WorkerConfig;
|
||||
import com.a.eye.skywalking.collector.worker.mock.MetricDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.noderef.persistence.NodeRefResSumMinuteAgg;
|
||||
import com.a.eye.skywalking.collector.worker.storage.MetricData;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
/**
|
||||
* @author pengys5
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({ClusterWorkerContext.class})
|
||||
@PowerMockIgnore({"javax.management.*"})
|
||||
public class NodeRefResSumMinuteAnalysisTestCase {
|
||||
|
||||
private NodeRefResSumMinuteAnalysis analysis;
|
||||
private MetricDataAnswer answer;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
ClusterWorkerContext clusterWorkerContext = PowerMockito.mock(ClusterWorkerContext.class);
|
||||
WorkerRefs workerRefs = mock(WorkerRefs.class);
|
||||
answer = new MetricDataAnswer();
|
||||
doAnswer(answer).when(workerRefs).tell(Mockito.any(MetricData.class));
|
||||
|
||||
when(clusterWorkerContext.lookup(NodeRefResSumMinuteAgg.Role.INSTANCE)).thenReturn(workerRefs);
|
||||
|
||||
LocalWorkerContext localWorkerContext = PowerMockito.mock(LocalWorkerContext.class);
|
||||
analysis = new NodeRefResSumMinuteAnalysis(NodeRefResSumMinuteAnalysis.Role.INSTANCE, clusterWorkerContext, localWorkerContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRole() {
|
||||
Assert.assertEquals(NodeRefResSumMinuteAnalysis.class.getSimpleName(), NodeRefResSumMinuteAnalysis.Role.INSTANCE.roleName());
|
||||
Assert.assertEquals(RollingSelector.class.getSimpleName(), NodeRefResSumMinuteAnalysis.Role.INSTANCE.workerSelector().getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFactory() {
|
||||
Assert.assertEquals(NodeRefResSumMinuteAnalysis.class.getSimpleName(), NodeRefResSumMinuteAnalysis.Factory.INSTANCE.role().roleName());
|
||||
Assert.assertEquals(NodeRefResSumMinuteAnalysis.class.getSimpleName(), NodeRefResSumMinuteAnalysis.Factory.INSTANCE.workerInstance(null).getClass().getSimpleName());
|
||||
|
||||
int testSize = 10;
|
||||
WorkerConfig.Queue.NodeRef.NodeRefResSumMinuteAnalysis.Size = testSize;
|
||||
Assert.assertEquals(testSize, NodeRefResSumMinuteAnalysis.Factory.INSTANCE.queueSize());
|
||||
}
|
||||
|
||||
String jsonFile = "/json/noderef/analysis/noderef_ressum_minute_analysis.json";
|
||||
String requestJsonFile = "/json/noderef/analysis/noderef_ressum_minute_analysis_request.json";
|
||||
|
||||
@Test
|
||||
public void testAnalyse() throws Exception {
|
||||
NodeRefResSumAnalyse.INSTANCE.analyse(requestJsonFile, jsonFile, analysis, answer);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.a.eye.skywalking.collector.worker.segment.mock;
|
||||
|
||||
import com.a.eye.skywalking.collector.queue.EndOfBatchCommand;
|
||||
import com.a.eye.skywalking.collector.worker.AnalysisMember;
|
||||
import com.a.eye.skywalking.collector.worker.segment.SegmentPost;
|
||||
import com.a.eye.skywalking.collector.worker.tools.DateTools;
|
||||
import com.a.eye.skywalking.collector.worker.tools.JsonFileReader;
|
||||
|
|
@ -32,6 +34,10 @@ public class SegmentMock {
|
|||
|
||||
private final String SpecialJsonFile = path + "/json/segment/post/special/special.json";
|
||||
|
||||
public String loadJsonFile(String fileName) throws FileNotFoundException {
|
||||
return JsonFileReader.INSTANCE.read(path + fileName);
|
||||
}
|
||||
|
||||
public String mockSpecialSegmentAsString() throws FileNotFoundException {
|
||||
return JsonFileReader.INSTANCE.read(SpecialJsonFile);
|
||||
}
|
||||
|
|
@ -113,4 +119,23 @@ public class SegmentMock {
|
|||
SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice = new SegmentPost.SegmentWithTimeSlice(newSegment, minuteSlice, hourSlice, daySlice, second);
|
||||
return segmentWithTimeSlice;
|
||||
}
|
||||
|
||||
public void executeAnalysis(AnalysisMember analysis) throws Exception {
|
||||
List<SegmentPost.SegmentWithTimeSlice> cacheServiceSegment = this.mockCacheServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : cacheServiceSegment) {
|
||||
analysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
|
||||
List<SegmentPost.SegmentWithTimeSlice> portalServiceSegment = this.mockPortalServiceSegmentSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : portalServiceSegment) {
|
||||
analysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
|
||||
List<SegmentPost.SegmentWithTimeSlice> persistenceServiceSegment = this.mockPersistenceServiceSegmentTimeSlice();
|
||||
for (SegmentPost.SegmentWithTimeSlice segmentWithTimeSlice : persistenceServiceSegment) {
|
||||
analysis.analyse(segmentWithTimeSlice);
|
||||
}
|
||||
|
||||
analysis.onWork(new EndOfBatchCommand());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.a.eye.skywalking.collector.worker.storage.IndexCreator;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import static org.powermock.api.mockito.PowerMockito.spy;
|
||||
|
|
@ -28,4 +29,16 @@ public class DateToolsTestCase {
|
|||
long changedTimeSlice = DateTools.changeToUTCSlice(timeSlice);
|
||||
Assert.assertEquals(201703310915L, changedTimeSlice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(1490922929258L);
|
||||
calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) - 3);
|
||||
System.out.println(calendar.getTimeInMillis());
|
||||
calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) - 2);
|
||||
System.out.println(calendar.getTimeInMillis());
|
||||
calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) - 2);
|
||||
System.out.println(calendar.getTimeInMillis());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@ public enum MergeDataAggTools {
|
|||
MergeData mergeData = new MergeData(id);
|
||||
mergeData.setMergeData("Column", "Value");
|
||||
agg.allocateJob(mergeData);
|
||||
Assert.assertEquals("Value", mergeDataAnswer.mergeObj.get("Column"));
|
||||
Assert.assertEquals("Value", mergeDataAnswer.getMergeDataList().get(0).toMap().get("Column"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@ package com.a.eye.skywalking.collector.worker.tools;
|
|||
import com.a.eye.skywalking.collector.actor.AbstractClusterWorker;
|
||||
import com.a.eye.skywalking.collector.worker.Const;
|
||||
import com.a.eye.skywalking.collector.worker.mock.MetricDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.mock.RecordDataAnswer;
|
||||
import com.a.eye.skywalking.collector.worker.storage.MetricData;
|
||||
import com.a.eye.skywalking.collector.worker.storage.RecordData;
|
||||
import org.junit.Assert;
|
||||
|
||||
/**
|
||||
|
|
@ -18,6 +16,6 @@ public enum MetricDataAggTools {
|
|||
String id = "2016" + Const.ID_SPLIT + "A" + Const.ID_SPLIT + "B";
|
||||
MetricData metricData = new MetricData(id);
|
||||
agg.allocateJob(metricData);
|
||||
Assert.assertEquals("A" + Const.ID_SPLIT + "B", metricDataAnswer.metricObj.get("aggId"));
|
||||
Assert.assertEquals("A" + Const.ID_SPLIT + "B", metricDataAnswer.getMetricDataList().get(0).toMap().get("aggId"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public enum RecordDataAggTools {
|
|||
String id = "2016" + Const.ID_SPLIT + "A" + Const.ID_SPLIT + "B";
|
||||
RecordData recordData = new RecordData(id);
|
||||
agg.allocateJob(recordData);
|
||||
RecordData result = RecordDataTool.INSTANCE.getRecord(recordDataAnswer.recordObj.getRecordData(), id);
|
||||
RecordData result = RecordDataTool.INSTANCE.getRecord(recordDataAnswer.getRecordDataList(), id);
|
||||
Assert.assertEquals("A" + Const.ID_SPLIT + "B", result.getRecord().get("aggId").getAsString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
[
|
||||
{
|
||||
"id": "[127.0.0.1:6379]",
|
||||
"data": {
|
||||
"peers": "[127.0.0.1:6379]",
|
||||
"name": "Redis",
|
||||
"aggId": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "cache-service",
|
||||
"data": {
|
||||
"peers": "cache-service",
|
||||
"name": "Motan",
|
||||
"aggId": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "[127.0.0.1:3307]",
|
||||
"data": {
|
||||
"peers": "[127.0.0.1:3307]",
|
||||
"name": "Mysql",
|
||||
"aggId": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "portal-service",
|
||||
"data": {
|
||||
"peers": "portal-service",
|
||||
"name": "Tomcat",
|
||||
"aggId": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "[localhost:-1]",
|
||||
"data": {
|
||||
"peers": "[localhost:-1]",
|
||||
"name": "H2",
|
||||
"aggId": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "[10.128.35.80:20880]",
|
||||
"data": {
|
||||
"peers": "[10.128.35.80:20880]",
|
||||
"name": "HttpClient",
|
||||
"aggId": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "[127.0.0.1:8002]",
|
||||
"data": {
|
||||
"peers": "[127.0.0.1:8002]",
|
||||
"name": "Motan",
|
||||
"aggId": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "persistence-service",
|
||||
"data": {
|
||||
"peers": "persistence-service",
|
||||
"name": "Tomcat",
|
||||
"aggId": null
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
[
|
||||
{
|
||||
"id": "201703310000..-..cache-service..-..[127.0.0.1:8002]",
|
||||
"data": {
|
||||
"code": "cache-service",
|
||||
"peers": "[127.0.0.1:8002]",
|
||||
"timeSlice": 201703310000,
|
||||
"aggId": "cache-service..-..[127.0.0.1:8002]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310000..-..persistence-service..-..[10.128.35.80:20880]",
|
||||
"data": {
|
||||
"code": "persistence-service",
|
||||
"peers": "[10.128.35.80:20880]",
|
||||
"timeSlice": 201703310000,
|
||||
"aggId": "persistence-service..-..[10.128.35.80:20880]"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
[
|
||||
{
|
||||
"id": "201703310900..-..cache-service..-..[127.0.0.1:8002]",
|
||||
"data": {
|
||||
"code": "cache-service",
|
||||
"peers": "[127.0.0.1:8002]",
|
||||
"timeSlice": 201703310900,
|
||||
"aggId": "cache-service..-..[127.0.0.1:8002]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310900..-..persistence-service..-..[10.128.35.80:20880]",
|
||||
"data": {
|
||||
"code": "persistence-service",
|
||||
"peers": "[10.128.35.80:20880]",
|
||||
"timeSlice": 201703310900,
|
||||
"aggId": "persistence-service..-..[10.128.35.80:20880]"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
[
|
||||
{
|
||||
"id": "201703310915..-..persistence-service..-..[10.128.35.80:20880]",
|
||||
"data": {"code":"persistence-service","peers":"[10.128.35.80:20880]","timeSlice":201703310915,"aggId":"persistence-service..-..[10.128.35.80:20880]"}
|
||||
},
|
||||
{
|
||||
"id": "201703310915..-..cache-service..-..[127.0.0.1:8002]",
|
||||
"data": {"code":"cache-service","peers":"[127.0.0.1:8002]","timeSlice":201703310915,"aggId":"cache-service..-..[127.0.0.1:8002]"}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
[
|
||||
{
|
||||
"id": "201703310000..-..portal-service..-..[10.128.35.80:20880]",
|
||||
"data": {
|
||||
"timeSlice": 201703310000,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "portal-service",
|
||||
"behind": "[10.128.35.80:20880]",
|
||||
"aggId": "portal-service..-..[10.128.35.80:20880]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"data": {
|
||||
"timeSlice": 201703310000,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "cache-service",
|
||||
"behind": "[127.0.0.1:6379]",
|
||||
"aggId": "cache-service..-..[127.0.0.1:6379]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310000..-..cache-service..-..[localhost:-1]",
|
||||
"data": {
|
||||
"timeSlice": 201703310000,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "cache-service",
|
||||
"behind": "[localhost:-1]",
|
||||
"aggId": "cache-service..-..[localhost:-1]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310000..-..User..-..portal-service",
|
||||
"data": {
|
||||
"timeSlice": 201703310000,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": true,
|
||||
"behind": "portal-service",
|
||||
"front": "User",
|
||||
"aggId": "User..-..portal-service"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310000..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"data": {
|
||||
"timeSlice": 201703310000,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "portal-service",
|
||||
"behind": "[127.0.0.1:8002]",
|
||||
"aggId": "portal-service..-..[127.0.0.1:8002]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310000..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"data": {
|
||||
"timeSlice": 201703310000,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "persistence-service",
|
||||
"behind": "[127.0.0.1:3307]",
|
||||
"aggId": "persistence-service..-..[127.0.0.1:3307]"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
[
|
||||
{
|
||||
"id": "201703310900..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"data": {
|
||||
"timeSlice": 201703310900,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "persistence-service",
|
||||
"behind": "[127.0.0.1:3307]",
|
||||
"aggId": "persistence-service..-..[127.0.0.1:3307]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"data": {
|
||||
"timeSlice": 201703310900,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "cache-service",
|
||||
"behind": "[127.0.0.1:6379]",
|
||||
"aggId": "cache-service..-..[127.0.0.1:6379]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310900..-..cache-service..-..[localhost:-1]",
|
||||
"data": {
|
||||
"timeSlice": 201703310900,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "cache-service",
|
||||
"behind": "[localhost:-1]",
|
||||
"aggId": "cache-service..-..[localhost:-1]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310900..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"data": {
|
||||
"timeSlice": 201703310900,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "portal-service",
|
||||
"behind": "[127.0.0.1:8002]",
|
||||
"aggId": "portal-service..-..[127.0.0.1:8002]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310900..-..User..-..portal-service",
|
||||
"data": {
|
||||
"timeSlice": 201703310900,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": true,
|
||||
"behind": "portal-service",
|
||||
"front": "User",
|
||||
"aggId": "User..-..portal-service"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310900..-..portal-service..-..[10.128.35.80:20880]",
|
||||
"data": {
|
||||
"timeSlice": 201703310900,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "portal-service",
|
||||
"behind": "[10.128.35.80:20880]",
|
||||
"aggId": "portal-service..-..[10.128.35.80:20880]"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
[
|
||||
{
|
||||
"id": "201703310915..-..cache-service..-..[localhost:-1]",
|
||||
"data": {
|
||||
"timeSlice": 201703310915,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "cache-service",
|
||||
"behind": "[localhost:-1]",
|
||||
"aggId": "cache-service..-..[localhost:-1]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310915..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"data": {
|
||||
"timeSlice": 201703310915,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "portal-service",
|
||||
"behind": "[127.0.0.1:8002]",
|
||||
"aggId": "portal-service..-..[127.0.0.1:8002]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310915..-..User..-..portal-service",
|
||||
"data": {
|
||||
"timeSlice": 201703310915,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": true,
|
||||
"behind": "portal-service",
|
||||
"front": "User",
|
||||
"aggId": "User..-..portal-service"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"data": {
|
||||
"timeSlice": 201703310915,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "cache-service",
|
||||
"behind": "[127.0.0.1:6379]",
|
||||
"aggId": "cache-service..-..[127.0.0.1:6379]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310915..-..portal-service..-..[10.128.35.80:20880]",
|
||||
"data": {
|
||||
"timeSlice": 201703310915,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "portal-service",
|
||||
"behind": "[10.128.35.80:20880]",
|
||||
"aggId": "portal-service..-..[10.128.35.80:20880]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310915..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"data": {
|
||||
"timeSlice": 201703310915,
|
||||
"frontIsRealCode": true,
|
||||
"behindIsRealCode": false,
|
||||
"front": "persistence-service",
|
||||
"behind": "[127.0.0.1:3307]",
|
||||
"aggId": "persistence-service..-..[127.0.0.1:3307]"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
[
|
||||
{
|
||||
"id": "201703310000..-..User..-..portal-service",
|
||||
"data": {
|
||||
"summary": 1,
|
||||
"oneSecondLess": 1,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310000,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "User..-..portal-service",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"data": {
|
||||
"summary": 10,
|
||||
"oneSecondLess": 10,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310000,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "cache-service..-..[127.0.0.1:6379]",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310000..-..cache-service..-..[localhost:-1]",
|
||||
"data": {
|
||||
"summary": 4,
|
||||
"oneSecondLess": 4,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310000,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "cache-service..-..[localhost:-1]",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310000..-..User..-..portal-service",
|
||||
"data": {
|
||||
"summary": 1,
|
||||
"oneSecondLess": 1,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310000,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "User..-..portal-service",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310000..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"data": {
|
||||
"summary": 2,
|
||||
"oneSecondLess": 2,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310000,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "portal-service..-..[127.0.0.1:8002]",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310000..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"data": {
|
||||
"summary": 2,
|
||||
"oneSecondLess": 2,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310000,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "persistence-service..-..[127.0.0.1:3307]",
|
||||
"error": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
[
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929258,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929258,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929258,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929259,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929259,
|
||||
"endTime": 1490922929259,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929261,
|
||||
"endTime": 1490922929261,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929261,
|
||||
"endTime": 1490922929261,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929298,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929298,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929298,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929300,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929300,
|
||||
"endTime": 1490922929300,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929302,
|
||||
"endTime": 1490922929302,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929303,
|
||||
"endTime": 1490922929303,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"startTime": 1490922929257,
|
||||
"endTime": 1490922929262,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..portal-service..-..[10.128.35.80:20880]",
|
||||
"startTime": 1490922929262,
|
||||
"endTime": 1490922929293,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"startTime": 1490922929297,
|
||||
"endTime": 1490922929303,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..User..-..portal-service",
|
||||
"startTime": 1490922929254,
|
||||
"endTime": 1490922929306,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"startTime": 1490922929279,
|
||||
"endTime": 1490922929280,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310000..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"startTime": 1490922929284,
|
||||
"endTime": 1490922929284,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
[
|
||||
{
|
||||
"id": "201703310900..-..User..-..portal-service",
|
||||
"data": {
|
||||
"summary": 1,
|
||||
"oneSecondLess": 1,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310900,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "User..-..portal-service",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"data": {
|
||||
"summary": 10,
|
||||
"oneSecondLess": 10,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310900,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "cache-service..-..[127.0.0.1:6379]",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310900..-..cache-service..-..[localhost:-1]",
|
||||
"data": {
|
||||
"summary": 4,
|
||||
"oneSecondLess": 4,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310900,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "cache-service..-..[localhost:-1]",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310900..-..User..-..portal-service",
|
||||
"data": {
|
||||
"summary": 1,
|
||||
"oneSecondLess": 1,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310900,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "User..-..portal-service",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310900..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"data": {
|
||||
"summary": 2,
|
||||
"oneSecondLess": 2,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310900,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "portal-service..-..[127.0.0.1:8002]",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310900..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"data": {
|
||||
"summary": 2,
|
||||
"oneSecondLess": 2,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310900,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "persistence-service..-..[127.0.0.1:3307]",
|
||||
"error": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
[
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929258,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929258,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929258,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929259,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929259,
|
||||
"endTime": 1490922929259,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929261,
|
||||
"endTime": 1490922929261,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929261,
|
||||
"endTime": 1490922929261,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929298,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929298,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929298,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929300,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929300,
|
||||
"endTime": 1490922929300,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929302,
|
||||
"endTime": 1490922929302,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929303,
|
||||
"endTime": 1490922929303,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"startTime": 1490922929257,
|
||||
"endTime": 1490922929262,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..portal-service..-..[10.128.35.80:20880]",
|
||||
"startTime": 1490922929262,
|
||||
"endTime": 1490922929293,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"startTime": 1490922929297,
|
||||
"endTime": 1490922929303,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..User..-..portal-service",
|
||||
"startTime": 1490922929254,
|
||||
"endTime": 1490922929306,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"startTime": 1490922929279,
|
||||
"endTime": 1490922929280,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310900..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"startTime": 1490922929284,
|
||||
"endTime": 1490922929284,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
[
|
||||
{
|
||||
"id": "201703310915..-..User..-..portal-service",
|
||||
"data": {
|
||||
"summary": 1,
|
||||
"oneSecondLess": 1,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310915,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "User..-..portal-service",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"data": {
|
||||
"summary": 10,
|
||||
"oneSecondLess": 10,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310915,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "cache-service..-..[127.0.0.1:6379]",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310915..-..cache-service..-..[localhost:-1]",
|
||||
"data": {
|
||||
"summary": 4,
|
||||
"oneSecondLess": 4,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310915,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "cache-service..-..[localhost:-1]",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310915..-..User..-..portal-service",
|
||||
"data": {
|
||||
"summary": 1,
|
||||
"oneSecondLess": 1,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310915,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "User..-..portal-service",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310915..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"data": {
|
||||
"summary": 2,
|
||||
"oneSecondLess": 2,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310915,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "portal-service..-..[127.0.0.1:8002]",
|
||||
"error": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "201703310915..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"data": {
|
||||
"summary": 2,
|
||||
"oneSecondLess": 2,
|
||||
"fiveSecondLess": 0,
|
||||
"timeSlice": 201703310915,
|
||||
"fiveSecondGreater": 0,
|
||||
"threeSecondLess": 0,
|
||||
"aggId": "persistence-service..-..[127.0.0.1:3307]",
|
||||
"error": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
[
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929258,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929258,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929258,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929258,
|
||||
"endTime": 1490922929259,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929259,
|
||||
"endTime": 1490922929259,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929261,
|
||||
"endTime": 1490922929261,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929261,
|
||||
"endTime": 1490922929261,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929298,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929298,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929298,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929298,
|
||||
"endTime": 1490922929300,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[127.0.0.1:6379]",
|
||||
"startTime": 1490922929300,
|
||||
"endTime": 1490922929300,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929302,
|
||||
"endTime": 1490922929302,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..cache-service..-..[localhost:-1]",
|
||||
"startTime": 1490922929303,
|
||||
"endTime": 1490922929303,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"startTime": 1490922929257,
|
||||
"endTime": 1490922929262,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..portal-service..-..[10.128.35.80:20880]",
|
||||
"startTime": 1490922929262,
|
||||
"endTime": 1490922929293,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..portal-service..-..[127.0.0.1:8002]",
|
||||
"startTime": 1490922929297,
|
||||
"endTime": 1490922929303,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..User..-..portal-service",
|
||||
"startTime": 1490922929254,
|
||||
"endTime": 1490922929306,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"startTime": 1490922929279,
|
||||
"endTime": 1490922929280,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
},
|
||||
{
|
||||
"nodeRefId": "201703310915..-..persistence-service..-..[127.0.0.1:3307]",
|
||||
"startTime": 1490922929284,
|
||||
"endTime": 1490922929284,
|
||||
"isError": false,
|
||||
"minute": 201703310915,
|
||||
"hour": 201703310900,
|
||||
"day": 201703310000,
|
||||
"second": 29
|
||||
}
|
||||
]
|
||||
Loading…
Reference in New Issue