diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/pom.xml b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/pom.xml
index 2d9a3f83d..0c5c6a316 100644
--- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/pom.xml
+++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/pom.xml
@@ -60,6 +60,11 @@
jvm-define${project.version}
+
+ org.apache.skywalking
+ metric-define
+ ${project.version}
+ org.apache.skywalkingregister-define
diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/AgentModuleGRPCProvider.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/AgentModuleGRPCProvider.java
index 8c77141b9..f3dcdeb29 100644
--- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/AgentModuleGRPCProvider.java
+++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/AgentModuleGRPCProvider.java
@@ -28,6 +28,7 @@ import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.ServiceNa
import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.TraceSegmentServiceHandler;
import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingHandler;
import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingListener;
+import org.apache.skywalking.apm.collector.analysis.metric.define.AnalysisMetricModule;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.AnalysisSegmentParserModule;
import org.apache.skywalking.apm.collector.cluster.ClusterModule;
import org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService;
@@ -87,7 +88,7 @@ public class AgentModuleGRPCProvider extends ModuleProvider {
}
@Override public String[] requiredModules() {
- return new String[] {ClusterModule.NAME, NamingModule.NAME, GRPCManagerModule.NAME, AnalysisSegmentParserModule.NAME};
+ return new String[] {ClusterModule.NAME, NamingModule.NAME, GRPCManagerModule.NAME, AnalysisSegmentParserModule.NAME, AnalysisMetricModule.NAME};
}
private void addHandlers(Server gRPCServer) {
diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandler.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandler.java
index 8fa4070b3..2a063b297 100644
--- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandler.java
+++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandler.java
@@ -18,15 +18,14 @@
package org.apache.skywalking.apm.collector.agent.grpc.provider.handler;
-import com.google.protobuf.ProtocolStringList;
import io.grpc.stub.StreamObserver;
import org.apache.skywalking.apm.collector.analysis.register.define.AnalysisRegisterModule;
import org.apache.skywalking.apm.collector.analysis.register.define.service.IApplicationIDService;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.server.grpc.GRPCHandler;
-import org.apache.skywalking.apm.network.proto.ApplicationMappings;
+import org.apache.skywalking.apm.network.proto.Application;
+import org.apache.skywalking.apm.network.proto.ApplicationMapping;
import org.apache.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc;
-import org.apache.skywalking.apm.network.proto.Applications;
import org.apache.skywalking.apm.network.proto.KeyWithIntegerValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,19 +43,17 @@ public class ApplicationRegisterServiceHandler extends ApplicationRegisterServic
applicationIDService = moduleManager.find(AnalysisRegisterModule.NAME).getService(IApplicationIDService.class);
}
- @Override public void batchRegister(Applications request, StreamObserver responseObserver) {
+ @Override
+ public void applicationCodeRegister(Application request, StreamObserver responseObserver) {
logger.debug("register application");
- ProtocolStringList applicationCodes = request.getApplicationCodesList();
- ApplicationMappings.Builder builder = ApplicationMappings.newBuilder();
- for (int i = 0; i < applicationCodes.size(); i++) {
- String applicationCode = applicationCodes.get(i);
- int applicationId = applicationIDService.getOrCreateForApplicationCode(applicationCode);
+ ApplicationMapping.Builder builder = ApplicationMapping.newBuilder();
+ String applicationCode = request.getApplicationCode();
+ int applicationId = applicationIDService.getOrCreateForApplicationCode(applicationCode);
- if (applicationId != 0) {
- KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(applicationCode).setValue(applicationId).build();
- builder.addApplications(value);
- }
+ if (applicationId != 0) {
+ KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(applicationCode).setValue(applicationId).build();
+ builder.setApplication(value);
}
responseObserver.onNext(builder.build());
responseObserver.onCompleted();
diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/InstanceDiscoveryServiceHandler.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/InstanceDiscoveryServiceHandler.java
index 87a8ceca4..682b6c410 100644
--- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/InstanceDiscoveryServiceHandler.java
+++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/InstanceDiscoveryServiceHandler.java
@@ -21,13 +21,17 @@ package org.apache.skywalking.apm.collector.agent.grpc.provider.handler;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import io.grpc.stub.StreamObserver;
+import org.apache.skywalking.apm.collector.analysis.metric.define.AnalysisMetricModule;
+import org.apache.skywalking.apm.collector.analysis.metric.define.service.IInstanceHeartBeatService;
import org.apache.skywalking.apm.collector.analysis.register.define.AnalysisRegisterModule;
import org.apache.skywalking.apm.collector.analysis.register.define.service.IInstanceIDService;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
import org.apache.skywalking.apm.collector.server.grpc.GRPCHandler;
import org.apache.skywalking.apm.network.proto.ApplicationInstance;
+import org.apache.skywalking.apm.network.proto.ApplicationInstanceHeartbeat;
import org.apache.skywalking.apm.network.proto.ApplicationInstanceMapping;
+import org.apache.skywalking.apm.network.proto.Downstream;
import org.apache.skywalking.apm.network.proto.InstanceDiscoveryServiceGrpc;
import org.apache.skywalking.apm.network.proto.OSInfo;
import org.slf4j.Logger;
@@ -41,13 +45,16 @@ public class InstanceDiscoveryServiceHandler extends InstanceDiscoveryServiceGrp
private final Logger logger = LoggerFactory.getLogger(InstanceDiscoveryServiceHandler.class);
private final IInstanceIDService instanceIDService;
+ private final IInstanceHeartBeatService instanceHeartBeatService;
public InstanceDiscoveryServiceHandler(ModuleManager moduleManager) {
this.instanceIDService = moduleManager.find(AnalysisRegisterModule.NAME).getService(IInstanceIDService.class);
+ this.instanceHeartBeatService = moduleManager.find(AnalysisMetricModule.NAME).getService(IInstanceHeartBeatService.class);
}
@Override
- public void register(ApplicationInstance request, StreamObserver responseObserver) {
+ public void registerInstance(ApplicationInstance request,
+ StreamObserver responseObserver) {
long timeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(request.getRegisterTime());
int instanceId = instanceIDService.getOrCreateByAgentUUID(request.getApplicationId(), request.getAgentUUID(), timeBucket, buildOsInfo(request.getOsinfo()));
ApplicationInstanceMapping.Builder builder = ApplicationInstanceMapping.newBuilder();
@@ -57,6 +64,12 @@ public class InstanceDiscoveryServiceHandler extends InstanceDiscoveryServiceGrp
responseObserver.onCompleted();
}
+ @Override public void heartbeat(ApplicationInstanceHeartbeat request, StreamObserver responseObserver) {
+ int instanceId = request.getApplicationInstanceId();
+ long heartBeatTime = request.getHeartbeatTime();
+ this.instanceHeartBeatService.heartBeat(instanceId, heartBeatTime);
+ }
+
private String buildOsInfo(OSInfo osinfo) {
JsonObject osInfoJson = new JsonObject();
osInfoJson.addProperty("osName", osinfo.getOsName());
diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricsServiceHandler.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricsServiceHandler.java
index b192a6c0b..1ff4a7f94 100644
--- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricsServiceHandler.java
+++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricsServiceHandler.java
@@ -23,7 +23,6 @@ import java.util.List;
import org.apache.skywalking.apm.collector.analysis.jvm.define.AnalysisJVMModule;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.ICpuMetricService;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IGCMetricService;
-import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IInstanceHeartBeatService;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IMemoryMetricService;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IMemoryPoolMetricService;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@@ -50,14 +49,12 @@ public class JVMMetricsServiceHandler extends JVMMetricsServiceGrpc.JVMMetricsSe
private final IGCMetricService gcMetricService;
private final IMemoryMetricService memoryMetricService;
private final IMemoryPoolMetricService memoryPoolMetricService;
- private final IInstanceHeartBeatService instanceHeartBeatService;
public JVMMetricsServiceHandler(ModuleManager moduleManager) {
this.cpuMetricService = moduleManager.find(AnalysisJVMModule.NAME).getService(ICpuMetricService.class);
this.gcMetricService = moduleManager.find(AnalysisJVMModule.NAME).getService(IGCMetricService.class);
this.memoryMetricService = moduleManager.find(AnalysisJVMModule.NAME).getService(IMemoryMetricService.class);
this.memoryPoolMetricService = moduleManager.find(AnalysisJVMModule.NAME).getService(IMemoryPoolMetricService.class);
- this.instanceHeartBeatService = moduleManager.find(AnalysisJVMModule.NAME).getService(IInstanceHeartBeatService.class);
}
@Override public void collect(JVMMetrics request, StreamObserver responseObserver) {
@@ -66,7 +63,6 @@ public class JVMMetricsServiceHandler extends JVMMetricsServiceGrpc.JVMMetricsSe
request.getMetricsList().forEach(metric -> {
long time = TimeBucketUtils.INSTANCE.getSecondTimeBucket(metric.getTime());
- sendToInstanceHeartBeatService(instanceId, metric.getTime());
sendToCpuMetricService(instanceId, time, metric.getCpu());
sendToMemoryMetricService(instanceId, time, metric.getMemoryList());
sendToMemoryPoolMetricService(instanceId, time, metric.getMemoryPoolList());
@@ -77,10 +73,6 @@ public class JVMMetricsServiceHandler extends JVMMetricsServiceGrpc.JVMMetricsSe
responseObserver.onCompleted();
}
- private void sendToInstanceHeartBeatService(int instanceId, long heartBeatTime) {
- instanceHeartBeatService.send(instanceId, heartBeatTime);
- }
-
private void sendToMemoryMetricService(int instanceId, long timeBucket, List memories) {
memories.forEach(memory -> memoryMetricService.send(instanceId, timeBucket, memory.getIsHeap(), memory.getInit(), memory.getMax(), memory.getUsed(), memory.getCommitted()));
}
diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandlerTestCase.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandlerTestCase.java
index 84cd1775b..50d9e82dc 100644
--- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandlerTestCase.java
+++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandlerTestCase.java
@@ -20,9 +20,9 @@ package org.apache.skywalking.apm.collector.agent.grpc.provider.handler;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
-import org.apache.skywalking.apm.network.proto.ApplicationMappings;
+import org.apache.skywalking.apm.network.proto.Application;
+import org.apache.skywalking.apm.network.proto.ApplicationMapping;
import org.apache.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc;
-import org.apache.skywalking.apm.network.proto.Applications;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,8 +39,8 @@ public class ApplicationRegisterServiceHandlerTestCase {
ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).usePlaintext(true).build();
stub = ApplicationRegisterServiceGrpc.newBlockingStub(channel);
- Applications application = Applications.newBuilder().addApplicationCodes("test141").build();
- ApplicationMappings mapping = stub.batchRegister(application);
- logger.debug(mapping.getApplications(0).getKey() + ", " + mapping.getApplications(0).getValue());
+ Application application = Application.newBuilder().setApplicationCode("test141").build();
+ ApplicationMapping mapping = stub.applicationCodeRegister(application);
+ logger.debug(mapping.getApplication().getKey() + ", " + mapping.getApplication().getValue());
}
}
diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/InstHeartBeatServiceTestCase.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/InstHeartBeatServiceTestCase.java
new file mode 100644
index 000000000..56c74c568
--- /dev/null
+++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/InstHeartBeatServiceTestCase.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.agent.grpc.provider.handler;
+
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+import org.apache.skywalking.apm.network.proto.ApplicationInstanceHeartbeat;
+import org.apache.skywalking.apm.network.proto.InstanceDiscoveryServiceGrpc;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstHeartBeatServiceTestCase {
+
+ public static void main(String[] args) {
+ ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).usePlaintext(true).build();
+ InstanceDiscoveryServiceGrpc.InstanceDiscoveryServiceBlockingStub blockingStub = InstanceDiscoveryServiceGrpc.newBlockingStub(channel);
+
+ ApplicationInstanceHeartbeat.Builder builder = ApplicationInstanceHeartbeat.newBuilder();
+ builder.setApplicationInstanceId(2);
+ builder.setHeartbeatTime(System.currentTimeMillis());
+ blockingStub.heartbeat(builder.build());
+ }
+}
diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java
new file mode 100644
index 000000000..7862fcaaf
--- /dev/null
+++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/test/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/JVMMetricServiceHandlerTestCase.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.agent.grpc.provider.handler;
+
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+import org.apache.skywalking.apm.network.proto.CPU;
+import org.apache.skywalking.apm.network.proto.GC;
+import org.apache.skywalking.apm.network.proto.GCPhrase;
+import org.apache.skywalking.apm.network.proto.JVMMetric;
+import org.apache.skywalking.apm.network.proto.JVMMetrics;
+import org.apache.skywalking.apm.network.proto.JVMMetricsServiceGrpc;
+import org.apache.skywalking.apm.network.proto.Memory;
+import org.apache.skywalking.apm.network.proto.MemoryPool;
+import org.apache.skywalking.apm.network.proto.PoolType;
+
+/**
+ * @author peng-yongsheng
+ */
+public class JVMMetricServiceHandlerTestCase {
+
+ public static void main(String[] args) {
+ ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).usePlaintext(true).build();
+ JVMMetricsServiceGrpc.JVMMetricsServiceBlockingStub blockingStub = JVMMetricsServiceGrpc.newBlockingStub(channel);
+
+ JVMMetrics.Builder builder = JVMMetrics.newBuilder();
+ builder.setApplicationInstanceId(2);
+
+ JVMMetric.Builder metricBuilder = JVMMetric.newBuilder();
+ metricBuilder.setTime(System.currentTimeMillis());
+
+ buildCPUMetric(metricBuilder);
+ buildGCMetric(metricBuilder);
+ buildMemoryMetric(metricBuilder);
+ buildMemoryPoolMetric(metricBuilder);
+
+ builder.addMetrics(metricBuilder.build());
+
+ blockingStub.collect(builder.build());
+ }
+
+ private static void buildMemoryPoolMetric(JVMMetric.Builder metricBuilder) {
+ MemoryPool.Builder builder = MemoryPool.newBuilder();
+ builder.setInit(20);
+ builder.setMax(50);
+ builder.setCommited(20);
+ builder.setUsed(15);
+ builder.setType(PoolType.NEWGEN_USAGE);
+
+ metricBuilder.addMemoryPool(builder);
+ }
+
+ private static void buildMemoryMetric(JVMMetric.Builder metricBuilder) {
+ Memory.Builder builder = Memory.newBuilder();
+ builder.setInit(20);
+ builder.setMax(50);
+ builder.setCommitted(20);
+ builder.setUsed(15);
+ builder.setIsHeap(true);
+
+ metricBuilder.addMemory(builder);
+ }
+
+ private static void buildGCMetric(JVMMetric.Builder metricBuilder) {
+ GC.Builder builder = GC.newBuilder();
+ builder.setPhrase(GCPhrase.NEW);
+ builder.setCount(2);
+
+ metricBuilder.addGc(builder);
+ }
+
+ private static void buildCPUMetric(JVMMetric.Builder metricBuilder) {
+ CPU.Builder builder = CPU.newBuilder();
+ builder.setUsagePercent(20);
+
+ metricBuilder.setCpu(builder.build());
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlarmAssertWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlarmAssertWorker.java
index 0d4cee0d5..c00db5644 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlarmAssertWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlarmAssertWorker.java
@@ -21,7 +21,7 @@ package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker;
import org.apache.skywalking.apm.collector.analysis.metric.define.MetricSource;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
-import org.apache.skywalking.apm.collector.core.data.Data;
+import org.apache.skywalking.apm.collector.core.data.StreamData;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.Const;
import org.apache.skywalking.apm.collector.core.util.NumberFormatUtils;
@@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
/**
* @author peng-yongsheng
*/
-public abstract class AlarmAssertWorker extends AbstractLocalAsyncWorker {
+public abstract class AlarmAssertWorker extends AbstractLocalAsyncWorker {
private final Logger logger = LoggerFactory.getLogger(AlarmAssertWorker.class);
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlarmAssertWorkerProvider.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlarmAssertWorkerProvider.java
index d0f6d8725..d95418146 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlarmAssertWorkerProvider.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlarmAssertWorkerProvider.java
@@ -19,7 +19,7 @@
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
-import org.apache.skywalking.apm.collector.core.data.Data;
+import org.apache.skywalking.apm.collector.core.data.StreamData;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.table.Metric;
import org.apache.skywalking.apm.collector.storage.table.alarm.Alarm;
@@ -27,7 +27,7 @@ import org.apache.skywalking.apm.collector.storage.table.alarm.Alarm;
/**
* @author peng-yongsheng
*/
-public abstract class AlarmAssertWorkerProvider> extends AbstractLocalAsyncWorkerProvider {
+public abstract class AlarmAssertWorkerProvider> extends AbstractLocalAsyncWorkerProvider {
public AlarmAssertWorkerProvider(ModuleManager moduleManager) {
super(moduleManager);
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmAssertWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmAssertWorker.java
index a0687fd20..0a2e6d352 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmAssertWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmAssertWorker.java
@@ -45,7 +45,8 @@ public class ApplicationMetricAlarmAssertWorker extends AlarmAssertWorker graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID, ApplicationMetric.class)
- .toFinder().findNode(MetricWorkerIdDefine.APPLICATION_METRIC_PERSISTENCE_WORKER_ID, ApplicationMetric.class)
+ .toFinder().findNode(MetricWorkerIdDefine.APPLICATION_MINUTE_METRIC_PERSISTENCE_WORKER_ID, ApplicationMetric.class)
.addNext(new NodeProcessor() {
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmListPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmListPersistenceWorker.java
index 92d8859de..88963870f 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmListPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmListPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IApplicationAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmPersistenceWorker.java
index 5cc32c2db..43be3e21f 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IApplicationAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarm;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmToListNodeProcessor.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmToListNodeProcessor.java
index ace81f51d..fbebedf06 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmToListNodeProcessor.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmToListNodeProcessor.java
@@ -39,7 +39,8 @@ public class ApplicationMetricAlarmToListNodeProcessor implements NodeProcessor<
+ Const.ID_SPLIT + applicationAlarm.getAlarmType()
+ Const.ID_SPLIT + applicationAlarm.getApplicationId();
- ApplicationAlarmList applicationAlarmList = new ApplicationAlarmList(id);
+ ApplicationAlarmList applicationAlarmList = new ApplicationAlarmList();
+ applicationAlarmList.setId(id);
applicationAlarmList.setApplicationId(applicationAlarm.getApplicationId());
applicationAlarmList.setSourceValue(applicationAlarm.getSourceValue());
applicationAlarmList.setAlarmType(applicationAlarm.getAlarmType());
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmAssertWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmAssertWorker.java
index cea3a4b3c..a68912e1f 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmAssertWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmAssertWorker.java
@@ -45,7 +45,8 @@ public class ApplicationReferenceMetricAlarmAssertWorker extends AlarmAssertWork
}
@Override protected ApplicationReferenceAlarm newAlarmObject(String id, ApplicationReferenceMetric inputMetric) {
- ApplicationReferenceAlarm applicationReferenceAlarm = new ApplicationReferenceAlarm(id + Const.ID_SPLIT + inputMetric.getFrontApplicationId() + Const.ID_SPLIT + inputMetric.getBehindApplicationId());
+ ApplicationReferenceAlarm applicationReferenceAlarm = new ApplicationReferenceAlarm();
+ applicationReferenceAlarm.setId(id + Const.ID_SPLIT + inputMetric.getFrontApplicationId() + Const.ID_SPLIT + inputMetric.getBehindApplicationId());
applicationReferenceAlarm.setFrontApplicationId(inputMetric.getFrontApplicationId());
applicationReferenceAlarm.setBehindApplicationId(inputMetric.getBehindApplicationId());
return applicationReferenceAlarm;
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmGraph.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmGraph.java
index 374b10222..121aed10a 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmGraph.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmGraph.java
@@ -65,7 +65,7 @@ public class ApplicationReferenceMetricAlarmGraph {
private void link(Graph graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_REFERENCE_METRIC_GRAPH_ID, ApplicationReferenceMetric.class)
- .toFinder().findNode(MetricWorkerIdDefine.APPLICATION_REFERENCE_METRIC_PERSISTENCE_WORKER_ID, ApplicationReferenceMetric.class)
+ .toFinder().findNode(MetricWorkerIdDefine.APPLICATION_REFERENCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID, ApplicationReferenceMetric.class)
.addNext(new NodeProcessor() {
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmListPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmListPersistenceWorker.java
index 420018e47..fc7f38761 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmListPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmListPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarmList;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmPersistenceWorker.java
index b35d802b8..c8f760111 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmToListNodeProcessor.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmToListNodeProcessor.java
index cea0d5918..de4874adb 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmToListNodeProcessor.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmToListNodeProcessor.java
@@ -41,7 +41,8 @@ public class ApplicationReferenceMetricAlarmToListNodeProcessor implements NodeP
+ Const.ID_SPLIT + applicationReferenceAlarm.getFrontApplicationId()
+ Const.ID_SPLIT + applicationReferenceAlarm.getBehindApplicationId();
- ApplicationReferenceAlarmList applicationReferenceAlarmList = new ApplicationReferenceAlarmList(id);
+ ApplicationReferenceAlarmList applicationReferenceAlarmList = new ApplicationReferenceAlarmList();
+ applicationReferenceAlarmList.setId(id);
applicationReferenceAlarmList.setFrontApplicationId(applicationReferenceAlarm.getFrontApplicationId());
applicationReferenceAlarmList.setBehindApplicationId(applicationReferenceAlarm.getBehindApplicationId());
applicationReferenceAlarmList.setSourceValue(applicationReferenceAlarm.getSourceValue());
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmAssertWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmAssertWorker.java
index 616518d42..2b02dd7df 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmAssertWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmAssertWorker.java
@@ -45,7 +45,8 @@ public class InstanceMetricAlarmAssertWorker extends AlarmAssertWorker graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.INSTANCE_METRIC_GRAPH_ID, InstanceMetric.class)
- .toFinder().findNode(MetricWorkerIdDefine.INSTANCE_METRIC_PERSISTENCE_WORKER_ID, InstanceMetric.class)
+ .toFinder().findNode(MetricWorkerIdDefine.INSTANCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID, InstanceMetric.class)
.addNext(new NodeProcessor() {
@Override public int id() {
return AlarmWorkerIdDefine.INSTANCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmListPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmListPersistenceWorker.java
index 4cf9824c3..120d943df 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmListPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmListPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IInstanceAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarmList;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmPersistenceWorker.java
index ca8383908..6fce174ae 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IInstanceAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarm;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmToListNodeProcessor.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmToListNodeProcessor.java
index 0c9f5c0a4..463a64e7d 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmToListNodeProcessor.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmToListNodeProcessor.java
@@ -39,7 +39,8 @@ public class InstanceMetricAlarmToListNodeProcessor implements NodeProcessor graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class)
- .toFinder().findNode(MetricWorkerIdDefine.INSTANCE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID, InstanceReferenceMetric.class)
+ .toFinder().findNode(MetricWorkerIdDefine.INSTANCE_REFERENCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID, InstanceReferenceMetric.class)
.addNext(new NodeProcessor() {
@Override public int id() {
return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmListPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmListPersistenceWorker.java
index 36dfcb030..d0d9ffd45 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmListPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmListPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IInstanceReferenceAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmPersistenceWorker.java
index b069cddb5..97f271d2b 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IInstanceReferenceAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarm;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmToListNodeProcessor.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmToListNodeProcessor.java
index 7ef729fab..553ddebe2 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmToListNodeProcessor.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmToListNodeProcessor.java
@@ -41,7 +41,8 @@ public class InstanceReferenceMetricAlarmToListNodeProcessor implements NodeProc
+ Const.ID_SPLIT + instanceReferenceAlarm.getFrontInstanceId()
+ Const.ID_SPLIT + instanceReferenceAlarm.getBehindInstanceId();
- InstanceReferenceAlarmList instanceReferenceAlarmList = new InstanceReferenceAlarmList(id);
+ InstanceReferenceAlarmList instanceReferenceAlarmList = new InstanceReferenceAlarmList();
+ instanceReferenceAlarmList.setId(id);
instanceReferenceAlarmList.setFrontApplicationId(instanceReferenceAlarm.getFrontApplicationId());
instanceReferenceAlarmList.setBehindApplicationId(instanceReferenceAlarm.getBehindApplicationId());
instanceReferenceAlarmList.setFrontInstanceId(instanceReferenceAlarm.getFrontInstanceId());
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmAssertWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmAssertWorker.java
index 29d06773d..e7a8242cc 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmAssertWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmAssertWorker.java
@@ -45,7 +45,8 @@ public class ServiceMetricAlarmAssertWorker extends AlarmAssertWorker graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_METRIC_GRAPH_ID, ServiceMetric.class)
- .toFinder().findNode(MetricWorkerIdDefine.SERVICE_METRIC_PERSISTENCE_WORKER_ID, ServiceMetric.class)
+ .toFinder().findNode(MetricWorkerIdDefine.SERVICE_MINUTE_METRIC_PERSISTENCE_WORKER_ID, ServiceMetric.class)
.addNext(new NodeProcessor() {
@Override public int id() {
return AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmListPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmListPersistenceWorker.java
index 3d16992de..e72568e6d 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmListPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmListPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IServiceAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmPersistenceWorker.java
index 96f7b6562..50c75841a 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IServiceAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarm;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmToListNodeProcessor.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmToListNodeProcessor.java
index 64f2a69dd..ab0d6a802 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmToListNodeProcessor.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmToListNodeProcessor.java
@@ -39,7 +39,8 @@ public class ServiceMetricAlarmToListNodeProcessor implements NodeProcessor graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class)
- .toFinder().findNode(MetricWorkerIdDefine.SERVICE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID, ServiceReferenceMetric.class)
+ .toFinder().findNode(MetricWorkerIdDefine.SERVICE_REFERENCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID, ServiceReferenceMetric.class)
.addNext(new NodeProcessor() {
@Override public int id() {
return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmListPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmListPersistenceWorker.java
index d6e1d5fa6..968231321 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmListPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmListPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarmList;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmPersistenceWorker.java
index 166a7419d..ddfdaaa56 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmPersistenceWorker.java
@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarm;
/**
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmToListNodeProcessor.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmToListNodeProcessor.java
index d0338cfb8..2d1fb048a 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmToListNodeProcessor.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmToListNodeProcessor.java
@@ -40,7 +40,8 @@ public class ServiceReferenceMetricAlarmToListNodeProcessor implements NodeProce
+ Const.ID_SPLIT + serviceReferenceAlarm.getFrontServiceId()
+ Const.ID_SPLIT + serviceReferenceAlarm.getBehindServiceId();
- ServiceReferenceAlarmList serviceReferenceAlarmList = new ServiceReferenceAlarmList(id);
+ ServiceReferenceAlarmList serviceReferenceAlarmList = new ServiceReferenceAlarmList();
+ serviceReferenceAlarmList.setId(id);
serviceReferenceAlarmList.setFrontApplicationId(serviceReferenceAlarm.getFrontApplicationId());
serviceReferenceAlarmList.setBehindApplicationId(serviceReferenceAlarm.getBehindApplicationId());
serviceReferenceAlarmList.setFrontInstanceId(serviceReferenceAlarm.getFrontInstanceId());
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/AnalysisJVMModule.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/AnalysisJVMModule.java
index b91b96f88..f2cf358ed 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/AnalysisJVMModule.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/AnalysisJVMModule.java
@@ -20,7 +20,6 @@ package org.apache.skywalking.apm.collector.analysis.jvm.define;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.ICpuMetricService;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IGCMetricService;
-import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IInstanceHeartBeatService;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IMemoryMetricService;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IMemoryPoolMetricService;
import org.apache.skywalking.apm.collector.core.module.Module;
@@ -38,7 +37,7 @@ public class AnalysisJVMModule extends Module {
@Override public Class[] services() {
return new Class[] {
- ICpuMetricService.class, IGCMetricService.class, IInstanceHeartBeatService.class,
+ ICpuMetricService.class, IGCMetricService.class,
IMemoryMetricService.class, IMemoryPoolMetricService.class
};
}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/GraphIdDefine.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/GraphIdDefine.java
index ba80f21e2..28f469594 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/GraphIdDefine.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/GraphIdDefine.java
@@ -24,7 +24,6 @@ package org.apache.skywalking.apm.collector.analysis.jvm.define.graph;
public class GraphIdDefine {
public static final int CPU_METRIC_PERSISTENCE_GRAPH_ID = 300;
public static final int GC_METRIC_PERSISTENCE_GRAPH_ID = 301;
- public static final int INSTANCE_HEART_BEAT_PERSISTENCE_GRAPH_ID = 302;
public static final int MEMORY_METRIC_PERSISTENCE_GRAPH_ID = 303;
public static final int MEMORY_POOL_METRIC_PERSISTENCE_GRAPH_ID = 304;
}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/WorkerIdDefine.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/WorkerIdDefine.java
index 1606225cb..e7270c8b0 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/WorkerIdDefine.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/graph/WorkerIdDefine.java
@@ -22,9 +22,47 @@ package org.apache.skywalking.apm.collector.analysis.jvm.define.graph;
* @author peng-yongsheng
*/
public class WorkerIdDefine {
- public static final int CPU_METRIC_PERSISTENCE_WORKER_ID = 300;
- public static final int GC_METRIC_PERSISTENCE_WORKER_ID = 301;
- public static final int INST_HEART_BEAT_PERSISTENCE_WORKER_ID = 302;
- public static final int MEMORY_METRIC_PERSISTENCE_WORKER_ID = 303;
- public static final int MEMORY_POOL_METRIC_PERSISTENCE_WORKER_ID = 303;
+ public static final int CPU_METRIC_BRIDGE_NODE_ID = 3000;
+ public static final int CPU_SECOND_METRIC_PERSISTENCE_WORKER_ID = 3001;
+ public static final int CPU_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 3002;
+ public static final int CPU_MINUTE_METRIC_TRANSFORM_NODE_ID = 3003;
+ public static final int CPU_HOUR_METRIC_PERSISTENCE_WORKER_ID = 3004;
+ public static final int CPU_HOUR_METRIC_TRANSFORM_NODE_ID = 3005;
+ public static final int CPU_DAY_METRIC_PERSISTENCE_WORKER_ID = 3006;
+ public static final int CPU_DAY_METRIC_TRANSFORM_NODE_ID = 3007;
+ public static final int CPU_MONTH_METRIC_PERSISTENCE_WORKER_ID = 3008;
+ public static final int CPU_MONTH_METRIC_TRANSFORM_NODE_ID = 3009;
+
+ public static final int GC_METRIC_BRIDGE_NODE_ID = 3100;
+ public static final int GC_SECOND_METRIC_PERSISTENCE_WORKER_ID = 3101;
+ public static final int GC_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 3102;
+ public static final int GC_MINUTE_METRIC_TRANSFORM_NODE_ID = 3103;
+ public static final int GC_HOUR_METRIC_PERSISTENCE_WORKER_ID = 3104;
+ public static final int GC_HOUR_METRIC_TRANSFORM_NODE_ID = 3105;
+ public static final int GC_DAY_METRIC_PERSISTENCE_WORKER_ID = 3106;
+ public static final int GC_DAY_METRIC_TRANSFORM_NODE_ID = 3107;
+ public static final int GC_MONTH_METRIC_PERSISTENCE_WORKER_ID = 3108;
+ public static final int GC_MONTH_METRIC_TRANSFORM_NODE_ID = 3109;
+
+ public static final int MEMORY_METRIC_BRIDGE_NODE_ID = 3200;
+ public static final int MEMORY_SECOND_METRIC_PERSISTENCE_WORKER_ID = 3201;
+ public static final int MEMORY_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 3202;
+ public static final int MEMORY_MINUTE_METRIC_TRANSFORM_NODE_ID = 3203;
+ public static final int MEMORY_HOUR_METRIC_PERSISTENCE_WORKER_ID = 3204;
+ public static final int MEMORY_HOUR_METRIC_TRANSFORM_NODE_ID = 3205;
+ public static final int MEMORY_DAY_METRIC_PERSISTENCE_WORKER_ID = 3206;
+ public static final int MEMORY_DAY_METRIC_TRANSFORM_NODE_ID = 3207;
+ public static final int MEMORY_MONTH_METRIC_PERSISTENCE_WORKER_ID = 3208;
+ public static final int MEMORY_MONTH_METRIC_TRANSFORM_NODE_ID = 3209;
+
+ public static final int MEMORY_POOL_METRIC_BRIDGE_NODE_ID = 3300;
+ public static final int MEMORY_POOL_SECOND_METRIC_PERSISTENCE_WORKER_ID = 3301;
+ public static final int MEMORY_POOL_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 3302;
+ public static final int MEMORY_POOL_MINUTE_METRIC_TRANSFORM_NODE_ID = 3303;
+ public static final int MEMORY_POOL_HOUR_METRIC_PERSISTENCE_WORKER_ID = 3304;
+ public static final int MEMORY_POOL_HOUR_METRIC_TRANSFORM_NODE_ID = 3305;
+ public static final int MEMORY_POOL_DAY_METRIC_PERSISTENCE_WORKER_ID = 3306;
+ public static final int MEMORY_POOL_DAY_METRIC_TRANSFORM_NODE_ID = 3307;
+ public static final int MEMORY_POOL_MONTH_METRIC_PERSISTENCE_WORKER_ID = 3308;
+ public static final int MEMORY_POOL_MONTH_METRIC_TRANSFORM_NODE_ID = 3309;
}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/service/IMemoryMetricService.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/service/IMemoryMetricService.java
index e793ecc04..522d45ec3 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/service/IMemoryMetricService.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/service/IMemoryMetricService.java
@@ -24,5 +24,5 @@ import org.apache.skywalking.apm.collector.core.module.Service;
* @author peng-yongsheng
*/
public interface IMemoryMetricService extends Service {
- void send(int instanceId, long timeBucket, boolean isHeap, long init, long max, long used, long commited);
+ void send(int instanceId, long timeBucket, boolean isHeap, long init, long max, long used, long committed);
}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/service/IMemoryPoolMetricService.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/service/IMemoryPoolMetricService.java
index 10be43820..81215ddec 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/service/IMemoryPoolMetricService.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/service/IMemoryPoolMetricService.java
@@ -24,5 +24,5 @@ import org.apache.skywalking.apm.collector.core.module.Service;
* @author peng-yongsheng
*/
public interface IMemoryPoolMetricService extends Service {
- void send(int instanceId, long timeBucket, int poolType, long init, long max, long used, long commited);
+ void send(int instanceId, long timeBucket, int poolType, long init, long max, long used, long committed);
}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/AnalysisJVMModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/AnalysisJVMModuleProvider.java
index 2b5904e56..a8d50e2e6 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/AnalysisJVMModuleProvider.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/AnalysisJVMModuleProvider.java
@@ -22,19 +22,16 @@ import java.util.Properties;
import org.apache.skywalking.apm.collector.analysis.jvm.define.AnalysisJVMModule;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.ICpuMetricService;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IGCMetricService;
-import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IInstanceHeartBeatService;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IMemoryMetricService;
import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IMemoryPoolMetricService;
import org.apache.skywalking.apm.collector.analysis.jvm.provider.service.CpuMetricService;
import org.apache.skywalking.apm.collector.analysis.jvm.provider.service.GCMetricService;
-import org.apache.skywalking.apm.collector.analysis.jvm.provider.service.InstanceHeartBeatService;
import org.apache.skywalking.apm.collector.analysis.jvm.provider.service.MemoryMetricService;
import org.apache.skywalking.apm.collector.analysis.jvm.provider.service.MemoryPoolMetricService;
-import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.CpuMetricPersistenceGraph;
-import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.GCMetricPersistenceGraph;
-import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.InstanceHeartBeatPersistenceGraph;
-import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.MemoryMetricPersistenceGraph;
-import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.MemoryPoolMetricPersistenceGraph;
+import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu.CpuMetricPersistenceGraph;
+import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc.GCMetricPersistenceGraph;
+import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory.MemoryMetricPersistenceGraph;
+import org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool.MemoryPoolMetricPersistenceGraph;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.analysis.worker.timer.PersistenceTimer;
import org.apache.skywalking.apm.collector.core.module.Module;
@@ -61,7 +58,6 @@ public class AnalysisJVMModuleProvider extends ModuleProvider {
@Override public void prepare(Properties config) throws ServiceNotProvidedException {
this.registerServiceImplementation(ICpuMetricService.class, new CpuMetricService());
this.registerServiceImplementation(IGCMetricService.class, new GCMetricService());
- this.registerServiceImplementation(IInstanceHeartBeatService.class, new InstanceHeartBeatService());
this.registerServiceImplementation(IMemoryMetricService.class, new MemoryMetricService());
this.registerServiceImplementation(IMemoryPoolMetricService.class, new MemoryPoolMetricService());
}
@@ -90,9 +86,6 @@ public class AnalysisJVMModuleProvider extends ModuleProvider {
GCMetricPersistenceGraph gcMetricPersistenceGraph = new GCMetricPersistenceGraph(getManager(), workerCreateListener);
gcMetricPersistenceGraph.create();
- InstanceHeartBeatPersistenceGraph instanceHeartBeatPersistenceGraph = new InstanceHeartBeatPersistenceGraph(getManager(), workerCreateListener);
- instanceHeartBeatPersistenceGraph.create();
-
MemoryMetricPersistenceGraph memoryMetricPersistenceGraph = new MemoryMetricPersistenceGraph(getManager(), workerCreateListener);
memoryMetricPersistenceGraph.create();
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/CpuMetricService.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/CpuMetricService.java
index 1d93d1415..49b68e926 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/CpuMetricService.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/CpuMetricService.java
@@ -45,9 +45,15 @@ public class CpuMetricService implements ICpuMetricService {
}
@Override public void send(int instanceId, long timeBucket, double usagePercent) {
- CpuMetric cpuMetric = new CpuMetric(timeBucket + Const.ID_SPLIT + instanceId);
+ String metricId = String.valueOf(instanceId);
+ String id = timeBucket + Const.ID_SPLIT + metricId;
+
+ CpuMetric cpuMetric = new CpuMetric();
+ cpuMetric.setId(id);
+ cpuMetric.setMetricId(metricId);
cpuMetric.setInstanceId(instanceId);
cpuMetric.setUsagePercent(usagePercent);
+ cpuMetric.setTimes(1L);
cpuMetric.setTimeBucket(timeBucket);
logger.debug("push to cpu metric graph, id: {}", cpuMetric.getId());
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/GCMetricService.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/GCMetricService.java
index 325300804..0729bca9b 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/GCMetricService.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/GCMetricService.java
@@ -45,11 +45,16 @@ public class GCMetricService implements IGCMetricService {
}
@Override public void send(int instanceId, long timeBucket, int phraseValue, long count, long time) {
- GCMetric gcMetric = new GCMetric(timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + String.valueOf(phraseValue));
+ String metricId = instanceId + Const.ID_SPLIT + String.valueOf(phraseValue);
+ String id = timeBucket + Const.ID_SPLIT + metricId;
+
+ GCMetric gcMetric = new GCMetric();
+ gcMetric.setId(id);
+ gcMetric.setMetricId(metricId);
gcMetric.setInstanceId(instanceId);
gcMetric.setPhrase(phraseValue);
gcMetric.setCount(count);
- gcMetric.setTime(time);
+ gcMetric.setTimes(1L);
gcMetric.setTimeBucket(timeBucket);
logger.debug("push to gc metric graph, id: {}", gcMetric.getId());
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryMetricService.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryMetricService.java
index 4195db4a0..c9ed19bed 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryMetricService.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryMetricService.java
@@ -45,14 +45,20 @@ public class MemoryMetricService implements IMemoryMetricService {
}
@Override
- public void send(int instanceId, long timeBucket, boolean isHeap, long init, long max, long used, long commited) {
- MemoryMetric memoryMetric = new MemoryMetric(timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + String.valueOf(isHeap));
+ public void send(int instanceId, long timeBucket, boolean isHeap, long init, long max, long used, long committed) {
+ String metricId = instanceId + Const.ID_SPLIT + String.valueOf(isHeap);
+ String id = timeBucket + Const.ID_SPLIT + metricId;
+
+ MemoryMetric memoryMetric = new MemoryMetric();
+ memoryMetric.setId(id);
+ memoryMetric.setMetricId(metricId);
memoryMetric.setInstanceId(instanceId);
memoryMetric.setIsHeap(isHeap);
memoryMetric.setInit(init);
memoryMetric.setMax(max);
memoryMetric.setUsed(used);
- memoryMetric.setCommitted(commited);
+ memoryMetric.setCommitted(committed);
+ memoryMetric.setTimes(1L);
memoryMetric.setTimeBucket(timeBucket);
logger.debug("push to memory metric graph, id: {}", memoryMetric.getId());
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryPoolMetricService.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryPoolMetricService.java
index bec38080b..e99a02759 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryPoolMetricService.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/MemoryPoolMetricService.java
@@ -45,14 +45,20 @@ public class MemoryPoolMetricService implements IMemoryPoolMetricService {
}
@Override
- public void send(int instanceId, long timeBucket, int poolType, long init, long max, long used, long commited) {
- MemoryPoolMetric memoryPoolMetric = new MemoryPoolMetric(timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + String.valueOf(poolType));
+ public void send(int instanceId, long timeBucket, int poolType, long init, long max, long used, long committed) {
+ String metricId = instanceId + Const.ID_SPLIT + String.valueOf(poolType);
+ String id = timeBucket + Const.ID_SPLIT + metricId;
+
+ MemoryPoolMetric memoryPoolMetric = new MemoryPoolMetric();
+ memoryPoolMetric.setId(id);
+ memoryPoolMetric.setMetricId(metricId);
memoryPoolMetric.setInstanceId(instanceId);
memoryPoolMetric.setPoolType(poolType);
memoryPoolMetric.setInit(init);
memoryPoolMetric.setMax(max);
memoryPoolMetric.setUsed(used);
- memoryPoolMetric.setCommitted(commited);
+ memoryPoolMetric.setCommitted(committed);
+ memoryPoolMetric.setTimes(1L);
memoryPoolMetric.setTimeBucket(timeBucket);
logger.debug("push to memory pool metric graph, id: {}", memoryPoolMetric.getId());
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuDayMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuDayMetricPersistenceWorker.java
new file mode 100644
index 000000000..7b42a800e
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuDayMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuDayMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class CpuDayMetricPersistenceWorker extends PersistenceWorker {
+
+ public CpuDayMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.CPU_DAY_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, CpuMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(ICpuDayMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public CpuDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new CpuDayMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuDayMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuDayMetricTransformNode.java
new file mode 100644
index 000000000..444e9c758
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuDayMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class CpuDayMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.CPU_DAY_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(CpuMetric cpuMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToDay(cpuMetric.getTimeBucket());
+
+ CpuMetric newCpuMetric = CpuMetricCopy.copy(cpuMetric);
+ newCpuMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + cpuMetric.getMetricId());
+ newCpuMetric.setTimeBucket(timeBucket);
+ next.execute(newCpuMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuHourMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuHourMetricPersistenceWorker.java
new file mode 100644
index 000000000..be163fa89
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuHourMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuHourMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class CpuHourMetricPersistenceWorker extends PersistenceWorker {
+
+ public CpuHourMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.CPU_HOUR_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, CpuMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(ICpuHourMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public CpuHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new CpuHourMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuHourMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuHourMetricTransformNode.java
new file mode 100644
index 000000000..cbc98da8a
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuHourMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class CpuHourMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.CPU_HOUR_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(CpuMetric cpuMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToHour(cpuMetric.getTimeBucket());
+
+ CpuMetric newCpuMetric = CpuMetricCopy.copy(cpuMetric);
+ newCpuMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + cpuMetric.getMetricId());
+ newCpuMetric.setTimeBucket(timeBucket);
+ next.execute(newCpuMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMetricBridgeNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMetricBridgeNode.java
new file mode 100644
index 000000000..745b73b6f
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMetricBridgeNode.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class CpuMetricBridgeNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.CPU_METRIC_BRIDGE_NODE_ID;
+ }
+
+ @Override public void process(CpuMetric metric, Next next) {
+ next.execute(metric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMetricCopy.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMetricCopy.java
new file mode 100644
index 000000000..067b07344
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMetricCopy.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
+
+import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class CpuMetricCopy {
+
+ public static CpuMetric copy(CpuMetric cpuMetric) {
+ CpuMetric newCpuMetric = new CpuMetric();
+ newCpuMetric.setId(cpuMetric.getId());
+ newCpuMetric.setMetricId(cpuMetric.getMetricId());
+
+ newCpuMetric.setInstanceId(cpuMetric.getInstanceId());
+ newCpuMetric.setUsagePercent(cpuMetric.getUsagePercent());
+ newCpuMetric.setTimes(cpuMetric.getTimes());
+
+ newCpuMetric.setTimeBucket(cpuMetric.getTimeBucket());
+ return newCpuMetric;
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/CpuMetricPersistenceGraph.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMetricPersistenceGraph.java
similarity index 61%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/CpuMetricPersistenceGraph.java
rename to apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMetricPersistenceGraph.java
index 9384c85c7..0196ea3b3 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/CpuMetricPersistenceGraph.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMetricPersistenceGraph.java
@@ -16,11 +16,12 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
+import org.apache.skywalking.apm.collector.core.graph.Node;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
@@ -38,7 +39,21 @@ public class CpuMetricPersistenceGraph {
}
public void create() {
- GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.CPU_METRIC_PERSISTENCE_GRAPH_ID, CpuMetric.class)
- .addNode(new CpuMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+ Node bridgeNode = GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.CPU_METRIC_PERSISTENCE_GRAPH_ID, CpuMetric.class)
+ .addNode(new CpuMetricBridgeNode());
+
+ bridgeNode.addNext(new CpuSecondMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new CpuMinuteMetricTransformNode())
+ .addNext(new CpuMinuteMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new CpuHourMetricTransformNode())
+ .addNext(new CpuHourMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new CpuDayMetricTransformNode())
+ .addNext(new CpuDayMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new CpuMonthMetricTransformNode())
+ .addNext(new CpuMonthMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMinuteMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMinuteMetricPersistenceWorker.java
new file mode 100644
index 000000000..30b6685c2
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMinuteMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMinuteMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class CpuMinuteMetricPersistenceWorker extends PersistenceWorker {
+
+ public CpuMinuteMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.CPU_MINUTE_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, CpuMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(ICpuMinuteMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public CpuMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new CpuMinuteMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMinuteMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMinuteMetricTransformNode.java
new file mode 100644
index 000000000..e2d9f22f1
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMinuteMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class CpuMinuteMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.CPU_MINUTE_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(CpuMetric cpuMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToMinute(cpuMetric.getTimeBucket());
+
+ CpuMetric newCpuMetric = CpuMetricCopy.copy(cpuMetric);
+ newCpuMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + cpuMetric.getMetricId());
+ newCpuMetric.setTimeBucket(timeBucket);
+ next.execute(newCpuMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMonthMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMonthMetricPersistenceWorker.java
new file mode 100644
index 000000000..8bf3cfe69
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMonthMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuMonthMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class CpuMonthMetricPersistenceWorker extends PersistenceWorker {
+
+ public CpuMonthMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.CPU_MONTH_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, CpuMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(ICpuMonthMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public CpuMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new CpuMonthMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMonthMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMonthMetricTransformNode.java
new file mode 100644
index 000000000..6c59f4756
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuMonthMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class CpuMonthMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.CPU_MONTH_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(CpuMetric cpuMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToMonth(cpuMetric.getTimeBucket());
+
+ CpuMetric newCpuMetric = CpuMetricCopy.copy(cpuMetric);
+ newCpuMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + cpuMetric.getMetricId());
+ newCpuMetric.setTimeBucket(timeBucket);
+ next.execute(newCpuMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/CpuMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuSecondMetricPersistenceWorker.java
similarity index 77%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/CpuMetricPersistenceWorker.java
rename to apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuSecondMetricPersistenceWorker.java
index 402d222ee..ea2dfeba4 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/CpuMetricPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/cpu/CpuSecondMetricPersistenceWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
@@ -24,20 +24,20 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.ICpuMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
/**
* @author peng-yongsheng
*/
-public class CpuMetricPersistenceWorker extends PersistenceWorker {
+public class CpuSecondMetricPersistenceWorker extends PersistenceWorker {
- public CpuMetricPersistenceWorker(ModuleManager moduleManager) {
+ public CpuSecondMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return WorkerIdDefine.CPU_METRIC_PERSISTENCE_WORKER_ID;
+ return WorkerIdDefine.CPU_SECOND_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
@@ -46,17 +46,17 @@ public class CpuMetricPersistenceWorker extends PersistenceWorker {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO, ?, CpuMetric> persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(ICpuMetricPersistenceDAO.class);
+ return getModuleManager().find(StorageModule.NAME).getService(ICpuSecondMetricPersistenceDAO.class);
}
- public static class Factory extends PersistenceWorkerProvider {
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public CpuMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new CpuMetricPersistenceWorker(moduleManager);
+ @Override public CpuSecondMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new CpuSecondMetricPersistenceWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricPersistenceWorker.java
new file mode 100644
index 000000000..433a6146c
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCDayMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class GCDayMetricPersistenceWorker extends PersistenceWorker {
+
+ public GCDayMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.GC_DAY_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, GCMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IGCDayMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public GCDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new GCDayMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricTransformNode.java
new file mode 100644
index 000000000..edc349e1c
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCDayMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class GCDayMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.GC_DAY_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(GCMetric gcMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToDay(gcMetric.getTimeBucket());
+
+ GCMetric newGCMetric = GCMetricCopy.copy(gcMetric);
+ newGCMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + gcMetric.getMetricId());
+ newGCMetric.setTimeBucket(timeBucket);
+ next.execute(newGCMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricPersistenceWorker.java
new file mode 100644
index 000000000..08b9addcb
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCHourMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class GCHourMetricPersistenceWorker extends PersistenceWorker {
+
+ public GCHourMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.GC_HOUR_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, GCMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IGCHourMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public GCHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new GCHourMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricTransformNode.java
new file mode 100644
index 000000000..33d870a0f
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCHourMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class GCHourMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.GC_HOUR_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(GCMetric gcMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToHour(gcMetric.getTimeBucket());
+
+ GCMetric newGCMetric = GCMetricCopy.copy(gcMetric);
+ newGCMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + gcMetric.getMetricId());
+ newGCMetric.setTimeBucket(timeBucket);
+ next.execute(newGCMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricBridgeNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricBridgeNode.java
new file mode 100644
index 000000000..97e23e772
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricBridgeNode.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class GCMetricBridgeNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.GC_METRIC_BRIDGE_NODE_ID;
+ }
+
+ @Override public void process(GCMetric metric, Next next) {
+ next.execute(metric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricCopy.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricCopy.java
new file mode 100644
index 000000000..b914a294b
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricCopy.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
+
+import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class GCMetricCopy {
+
+ public static GCMetric copy(GCMetric gcMetric) {
+ GCMetric newGCMetric = new GCMetric();
+ newGCMetric.setId(gcMetric.getId());
+ newGCMetric.setMetricId(gcMetric.getMetricId());
+
+ newGCMetric.setInstanceId(gcMetric.getInstanceId());
+ newGCMetric.setPhrase(gcMetric.getPhrase());
+
+ newGCMetric.setCount(gcMetric.getCount());
+ newGCMetric.setTimes(gcMetric.getTimes());
+
+ newGCMetric.setTimeBucket(gcMetric.getTimeBucket());
+ return newGCMetric;
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceGraph.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricPersistenceGraph.java
similarity index 61%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceGraph.java
rename to apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricPersistenceGraph.java
index 24329f04d..9034ccbb0 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceGraph.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMetricPersistenceGraph.java
@@ -16,11 +16,12 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
+import org.apache.skywalking.apm.collector.core.graph.Node;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
@@ -38,7 +39,21 @@ public class GCMetricPersistenceGraph {
}
public void create() {
- GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.GC_METRIC_PERSISTENCE_GRAPH_ID, GCMetric.class)
- .addNode(new GCMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+ Node bridgeNode = GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.GC_METRIC_PERSISTENCE_GRAPH_ID, GCMetric.class)
+ .addNode(new GCMetricBridgeNode());
+
+ bridgeNode.addNext(new GCSecondMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new GCMinuteMetricTransformNode())
+ .addNext(new GCMinuteMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new GCHourMetricTransformNode())
+ .addNext(new GCHourMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new GCDayMetricTransformNode())
+ .addNext(new GCDayMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new GCMonthMetricTransformNode())
+ .addNext(new GCMonthMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricPersistenceWorker.java
new file mode 100644
index 000000000..f65752c95
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCMinuteMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class GCMinuteMetricPersistenceWorker extends PersistenceWorker {
+
+ public GCMinuteMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.GC_MINUTE_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, GCMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IGCMinuteMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public GCMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new GCMinuteMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricTransformNode.java
new file mode 100644
index 000000000..8f04d3150
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMinuteMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class GCMinuteMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.GC_MINUTE_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(GCMetric gcMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToMinute(gcMetric.getTimeBucket());
+
+ GCMetric newGCMetric = GCMetricCopy.copy(gcMetric);
+ newGCMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + gcMetric.getMetricId());
+ newGCMetric.setTimeBucket(timeBucket);
+ next.execute(newGCMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricPersistenceWorker.java
new file mode 100644
index 000000000..1d5268090
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCMonthMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class GCMonthMetricPersistenceWorker extends PersistenceWorker {
+
+ public GCMonthMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.GC_MONTH_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, GCMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IGCMonthMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public GCMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new GCMonthMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricTransformNode.java
new file mode 100644
index 000000000..05fd93927
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCMonthMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class GCMonthMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.GC_MONTH_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(GCMetric gcMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToMonth(gcMetric.getTimeBucket());
+
+ GCMetric newGCMetric = GCMetricCopy.copy(gcMetric);
+ newGCMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + gcMetric.getMetricId());
+ newGCMetric.setTimeBucket(timeBucket);
+ next.execute(newGCMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCSecondMetricPersistenceWorker.java
similarity index 77%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceWorker.java
rename to apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCSecondMetricPersistenceWorker.java
index b19eff2d9..df47a8db1 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/GCMetricPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/gc/GCSecondMetricPersistenceWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
@@ -24,20 +24,20 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IGCMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCSecondMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
/**
* @author peng-yongsheng
*/
-public class GCMetricPersistenceWorker extends PersistenceWorker {
+public class GCSecondMetricPersistenceWorker extends PersistenceWorker {
- public GCMetricPersistenceWorker(ModuleManager moduleManager) {
+ public GCSecondMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return WorkerIdDefine.GC_METRIC_PERSISTENCE_WORKER_ID;
+ return WorkerIdDefine.GC_SECOND_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
@@ -46,17 +46,17 @@ public class GCMetricPersistenceWorker extends PersistenceWorker {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO, ?, GCMetric> persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IGCMetricPersistenceDAO.class);
+ return getModuleManager().find(StorageModule.NAME).getService(IGCSecondMetricPersistenceDAO.class);
}
- public static class Factory extends PersistenceWorkerProvider {
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public GCMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new GCMetricPersistenceWorker(moduleManager);
+ @Override public GCSecondMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new GCSecondMetricPersistenceWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryDayMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryDayMetricPersistenceWorker.java
new file mode 100644
index 000000000..9edaad091
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryDayMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryDayMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryDayMetricPersistenceWorker extends PersistenceWorker {
+
+ public MemoryDayMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_DAY_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, MemoryMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IMemoryDayMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public MemoryDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new MemoryDayMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryDayMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryDayMetricTransformNode.java
new file mode 100644
index 000000000..99568a410
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryDayMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryDayMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_DAY_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(MemoryMetric memoryMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToDay(memoryMetric.getTimeBucket());
+
+ MemoryMetric newMemoryMetric = MemoryMetricCopy.copy(memoryMetric);
+ newMemoryMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + memoryMetric.getMetricId());
+ newMemoryMetric.setTimeBucket(timeBucket);
+ next.execute(newMemoryMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryPoolMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryHourMetricPersistenceWorker.java
similarity index 75%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryPoolMetricPersistenceWorker.java
rename to apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryHourMetricPersistenceWorker.java
index 13e346f09..af0a90513 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryPoolMetricPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryHourMetricPersistenceWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
@@ -24,39 +24,39 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IMemoryPoolMetricPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryHourMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
/**
* @author peng-yongsheng
*/
-public class MemoryPoolMetricPersistenceWorker extends PersistenceWorker {
+public class MemoryHourMetricPersistenceWorker extends PersistenceWorker {
- @Override public int id() {
- return WorkerIdDefine.MEMORY_POOL_METRIC_PERSISTENCE_WORKER_ID;
- }
-
- public MemoryPoolMetricPersistenceWorker(ModuleManager moduleManager) {
+ public MemoryHourMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_HOUR_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
@Override protected boolean needMergeDBData() {
- return false;
+ return true;
}
@SuppressWarnings("unchecked")
- @Override protected IPersistenceDAO, ?, MemoryPoolMetric> persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IMemoryPoolMetricPersistenceDAO.class);
+ @Override protected IPersistenceDAO, ?, MemoryMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IMemoryHourMetricPersistenceDAO.class);
}
- public static class Factory extends PersistenceWorkerProvider {
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public MemoryPoolMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new MemoryPoolMetricPersistenceWorker(moduleManager);
+ @Override public MemoryHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new MemoryHourMetricPersistenceWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryHourMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryHourMetricTransformNode.java
new file mode 100644
index 000000000..dafed4b60
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryHourMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryHourMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_HOUR_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(MemoryMetric memoryMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToHour(memoryMetric.getTimeBucket());
+
+ MemoryMetric newMemoryMetric = MemoryMetricCopy.copy(memoryMetric);
+ newMemoryMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + memoryMetric.getMetricId());
+ newMemoryMetric.setTimeBucket(timeBucket);
+ next.execute(newMemoryMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMetricBridgeNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMetricBridgeNode.java
new file mode 100644
index 000000000..2137690f4
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMetricBridgeNode.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryMetricBridgeNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_METRIC_BRIDGE_NODE_ID;
+ }
+
+ @Override public void process(MemoryMetric metric, Next next) {
+ next.execute(metric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMetricCopy.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMetricCopy.java
new file mode 100644
index 000000000..55b9b134e
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMetricCopy.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
+
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryMetricCopy {
+
+ public static MemoryMetric copy(MemoryMetric memoryMetric) {
+ MemoryMetric newMemoryMetric = new MemoryMetric();
+ newMemoryMetric.setId(memoryMetric.getId());
+ newMemoryMetric.setMetricId(memoryMetric.getMetricId());
+
+ newMemoryMetric.setInstanceId(memoryMetric.getInstanceId());
+ newMemoryMetric.setIsHeap(memoryMetric.getIsHeap());
+
+ newMemoryMetric.setInit(memoryMetric.getInit());
+ newMemoryMetric.setMax(memoryMetric.getMax());
+ newMemoryMetric.setUsed(memoryMetric.getUsed());
+ newMemoryMetric.setCommitted(memoryMetric.getCommitted());
+ newMemoryMetric.setTimes(memoryMetric.getTimes());
+
+ newMemoryMetric.setTimeBucket(memoryMetric.getTimeBucket());
+ return newMemoryMetric;
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryMetricPersistenceGraph.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMetricPersistenceGraph.java
similarity index 60%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryMetricPersistenceGraph.java
rename to apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMetricPersistenceGraph.java
index f773581fa..b3e0a09ff 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryMetricPersistenceGraph.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMetricPersistenceGraph.java
@@ -16,11 +16,12 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
+import org.apache.skywalking.apm.collector.core.graph.Node;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
@@ -38,7 +39,21 @@ public class MemoryMetricPersistenceGraph {
}
public void create() {
- GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.MEMORY_METRIC_PERSISTENCE_GRAPH_ID, MemoryMetric.class)
- .addNode(new MemoryMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+ Node bridgeNode = GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.MEMORY_METRIC_PERSISTENCE_GRAPH_ID, MemoryMetric.class)
+ .addNode(new MemoryMetricBridgeNode());
+
+ bridgeNode.addNext(new MemorySecondMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new MemoryMinuteMetricTransformNode())
+ .addNext(new MemoryMinuteMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new MemoryHourMetricTransformNode())
+ .addNext(new MemoryHourMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new MemoryDayMetricTransformNode())
+ .addNext(new MemoryDayMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new MemoryMonthMetricTransformNode())
+ .addNext(new MemoryMonthMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMinuteMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMinuteMetricPersistenceWorker.java
new file mode 100644
index 000000000..6a64384aa
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMinuteMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryMinuteMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryMinuteMetricPersistenceWorker extends PersistenceWorker {
+
+ public MemoryMinuteMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_MINUTE_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, MemoryMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IMemoryMinuteMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public MemoryMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new MemoryMinuteMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMinuteMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMinuteMetricTransformNode.java
new file mode 100644
index 000000000..2e5de1be5
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMinuteMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryMinuteMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_MINUTE_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(MemoryMetric memoryMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToMinute(memoryMetric.getTimeBucket());
+
+ MemoryMetric newMemoryMetric = MemoryMetricCopy.copy(memoryMetric);
+ newMemoryMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + memoryMetric.getMetricId());
+ newMemoryMetric.setTimeBucket(timeBucket);
+ next.execute(newMemoryMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMonthMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMonthMetricPersistenceWorker.java
new file mode 100644
index 000000000..9e22cef9c
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMonthMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryMonthMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryMonthMetricPersistenceWorker extends PersistenceWorker {
+
+ public MemoryMonthMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_MONTH_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, MemoryMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IMemoryMonthMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public MemoryMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new MemoryMonthMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMonthMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMonthMetricTransformNode.java
new file mode 100644
index 000000000..e15d17559
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemoryMonthMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryMonthMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_MONTH_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(MemoryMetric memoryMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToMonth(memoryMetric.getTimeBucket());
+
+ MemoryMetric newMemoryMetric = MemoryMetricCopy.copy(memoryMetric);
+ newMemoryMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + memoryMetric.getMetricId());
+ newMemoryMetric.setTimeBucket(timeBucket);
+ next.execute(newMemoryMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemorySecondMetricPersistenceWorker.java
similarity index 76%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryMetricPersistenceWorker.java
rename to apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemorySecondMetricPersistenceWorker.java
index c09a37d07..d1105e5b3 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryMetricPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memory/MemorySecondMetricPersistenceWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
@@ -24,20 +24,20 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IMemoryMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemorySecondMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
/**
* @author peng-yongsheng
*/
-public class MemoryMetricPersistenceWorker extends PersistenceWorker {
+public class MemorySecondMetricPersistenceWorker extends PersistenceWorker {
- public MemoryMetricPersistenceWorker(ModuleManager moduleManager) {
+ public MemorySecondMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return WorkerIdDefine.MEMORY_METRIC_PERSISTENCE_WORKER_ID;
+ return WorkerIdDefine.MEMORY_SECOND_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
@@ -46,17 +46,17 @@ public class MemoryMetricPersistenceWorker extends PersistenceWorker persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IMemoryMetricPersistenceDAO.class);
+ return getModuleManager().find(StorageModule.NAME).getService(IMemorySecondMetricPersistenceDAO.class);
}
- public static class Factory extends PersistenceWorkerProvider {
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public MemoryMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new MemoryMetricPersistenceWorker(moduleManager);
+ @Override public MemorySecondMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new MemorySecondMetricPersistenceWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolDayMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolDayMetricPersistenceWorker.java
new file mode 100644
index 000000000..7336c0087
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolDayMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolDayMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryPoolDayMetricPersistenceWorker extends PersistenceWorker {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_POOL_DAY_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ public MemoryPoolDayMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, MemoryPoolMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IMemoryPoolDayMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public MemoryPoolDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new MemoryPoolDayMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolDayMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolDayMetricTransformNode.java
new file mode 100644
index 000000000..41fa06d31
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolDayMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryPoolDayMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_POOL_DAY_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(MemoryPoolMetric memoryPoolMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToDay(memoryPoolMetric.getTimeBucket());
+
+ MemoryPoolMetric newMemoryPoolMetric = MemoryPoolMetricCopy.copy(memoryPoolMetric);
+ newMemoryPoolMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + memoryPoolMetric.getMetricId());
+ newMemoryPoolMetric.setTimeBucket(timeBucket);
+ next.execute(newMemoryPoolMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolHourMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolHourMetricPersistenceWorker.java
new file mode 100644
index 000000000..eed97c867
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolHourMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolHourMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryPoolHourMetricPersistenceWorker extends PersistenceWorker {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_POOL_HOUR_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ public MemoryPoolHourMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, MemoryPoolMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IMemoryPoolHourMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public MemoryPoolHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new MemoryPoolHourMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolHourMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolHourMetricTransformNode.java
new file mode 100644
index 000000000..d073d1888
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolHourMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryPoolHourMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_POOL_HOUR_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(MemoryPoolMetric memoryPoolMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToHour(memoryPoolMetric.getTimeBucket());
+
+ MemoryPoolMetric newMemoryPoolMetric = MemoryPoolMetricCopy.copy(memoryPoolMetric);
+ newMemoryPoolMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + memoryPoolMetric.getMetricId());
+ newMemoryPoolMetric.setTimeBucket(timeBucket);
+ next.execute(newMemoryPoolMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMetricBridgeNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMetricBridgeNode.java
new file mode 100644
index 000000000..3220ea876
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMetricBridgeNode.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryPoolMetricBridgeNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_POOL_METRIC_BRIDGE_NODE_ID;
+ }
+
+ @Override public void process(MemoryPoolMetric metric, Next next) {
+ next.execute(metric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMetricCopy.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMetricCopy.java
new file mode 100644
index 000000000..4b805f52f
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMetricCopy.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
+
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryPoolMetricCopy {
+
+ public static MemoryPoolMetric copy(MemoryPoolMetric memoryPoolMetric) {
+ MemoryPoolMetric newMemoryPoolMetric = new MemoryPoolMetric();
+ newMemoryPoolMetric.setId(memoryPoolMetric.getId());
+ newMemoryPoolMetric.setMetricId(memoryPoolMetric.getMetricId());
+
+ newMemoryPoolMetric.setInstanceId(memoryPoolMetric.getInstanceId());
+
+ newMemoryPoolMetric.setInit(memoryPoolMetric.getInit());
+ newMemoryPoolMetric.setMax(memoryPoolMetric.getMax());
+ newMemoryPoolMetric.setUsed(memoryPoolMetric.getUsed());
+ newMemoryPoolMetric.setCommitted(memoryPoolMetric.getCommitted());
+ newMemoryPoolMetric.setPoolType(memoryPoolMetric.getPoolType());
+ newMemoryPoolMetric.setTimes(memoryPoolMetric.getTimes());
+
+ newMemoryPoolMetric.setTimeBucket(memoryPoolMetric.getTimeBucket());
+ return newMemoryPoolMetric;
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryPoolMetricPersistenceGraph.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMetricPersistenceGraph.java
similarity index 59%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryPoolMetricPersistenceGraph.java
rename to apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMetricPersistenceGraph.java
index 5a45b362f..3d79c9637 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/MemoryPoolMetricPersistenceGraph.java
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMetricPersistenceGraph.java
@@ -16,11 +16,12 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.GraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
+import org.apache.skywalking.apm.collector.core.graph.Node;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
@@ -38,7 +39,21 @@ public class MemoryPoolMetricPersistenceGraph {
}
public void create() {
- GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.MEMORY_POOL_METRIC_PERSISTENCE_GRAPH_ID, MemoryPoolMetric.class)
- .addNode(new MemoryPoolMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+ Node bridgeNode = GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.MEMORY_POOL_METRIC_PERSISTENCE_GRAPH_ID, MemoryPoolMetric.class)
+ .addNode(new MemoryPoolMetricBridgeNode());
+
+ bridgeNode.addNext(new MemoryPoolSecondMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new MemoryPoolMinuteMetricTransformNode())
+ .addNext(new MemoryPoolMinuteMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new MemoryPoolHourMetricTransformNode())
+ .addNext(new MemoryPoolHourMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new MemoryPoolDayMetricTransformNode())
+ .addNext(new MemoryPoolDayMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ bridgeNode.addNext(new MemoryPoolMonthMetricTransformNode())
+ .addNext(new MemoryPoolMonthMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMinuteMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMinuteMetricPersistenceWorker.java
new file mode 100644
index 000000000..81358e165
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMinuteMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolMinuteMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryPoolMinuteMetricPersistenceWorker extends PersistenceWorker {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_POOL_MINUTE_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ public MemoryPoolMinuteMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, MemoryPoolMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IMemoryPoolMinuteMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public MemoryPoolMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new MemoryPoolMinuteMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMinuteMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMinuteMetricTransformNode.java
new file mode 100644
index 000000000..9a94c9853
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMinuteMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryPoolMinuteMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_POOL_MINUTE_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(MemoryPoolMetric memoryPoolMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToMinute(memoryPoolMetric.getTimeBucket());
+
+ MemoryPoolMetric newMemoryPoolMetric = MemoryPoolMetricCopy.copy(memoryPoolMetric);
+ newMemoryPoolMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + memoryPoolMetric.getMetricId());
+ newMemoryPoolMetric.setTimeBucket(timeBucket);
+ next.execute(newMemoryPoolMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMonthMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMonthMetricPersistenceWorker.java
new file mode 100644
index 000000000..7bcc3fec9
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMonthMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolMonthMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryPoolMonthMetricPersistenceWorker extends PersistenceWorker {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_POOL_MONTH_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ public MemoryPoolMonthMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, MemoryPoolMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IMemoryPoolMonthMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public MemoryPoolMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new MemoryPoolMonthMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMonthMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMonthMetricTransformNode.java
new file mode 100644
index 000000000..dec13a7d6
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolMonthMetricTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryPoolMonthMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_POOL_MONTH_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(MemoryPoolMetric memoryPoolMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.secondToMonth(memoryPoolMetric.getTimeBucket());
+
+ MemoryPoolMetric newMemoryPoolMetric = MemoryPoolMetricCopy.copy(memoryPoolMetric);
+ newMemoryPoolMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + memoryPoolMetric.getMetricId());
+ newMemoryPoolMetric.setTimeBucket(timeBucket);
+ next.execute(newMemoryPoolMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolSecondMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolSecondMetricPersistenceWorker.java
new file mode 100644
index 000000000..e75153ba9
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/memorypool/MemoryPoolSecondMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
+
+import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.mpoolmp.IMemoryPoolSecondMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemoryPoolSecondMetricPersistenceWorker extends PersistenceWorker {
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_POOL_SECOND_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ public MemoryPoolSecondMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, MemoryPoolMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IMemoryPoolSecondMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public MemoryPoolSecondMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new MemoryPoolSecondMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/AnalysisMetricModule.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/AnalysisMetricModule.java
index 9cf788088..27e917553 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/AnalysisMetricModule.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/AnalysisMetricModule.java
@@ -18,6 +18,7 @@
package org.apache.skywalking.apm.collector.analysis.metric.define;
+import org.apache.skywalking.apm.collector.analysis.metric.define.service.IInstanceHeartBeatService;
import org.apache.skywalking.apm.collector.core.module.Module;
/**
@@ -32,6 +33,6 @@ public class AnalysisMetricModule extends Module {
}
@Override public Class[] services() {
- return new Class[] {};
+ return new Class[] {IInstanceHeartBeatService.class};
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricGraphIdDefine.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricGraphIdDefine.java
index 191ca23ab..d4b69bed7 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricGraphIdDefine.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricGraphIdDefine.java
@@ -32,8 +32,9 @@ public class MetricGraphIdDefine {
public static final int APPLICATION_COMPONENT_GRAPH_ID = 406;
public static final int APPLICATION_MAPPING_GRAPH_ID = 407;
- public static final int SERVICE_ENTRY_GRAPH_ID = 408;
public static final int GLOBAL_TRACE_GRAPH_ID = 409;
public static final int SEGMENT_COST_GRAPH_ID = 410;
public static final int INSTANCE_MAPPING_GRAPH_ID = 411;
+
+ public static final int INSTANCE_HEART_BEAT_PERSISTENCE_GRAPH_ID = 412;
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricWorkerIdDefine.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricWorkerIdDefine.java
index 1bf126158..a275a4417 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricWorkerIdDefine.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricWorkerIdDefine.java
@@ -22,41 +22,95 @@ package org.apache.skywalking.apm.collector.analysis.metric.define.graph;
* @author peng-yongsheng
*/
public class MetricWorkerIdDefine {
- public static final int SERVICE_REFERENCE_METRIC_AGGREGATION_WORKER_ID = 400;
- public static final int SERVICE_REFERENCE_METRIC_REMOTE_WORKER_ID = 401;
- public static final int SERVICE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID = 402;
+ public static final int SERVICE_REFERENCE_MINUTE_METRIC_AGGREGATION_WORKER_ID = 4100;
+ public static final int SERVICE_REFERENCE_MINUTE_METRIC_REMOTE_WORKER_ID = 4101;
+ public static final int SERVICE_REFERENCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 4102;
+ public static final int SERVICE_REFERENCE_HOUR_METRIC_PERSISTENCE_WORKER_ID = 4103;
+ public static final int SERVICE_REFERENCE_HOUR_METRIC_TRANSFORM_NODE_ID = 4104;
+ public static final int SERVICE_REFERENCE_DAY_METRIC_PERSISTENCE_WORKER_ID = 4105;
+ public static final int SERVICE_REFERENCE_DAY_METRIC_TRANSFORM_NODE_ID = 4106;
+ public static final int SERVICE_REFERENCE_MONTH_METRIC_PERSISTENCE_WORKER_ID = 4107;
+ public static final int SERVICE_REFERENCE_MONTH_METRIC_TRANSFORM_NODE_ID = 4108;
- public static final int INSTANCE_REFERENCE_METRIC_AGGREGATION_WORKER_ID = 403;
- public static final int INSTANCE_REFERENCE_METRIC_REMOTE_WORKER_ID = 404;
- public static final int INSTANCE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID = 405;
+ public static final int INSTANCE_REFERENCE_MINUTE_METRIC_AGGREGATION_WORKER_ID = 4200;
+ public static final int INSTANCE_REFERENCE_MINUTE_METRIC_REMOTE_WORKER_ID = 4201;
+ public static final int INSTANCE_REFERENCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 4202;
+ public static final int INSTANCE_REFERENCE_HOUR_METRIC_PERSISTENCE_WORKER_ID = 4203;
+ public static final int INSTANCE_REFERENCE_HOUR_METRIC_TRANSFORM_NODE_ID = 4204;
+ public static final int INSTANCE_REFERENCE_DAY_METRIC_PERSISTENCE_WORKER_ID = 4205;
+ public static final int INSTANCE_REFERENCE_DAY_METRIC_TRANSFORM_NODE_ID = 4206;
+ public static final int INSTANCE_REFERENCE_MONTH_METRIC_PERSISTENCE_WORKER_ID = 4207;
+ public static final int INSTANCE_REFERENCE_MONTH_METRIC_TRANSFORM_NODE_ID = 4208;
- public static final int APPLICATION_REFERENCE_METRIC_AGGREGATION_WORKER_ID = 406;
- public static final int APPLICATION_REFERENCE_METRIC_REMOTE_WORKER_ID = 407;
- public static final int APPLICATION_REFERENCE_METRIC_PERSISTENCE_WORKER_ID = 408;
+ public static final int APPLICATION_REFERENCE_MINUTE_METRIC_AGGREGATION_WORKER_ID = 4300;
+ public static final int APPLICATION_REFERENCE_MINUTE_METRIC_REMOTE_WORKER_ID = 4301;
+ public static final int APPLICATION_REFERENCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 4302;
+ public static final int APPLICATION_REFERENCE_HOUR_METRIC_PERSISTENCE_WORKER_ID = 4303;
+ public static final int APPLICATION_REFERENCE_HOUR_METRIC_TRANSFORM_NODE_ID = 4304;
+ public static final int APPLICATION_REFERENCE_DAY_METRIC_PERSISTENCE_WORKER_ID = 4305;
+ public static final int APPLICATION_REFERENCE_DAY_METRIC_TRANSFORM_NODE_ID = 4306;
+ public static final int APPLICATION_REFERENCE_MONTH_METRIC_PERSISTENCE_WORKER_ID = 4307;
+ public static final int APPLICATION_REFERENCE_MONTH_METRIC_TRANSFORM_NODE_ID = 4308;
- public static final int SERVICE_METRIC_AGGREGATION_WORKER_ID = 409;
- public static final int SERVICE_METRIC_REMOTE_WORKER_ID = 410;
- public static final int SERVICE_METRIC_PERSISTENCE_WORKER_ID = 411;
+ public static final int SERVICE_MINUTE_METRIC_AGGREGATION_WORKER_ID = 4400;
+ public static final int SERVICE_MINUTE_METRIC_REMOTE_WORKER_ID = 4401;
+ public static final int SERVICE_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 4402;
+ public static final int SERVICE_HOUR_METRIC_PERSISTENCE_WORKER_ID = 4403;
+ public static final int SERVICE_HOUR_METRIC_TRANSFORM_NODE_ID = 4404;
+ public static final int SERVICE_DAY_METRIC_PERSISTENCE_WORKER_ID = 4405;
+ public static final int SERVICE_DAY_METRIC_TRANSFORM_NODE_ID = 4406;
+ public static final int SERVICE_MONTH_METRIC_PERSISTENCE_WORKER_ID = 4407;
+ public static final int SERVICE_MONTH_METRIC_TRANSFORM_NODE_ID = 4408;
- public static final int INSTANCE_METRIC_AGGREGATION_WORKER_ID = 412;
- public static final int INSTANCE_METRIC_REMOTE_WORKER_ID = 413;
- public static final int INSTANCE_METRIC_PERSISTENCE_WORKER_ID = 414;
+ public static final int INSTANCE_MINUTE_METRIC_AGGREGATION_WORKER_ID = 4500;
+ public static final int INSTANCE_MINUTE_METRIC_REMOTE_WORKER_ID = 4501;
+ public static final int INSTANCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 4502;
+ public static final int INSTANCE_HOUR_METRIC_PERSISTENCE_WORKER_ID = 4503;
+ public static final int INSTANCE_HOUR_METRIC_TRANSFORM_NODE_ID = 4504;
+ public static final int INSTANCE_DAY_METRIC_PERSISTENCE_WORKER_ID = 4505;
+ public static final int INSTANCE_DAY_METRIC_TRANSFORM_NODE_ID = 4506;
+ public static final int INSTANCE_MONTH_METRIC_PERSISTENCE_WORKER_ID = 4507;
+ public static final int INSTANCE_MONTH_METRIC_TRANSFORM_NODE_ID = 4508;
- public static final int APPLICATION_METRIC_AGGREGATION_WORKER_ID = 415;
- public static final int APPLICATION_METRIC_REMOTE_WORKER_ID = 416;
- public static final int APPLICATION_METRIC_PERSISTENCE_WORKER_ID = 417;
+ public static final int APPLICATION_MINUTE_METRIC_AGGREGATION_WORKER_ID = 4600;
+ public static final int APPLICATION_MINUTE_METRIC_REMOTE_WORKER_ID = 4601;
+ public static final int APPLICATION_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 4602;
+ public static final int APPLICATION_HOUR_METRIC_PERSISTENCE_WORKER_ID = 4603;
+ public static final int APPLICATION_HOUR_METRIC_TRANSFORM_NODE_ID = 4604;
+ public static final int APPLICATION_DAY_METRIC_PERSISTENCE_WORKER_ID = 4605;
+ public static final int APPLICATION_DAY_METRIC_TRANSFORM_NODE_ID = 4606;
+ public static final int APPLICATION_MONTH_METRIC_PERSISTENCE_WORKER_ID = 4607;
+ public static final int APPLICATION_MONTH_METRIC_TRANSFORM_NODE_ID = 4608;
- public static final int APPLICATION_COMPONENT_AGGREGATION_WORKER_ID = 418;
- public static final int APPLICATION_COMPONENT_REMOTE_WORKER_ID = 419;
- public static final int APPLICATION_COMPONENT_PERSISTENCE_WORKER_ID = 420;
+ public static final int INSTANCE_MAPPING_MINUTE_AGGREGATION_WORKER_ID = 4700;
+ public static final int INSTANCE_MAPPING_MINUTE_REMOTE_WORKER_ID = 4701;
+ public static final int INSTANCE_MAPPING_MINUTE_PERSISTENCE_WORKER_ID = 4702;
+ public static final int INSTANCE_MAPPING_HOUR_PERSISTENCE_WORKER_ID = 4703;
+ public static final int INSTANCE_MAPPING_HOUR_TRANSFORM_NODE_ID = 4704;
+ public static final int INSTANCE_MAPPING_DAY_PERSISTENCE_WORKER_ID = 4705;
+ public static final int INSTANCE_MAPPING_DAY_TRANSFORM_NODE_ID = 4706;
+ public static final int INSTANCE_MAPPING_MONTH_PERSISTENCE_WORKER_ID = 4707;
+ public static final int INSTANCE_MAPPING_MONTH_TRANSFORM_NODE_ID = 4708;
- public static final int APPLICATION_MAPPING_AGGREGATION_WORKER_ID = 421;
- public static final int APPLICATION_MAPPING_REMOTE_WORKER_ID = 422;
- public static final int APPLICATION_MAPPING_PERSISTENCE_WORKER_ID = 423;
+ public static final int APPLICATION_MAPPING_MINUTE_AGGREGATION_WORKER_ID = 4800;
+ public static final int APPLICATION_MAPPING_MINUTE_REMOTE_WORKER_ID = 4801;
+ public static final int APPLICATION_MAPPING_MINUTE_PERSISTENCE_WORKER_ID = 4802;
+ public static final int APPLICATION_MAPPING_HOUR_PERSISTENCE_WORKER_ID = 4803;
+ public static final int APPLICATION_MAPPING_HOUR_TRANSFORM_NODE_ID = 4804;
+ public static final int APPLICATION_MAPPING_DAY_PERSISTENCE_WORKER_ID = 4805;
+ public static final int APPLICATION_MAPPING_DAY_TRANSFORM_NODE_ID = 4806;
+ public static final int APPLICATION_MAPPING_MONTH_PERSISTENCE_WORKER_ID = 4807;
+ public static final int APPLICATION_MAPPING_MONTH_TRANSFORM_NODE_ID = 4808;
- public static final int SERVICE_ENTRY_AGGREGATION_WORKER_ID = 424;
- public static final int SERVICE_ENTRY_REMOTE_WORKER_ID = 425;
- public static final int SERVICE_ENTRY_PERSISTENCE_WORKER_ID = 426;
+ public static final int APPLICATION_COMPONENT_MINUTE_AGGREGATION_WORKER_ID = 4900;
+ public static final int APPLICATION_COMPONENT_MINUTE_REMOTE_WORKER_ID = 4901;
+ public static final int APPLICATION_COMPONENT_MINUTE_PERSISTENCE_WORKER_ID = 4902;
+ public static final int APPLICATION_COMPONENT_HOUR_PERSISTENCE_WORKER_ID = 4903;
+ public static final int APPLICATION_COMPONENT_HOUR_TRANSFORM_NODE_ID = 4904;
+ public static final int APPLICATION_COMPONENT_DAY_PERSISTENCE_WORKER_ID = 4905;
+ public static final int APPLICATION_COMPONENT_DAY_TRANSFORM_NODE_ID = 4906;
+ public static final int APPLICATION_COMPONENT_MONTH_PERSISTENCE_WORKER_ID = 4907;
+ public static final int APPLICATION_COMPONENT_MONTH_TRANSFORM_NODE_ID = 4908;
public static final int GLOBAL_TRACE_PERSISTENCE_WORKER_ID = 427;
public static final int SEGMENT_COST_PERSISTENCE_WORKER_ID = 428;
@@ -67,7 +121,5 @@ public class MetricWorkerIdDefine {
public static final int INSTANCE_METRIC_GRAPH_BRIDGE_WORKER_ID = 432;
public static final int APPLICATION_METRIC_GRAPH_BRIDGE_WORKER_ID = 433;
- public static final int INSTANCE_MAPPING_AGGREGATION_WORKER_ID = 434;
- public static final int INSTANCE_MAPPING_REMOTE_WORKER_ID = 435;
- public static final int INSTANCE_MAPPING_PERSISTENCE_WORKER_ID = 436;
+ public static final int INST_HEART_BEAT_PERSISTENCE_WORKER_ID = 400;
}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/service/IInstanceHeartBeatService.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/service/IInstanceHeartBeatService.java
similarity index 88%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/service/IInstanceHeartBeatService.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/service/IInstanceHeartBeatService.java
index 17abda2a0..bcce416ea 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/define/service/IInstanceHeartBeatService.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/service/IInstanceHeartBeatService.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.define.service;
+package org.apache.skywalking.apm.collector.analysis.metric.define.service;
import org.apache.skywalking.apm.collector.core.module.Service;
@@ -24,5 +24,5 @@ import org.apache.skywalking.apm.collector.core.module.Service;
* @author peng-yongsheng
*/
public interface IInstanceHeartBeatService extends Service {
- void send(int instanceId, long heartBeatTime);
+ void heartBeat(int instanceId, long heartBeatTime);
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java
index 1b8ee6e80..be6c3d3ee 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/AnalysisMetricModuleProvider.java
@@ -20,25 +20,26 @@ package org.apache.skywalking.apm.collector.analysis.metric.provider;
import java.util.Properties;
import org.apache.skywalking.apm.collector.analysis.metric.define.AnalysisMetricModule;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationComponentGraph;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationComponentSpanListener;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationMappingGraph;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationMappingSpanListener;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationMetricGraph;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationReferenceMetricGraph;
+import org.apache.skywalking.apm.collector.analysis.metric.define.service.IInstanceHeartBeatService;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.service.InstanceHeartBeatService;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component.ApplicationComponentGraph;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component.ApplicationComponentSpanListener;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping.ApplicationMappingGraph;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping.ApplicationMappingSpanListener;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric.ApplicationMetricGraph;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric.ApplicationReferenceMetricGraph;
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.global.GlobalTraceGraph;
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.global.GlobalTraceSpanListener;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.InstanceMappingGraph;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.InstanceMappingSpanListener;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.InstanceMetricGraph;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.InstanceReferenceMetricGraph;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.heartbeat.InstanceHeartBeatPersistenceGraph;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping.InstanceMappingGraph;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping.InstanceMappingSpanListener;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.metric.InstanceMetricGraph;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.refmetric.InstanceReferenceMetricGraph;
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.segment.SegmentCostGraph;
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.segment.SegmentCostSpanListener;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.ServiceEntryGraph;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.ServiceEntrySpanListener;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.ServiceMetricGraph;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.ServiceReferenceMetricGraph;
-import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.ServiceReferenceMetricSpanListener;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.metric.ServiceMetricGraph;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.refmetric.ServiceReferenceMetricGraph;
+import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.refmetric.ServiceReferenceMetricSpanListener;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.AnalysisSegmentParserModule;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.service.ISegmentParserListenerRegister;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
@@ -63,6 +64,7 @@ public class AnalysisMetricModuleProvider extends ModuleProvider {
}
@Override public void prepare(Properties config) throws ServiceNotProvidedException {
+ this.registerServiceImplementation(IInstanceHeartBeatService.class, new InstanceHeartBeatService());
}
@Override public void start(Properties config) throws ServiceNotProvidedException {
@@ -90,7 +92,6 @@ public class AnalysisMetricModuleProvider extends ModuleProvider {
segmentParserListenerRegister.register(new ApplicationComponentSpanListener.Factory());
segmentParserListenerRegister.register(new ApplicationMappingSpanListener.Factory());
segmentParserListenerRegister.register(new InstanceMappingSpanListener.Factory());
- segmentParserListenerRegister.register(new ServiceEntrySpanListener.Factory());
segmentParserListenerRegister.register(new GlobalTraceSpanListener.Factory());
segmentParserListenerRegister.register(new SegmentCostSpanListener.Factory());
}
@@ -123,13 +124,13 @@ public class AnalysisMetricModuleProvider extends ModuleProvider {
InstanceMappingGraph instanceMappingGraph = new InstanceMappingGraph(getManager(), workerCreateListener);
instanceMappingGraph.create();
- ServiceEntryGraph serviceEntryGraph = new ServiceEntryGraph(getManager(), workerCreateListener);
- serviceEntryGraph.create();
-
GlobalTraceGraph globalTraceGraph = new GlobalTraceGraph(getManager(), workerCreateListener);
globalTraceGraph.create();
SegmentCostGraph segmentCostGraph = new SegmentCostGraph(getManager(), workerCreateListener);
segmentCostGraph.create();
+
+ InstanceHeartBeatPersistenceGraph instanceHeartBeatPersistenceGraph = new InstanceHeartBeatPersistenceGraph(getManager(), workerCreateListener);
+ instanceHeartBeatPersistenceGraph.create();
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/InstanceHeartBeatService.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/service/InstanceHeartBeatService.java
similarity index 78%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/InstanceHeartBeatService.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/service/InstanceHeartBeatService.java
index 8d95234b1..31db2f8bb 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/service/InstanceHeartBeatService.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/service/InstanceHeartBeatService.java
@@ -16,10 +16,10 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.provider.service;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.service;
-import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.GraphIdDefine;
-import org.apache.skywalking.apm.collector.analysis.jvm.define.service.IInstanceHeartBeatService;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.service.IInstanceHeartBeatService;
import org.apache.skywalking.apm.collector.core.graph.Graph;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.util.ObjectUtils;
@@ -39,13 +39,14 @@ public class InstanceHeartBeatService implements IInstanceHeartBeatService {
private Graph getHeartBeatGraph() {
if (ObjectUtils.isEmpty(heartBeatGraph)) {
- this.heartBeatGraph = GraphManager.INSTANCE.findGraph(GraphIdDefine.INSTANCE_HEART_BEAT_PERSISTENCE_GRAPH_ID, Instance.class);
+ this.heartBeatGraph = GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.INSTANCE_HEART_BEAT_PERSISTENCE_GRAPH_ID, Instance.class);
}
return heartBeatGraph;
}
- @Override public void send(int instanceId, long heartBeatTime) {
- Instance instance = new Instance(String.valueOf(instanceId));
+ @Override public void heartBeat(int instanceId, long heartBeatTime) {
+ Instance instance = new Instance();
+ instance.setId(String.valueOf(instanceId));
instance.setHeartBeatTime(TimeBucketUtils.INSTANCE.getSecondTimeBucket(heartBeatTime));
instance.setInstanceId(instanceId);
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentCopy.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentCopy.java
new file mode 100644
index 000000000..27cf97272
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentCopy.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
+
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationComponentCopy {
+
+ public static ApplicationComponent copy(ApplicationComponent applicationComponent) {
+ ApplicationComponent newApplicationComponent = new ApplicationComponent();
+ newApplicationComponent.setId(applicationComponent.getId());
+ newApplicationComponent.setMetricId(applicationComponent.getMetricId());
+
+ newApplicationComponent.setComponentId(applicationComponent.getComponentId());
+ newApplicationComponent.setPeerId(applicationComponent.getPeerId());
+ newApplicationComponent.setTimeBucket(newApplicationComponent.getTimeBucket());
+ return newApplicationComponent;
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayPersistenceWorker.java
similarity index 74%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentPersistenceWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayPersistenceWorker.java
index d25641126..4da338c07 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayPersistenceWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
@@ -24,20 +24,20 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentDayPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent;
/**
* @author peng-yongsheng
*/
-public class ApplicationComponentPersistenceWorker extends PersistenceWorker {
+public class ApplicationComponentDayPersistenceWorker extends PersistenceWorker {
- public ApplicationComponentPersistenceWorker(ModuleManager moduleManager) {
+ public ApplicationComponentDayPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_COMPONENT_PERSISTENCE_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_COMPONENT_DAY_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
@@ -46,17 +46,17 @@ public class ApplicationComponentPersistenceWorker extends PersistenceWorker persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentPersistenceDAO.class);
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentDayPersistenceDAO.class);
}
- public static class Factory extends PersistenceWorkerProvider {
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public ApplicationComponentPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationComponentPersistenceWorker(moduleManager);
+ @Override public ApplicationComponentDayPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationComponentDayPersistenceWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayTransformNode.java
new file mode 100644
index 000000000..ff72a0f1f
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentDayTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationComponentDayTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_COMPONENT_DAY_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationComponent applicationComponent, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToDay(applicationComponent.getTimeBucket());
+
+ ApplicationComponent newApplicationComponent = ApplicationComponentCopy.copy(applicationComponent);
+ newApplicationComponent.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationComponent.getMetricId());
+ newApplicationComponent.setTimeBucket(timeBucket);
+ next.execute(newApplicationComponent);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentGraph.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentGraph.java
similarity index 60%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentGraph.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentGraph.java
index faa58e49d..07370b779 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentGraph.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentGraph.java
@@ -16,11 +16,12 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
+import org.apache.skywalking.apm.collector.core.graph.Node;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.remote.RemoteModule;
import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
@@ -42,9 +43,19 @@ public class ApplicationComponentGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
- GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID, ApplicationComponent.class)
- .addNode(new ApplicationComponentAggregationWorker.Factory(moduleManager).create(workerCreateListener))
- .addNext(new ApplicationComponentRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID).create(workerCreateListener))
- .addNext(new ApplicationComponentPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+ Node remoteNode = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID, ApplicationComponent.class)
+ .addNode(new ApplicationComponentMinuteAggregationWorker.Factory(moduleManager).create(workerCreateListener))
+ .addNext(new ApplicationComponentMinuteRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationComponentMinutePersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationComponentHourTransformNode())
+ .addNext(new ApplicationComponentHourPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationComponentDayTransformNode())
+ .addNext(new ApplicationComponentDayPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationComponentMonthTransformNode())
+ .addNext(new ApplicationComponentMonthPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourPersistenceWorker.java
new file mode 100644
index 000000000..fc18f82d7
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentHourPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationComponentHourPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationComponentHourPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_COMPONENT_HOUR_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationComponent> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentHourPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationComponentHourPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationComponentHourPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourTransformNode.java
new file mode 100644
index 000000000..6c90cb65e
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentHourTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationComponentHourTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_COMPONENT_HOUR_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationComponent applicationComponent, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToHour(applicationComponent.getTimeBucket());
+
+ ApplicationComponent newApplicationComponent = ApplicationComponentCopy.copy(applicationComponent);
+ newApplicationComponent.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationComponent.getMetricId());
+ newApplicationComponent.setTimeBucket(timeBucket);
+ next.execute(newApplicationComponent);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentAggregationWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinuteAggregationWorker.java
similarity index 75%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentAggregationWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinuteAggregationWorker.java
index fb9a22521..bfadf6bd8 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentAggregationWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinuteAggregationWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
@@ -27,24 +27,24 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
-public class ApplicationComponentAggregationWorker extends AggregationWorker {
+public class ApplicationComponentMinuteAggregationWorker extends AggregationWorker {
- public ApplicationComponentAggregationWorker(ModuleManager moduleManager) {
+ public ApplicationComponentMinuteAggregationWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_COMPONENT_AGGREGATION_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_COMPONENT_MINUTE_AGGREGATION_WORKER_ID;
}
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
+ public static class Factory extends AbstractLocalAsyncWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public ApplicationComponentAggregationWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationComponentAggregationWorker(moduleManager);
+ @Override public ApplicationComponentMinuteAggregationWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationComponentMinuteAggregationWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinutePersistenceWorker.java
similarity index 73%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricPersistenceWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinutePersistenceWorker.java
index 7adf649ac..78ca9cd23 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinutePersistenceWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
@@ -24,20 +24,20 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceMetricPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
+import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMinutePersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent;
/**
* @author peng-yongsheng
*/
-public class ApplicationReferenceMetricPersistenceWorker extends PersistenceWorker {
+public class ApplicationComponentMinutePersistenceWorker extends PersistenceWorker {
- public ApplicationReferenceMetricPersistenceWorker(ModuleManager moduleManager) {
+ public ApplicationComponentMinutePersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_REFERENCE_METRIC_PERSISTENCE_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_COMPONENT_MINUTE_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
@@ -45,18 +45,18 @@ public class ApplicationReferenceMetricPersistenceWorker extends PersistenceWork
}
@SuppressWarnings("unchecked")
- @Override protected IPersistenceDAO, ?, ApplicationReferenceMetric> persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IApplicationReferenceMetricPersistenceDAO.class);
+ @Override protected IPersistenceDAO, ?, ApplicationComponent> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentMinutePersistenceDAO.class);
}
- public static class Factory extends PersistenceWorkerProvider {
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public ApplicationReferenceMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationReferenceMetricPersistenceWorker(moduleManager);
+ @Override public ApplicationComponentMinutePersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationComponentMinutePersistenceWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinuteRemoteWorker.java
similarity index 80%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentRemoteWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinuteRemoteWorker.java
index 5d3cb9af1..d262b71c7 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentRemoteWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMinuteRemoteWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
@@ -30,14 +30,14 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
-public class ApplicationComponentRemoteWorker extends AbstractRemoteWorker {
+public class ApplicationComponentMinuteRemoteWorker extends AbstractRemoteWorker {
- ApplicationComponentRemoteWorker(ModuleManager moduleManager) {
+ ApplicationComponentMinuteRemoteWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_COMPONENT_REMOTE_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_COMPONENT_MINUTE_REMOTE_WORKER_ID;
}
@Override protected void onWork(ApplicationComponent applicationComponent) throws WorkerException {
@@ -48,14 +48,14 @@ public class ApplicationComponentRemoteWorker extends AbstractRemoteWorker {
+ public static class Factory extends AbstractRemoteWorkerProvider {
public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
super(moduleManager, remoteSenderService, graphId);
}
- @Override public ApplicationComponentRemoteWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationComponentRemoteWorker(moduleManager);
+ @Override public ApplicationComponentMinuteRemoteWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationComponentMinuteRemoteWorker(moduleManager);
}
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthPersistenceWorker.java
new file mode 100644
index 000000000..bd5d2f07c
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.acp.IApplicationComponentMonthPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationComponentMonthPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationComponentMonthPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_COMPONENT_MONTH_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationComponent> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentMonthPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationComponentMonthPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationComponentMonthPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthTransformNode.java
new file mode 100644
index 000000000..35ee9fe63
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentMonthTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationComponentMonthTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_COMPONENT_MONTH_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationComponent applicationComponent, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToMonth(applicationComponent.getTimeBucket());
+
+ ApplicationComponent newApplicationComponent = ApplicationComponentCopy.copy(applicationComponent);
+ newApplicationComponent.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationComponent.getMetricId());
+ newApplicationComponent.setTimeBucket(timeBucket);
+ next.execute(newApplicationComponent);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentSpanListener.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentSpanListener.java
similarity index 89%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentSpanListener.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentSpanListener.java
index 439f67d20..80e4c7ece 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationComponentSpanListener.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/component/ApplicationComponentSpanListener.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.component;
import java.util.ArrayList;
import java.util.List;
@@ -33,24 +33,21 @@ import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.Const;
import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* @author peng-yongsheng
*/
public class ApplicationComponentSpanListener implements EntrySpanListener, ExitSpanListener, FirstSpanListener {
- private final Logger logger = LoggerFactory.getLogger(ApplicationComponentSpanListener.class);
-
private List applicationComponents = new ArrayList<>();
private long timeBucket;
@Override
public void parseExit(SpanDecorator spanDecorator, int applicationId, int instanceId, String segmentId) {
- String id = spanDecorator.getPeerId() + Const.ID_SPLIT + String.valueOf(spanDecorator.getComponentId());
+ String metricId = spanDecorator.getPeerId() + Const.ID_SPLIT + String.valueOf(spanDecorator.getComponentId());
- ApplicationComponent applicationComponent = new ApplicationComponent(id);
+ ApplicationComponent applicationComponent = new ApplicationComponent();
+ applicationComponent.setMetricId(metricId);
applicationComponent.setComponentId(spanDecorator.getComponentId());
applicationComponent.setPeerId(spanDecorator.getPeerId());
applicationComponents.add(applicationComponent);
@@ -58,9 +55,10 @@ public class ApplicationComponentSpanListener implements EntrySpanListener, Exit
@Override
public void parseEntry(SpanDecorator spanDecorator, int applicationId, int instanceId, String segmentId) {
- String id = String.valueOf(applicationId) + Const.ID_SPLIT + String.valueOf(spanDecorator.getComponentId());
+ String metricId = String.valueOf(applicationId) + Const.ID_SPLIT + String.valueOf(spanDecorator.getComponentId());
- ApplicationComponent applicationComponent = new ApplicationComponent(id);
+ ApplicationComponent applicationComponent = new ApplicationComponent();
+ applicationComponent.setMetricId(metricId);
applicationComponent.setComponentId(spanDecorator.getComponentId());
applicationComponent.setPeerId(applicationId);
applicationComponents.add(applicationComponent);
@@ -76,7 +74,7 @@ public class ApplicationComponentSpanListener implements EntrySpanListener, Exit
Graph graph = GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID, ApplicationComponent.class);
applicationComponents.forEach(applicationComponent -> {
- applicationComponent.setId(timeBucket + Const.ID_SPLIT + applicationComponent.getId());
+ applicationComponent.setId(timeBucket + Const.ID_SPLIT + applicationComponent.getMetricId());
applicationComponent.setTimeBucket(timeBucket);
graph.start(applicationComponent);
});
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingCopy.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingCopy.java
new file mode 100644
index 000000000..aa5aad45f
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingCopy.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
+
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMappingCopy {
+
+ public static ApplicationMapping copy(ApplicationMapping applicationMapping) {
+ ApplicationMapping newApplicationMapping = new ApplicationMapping();
+ newApplicationMapping.setId(applicationMapping.getId());
+ newApplicationMapping.setMetricId(applicationMapping.getMetricId());
+ newApplicationMapping.setTimeBucket(applicationMapping.getTimeBucket());
+
+ newApplicationMapping.setApplicationId(applicationMapping.getApplicationId());
+ newApplicationMapping.setAddressId(applicationMapping.getAddressId());
+ return newApplicationMapping;
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingDayPersistenceWorker.java
similarity index 75%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingPersistenceWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingDayPersistenceWorker.java
index 07a98d4bf..71600093e 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingDayPersistenceWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
@@ -24,20 +24,20 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingDayPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
/**
* @author peng-yongsheng
*/
-public class ApplicationMappingPersistenceWorker extends PersistenceWorker {
+public class ApplicationMappingDayPersistenceWorker extends PersistenceWorker {
- ApplicationMappingPersistenceWorker(ModuleManager moduleManager) {
+ ApplicationMappingDayPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_MAPPING_PERSISTENCE_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_MAPPING_DAY_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
@@ -46,17 +46,17 @@ public class ApplicationMappingPersistenceWorker extends PersistenceWorker persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingPersistenceDAO.class);
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingDayPersistenceDAO.class);
}
- public static class Factory extends PersistenceWorkerProvider {
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public ApplicationMappingPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationMappingPersistenceWorker(moduleManager);
+ @Override public ApplicationMappingDayPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMappingDayPersistenceWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingDayTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingDayTransformNode.java
new file mode 100644
index 000000000..a4b84b1c3
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingDayTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMappingDayTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_MAPPING_DAY_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationMapping applicationMapping, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToDay(applicationMapping.getTimeBucket());
+
+ ApplicationMapping newApplicationMapping = ApplicationMappingCopy.copy(applicationMapping);
+ newApplicationMapping.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMapping.getMetricId());
+ newApplicationMapping.setTimeBucket(timeBucket);
+ next.execute(newApplicationMapping);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingGraph.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingGraph.java
similarity index 60%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingGraph.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingGraph.java
index ec93dcaa5..4ed6857c8 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingGraph.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingGraph.java
@@ -16,11 +16,12 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
+import org.apache.skywalking.apm.collector.core.graph.Node;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.remote.RemoteModule;
import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
@@ -42,9 +43,19 @@ public class ApplicationMappingGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
- GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID, ApplicationMapping.class)
- .addNode(new ApplicationMappingAggregationWorker.Factory(moduleManager).create(workerCreateListener))
- .addNext(new ApplicationMappingRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID).create(workerCreateListener))
- .addNext(new ApplicationMappingPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+ Node remoteNode = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID, ApplicationMapping.class)
+ .addNode(new ApplicationMappingMinuteAggregationWorker.Factory(moduleManager).create(workerCreateListener))
+ .addNext(new ApplicationMappingMinuteRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationMappingMinutePersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationMappingHourTransformNode())
+ .addNext(new ApplicationMappingHourPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationMappingDayTransformNode())
+ .addNext(new ApplicationMappingDayPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationMappingMonthTransformNode())
+ .addNext(new ApplicationMappingMonthPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingHourPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingHourPersistenceWorker.java
new file mode 100644
index 000000000..953876e3f
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingHourPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingHourPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMappingHourPersistenceWorker extends PersistenceWorker {
+
+ ApplicationMappingHourPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_MAPPING_HOUR_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationMapping> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingHourPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationMappingHourPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMappingHourPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingHourTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingHourTransformNode.java
new file mode 100644
index 000000000..2fb129265
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingHourTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMappingHourTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_MAPPING_HOUR_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationMapping applicationMapping, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToHour(applicationMapping.getTimeBucket());
+
+ ApplicationMapping newApplicationMapping = ApplicationMappingCopy.copy(applicationMapping);
+ newApplicationMapping.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMapping.getMetricId());
+ newApplicationMapping.setTimeBucket(timeBucket);
+ next.execute(newApplicationMapping);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingAggregationWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMinuteAggregationWorker.java
similarity index 76%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingAggregationWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMinuteAggregationWorker.java
index d847e8033..60aa45d4c 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingAggregationWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMinuteAggregationWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
@@ -27,24 +27,24 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
-public class ApplicationMappingAggregationWorker extends AggregationWorker {
+public class ApplicationMappingMinuteAggregationWorker extends AggregationWorker {
- ApplicationMappingAggregationWorker(ModuleManager moduleManager) {
+ ApplicationMappingMinuteAggregationWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_MAPPING_AGGREGATION_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_MAPPING_MINUTE_AGGREGATION_WORKER_ID;
}
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
+ public static class Factory extends AbstractLocalAsyncWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public ApplicationMappingAggregationWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationMappingAggregationWorker(moduleManager);
+ @Override public ApplicationMappingMinuteAggregationWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMappingMinuteAggregationWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMinutePersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMinutePersistenceWorker.java
new file mode 100644
index 000000000..71ebf4db7
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMinutePersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMinutePersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMappingMinutePersistenceWorker extends PersistenceWorker {
+
+ ApplicationMappingMinutePersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_MAPPING_MINUTE_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationMapping> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingMinutePersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationMappingMinutePersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMappingMinutePersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMinuteRemoteWorker.java
similarity index 78%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingRemoteWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMinuteRemoteWorker.java
index 90e39eb1e..585af25bd 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingRemoteWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMinuteRemoteWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
@@ -30,14 +30,14 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
-public class ApplicationMappingRemoteWorker extends AbstractRemoteWorker {
+public class ApplicationMappingMinuteRemoteWorker extends AbstractRemoteWorker {
- ApplicationMappingRemoteWorker(ModuleManager moduleManager) {
+ ApplicationMappingMinuteRemoteWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_MAPPING_REMOTE_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_MAPPING_MINUTE_REMOTE_WORKER_ID;
}
@Override protected void onWork(ApplicationMapping applicationMapping) throws WorkerException {
@@ -48,13 +48,13 @@ public class ApplicationMappingRemoteWorker extends AbstractRemoteWorker {
+ public static class Factory extends AbstractRemoteWorkerProvider {
public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
super(moduleManager, remoteSenderService, graphId);
}
- @Override public ApplicationMappingRemoteWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationMappingRemoteWorker(moduleManager);
+ @Override public ApplicationMappingMinuteRemoteWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMappingMinuteRemoteWorker(moduleManager);
}
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMonthPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMonthPersistenceWorker.java
new file mode 100644
index 000000000..51aaf319b
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMonthPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ampp.IApplicationMappingMonthPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMappingMonthPersistenceWorker extends PersistenceWorker {
+
+ ApplicationMappingMonthPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_MAPPING_MONTH_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationMapping> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingMonthPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationMappingMonthPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMappingMonthPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMonthTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMonthTransformNode.java
new file mode 100644
index 000000000..1ea1ce068
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingMonthTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMappingMonthTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_MAPPING_MONTH_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationMapping applicationMapping, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToMonth(applicationMapping.getTimeBucket());
+
+ ApplicationMapping newApplicationMapping = ApplicationMappingCopy.copy(applicationMapping);
+ newApplicationMapping.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMapping.getMetricId());
+ newApplicationMapping.setTimeBucket(timeBucket);
+ next.execute(newApplicationMapping);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingSpanListener.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingSpanListener.java
similarity index 93%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingSpanListener.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingSpanListener.java
index a685a20e3..9433f2d5e 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMappingSpanListener.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/mapping/ApplicationMappingSpanListener.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.mapping;
import java.util.LinkedList;
import java.util.List;
@@ -49,11 +49,12 @@ public class ApplicationMappingSpanListener implements FirstSpanListener, EntryS
logger.debug("application mapping listener parse reference");
if (spanDecorator.getRefsCount() > 0) {
for (int i = 0; i < spanDecorator.getRefsCount(); i++) {
- ApplicationMapping applicationMapping = new ApplicationMapping(Const.EMPTY_STRING);
+ ApplicationMapping applicationMapping = new ApplicationMapping();
applicationMapping.setApplicationId(applicationId);
applicationMapping.setAddressId(spanDecorator.getRefs(i).getNetworkAddressId());
- String id = String.valueOf(applicationId) + Const.ID_SPLIT + String.valueOf(applicationMapping.getAddressId());
- applicationMapping.setId(id);
+
+ String metricId = String.valueOf(applicationId) + Const.ID_SPLIT + String.valueOf(applicationMapping.getAddressId());
+ applicationMapping.setMetricId(metricId);
applicationMappings.add(applicationMapping);
}
}
@@ -69,7 +70,7 @@ public class ApplicationMappingSpanListener implements FirstSpanListener, EntryS
logger.debug("application mapping listener build");
Graph graph = GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_MAPPING_GRAPH_ID, ApplicationMapping.class);
applicationMappings.forEach(applicationMapping -> {
- applicationMapping.setId(timeBucket + Const.ID_SPLIT + applicationMapping.getId());
+ applicationMapping.setId(timeBucket + Const.ID_SPLIT + applicationMapping.getMetricId());
applicationMapping.setTimeBucket(timeBucket);
logger.debug("push to application mapping aggregation worker, id: {}", applicationMapping.getId());
graph.start(applicationMapping);
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationDayMetricPersistenceWorker.java
similarity index 75%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricPersistenceWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationDayMetricPersistenceWorker.java
index 2044fb6f7..4a64714d9 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationDayMetricPersistenceWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
@@ -24,39 +24,39 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IApplicationMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationDayMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
/**
* @author peng-yongsheng
*/
-public class ApplicationMetricPersistenceWorker extends PersistenceWorker {
+public class ApplicationDayMetricPersistenceWorker extends PersistenceWorker {
- public ApplicationMetricPersistenceWorker(ModuleManager moduleManager) {
+ public ApplicationDayMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_METRIC_PERSISTENCE_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_DAY_METRIC_PERSISTENCE_WORKER_ID;
}
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO, ?, ApplicationMetric> persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IApplicationMetricPersistenceDAO.class);
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationDayMetricPersistenceDAO.class);
}
@Override protected boolean needMergeDBData() {
return true;
}
- public static class Factory extends PersistenceWorkerProvider {
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public ApplicationMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationMetricPersistenceWorker(moduleManager);
+ @Override public ApplicationDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationDayMetricPersistenceWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationDayMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationDayMetricTransformNode.java
new file mode 100644
index 000000000..d88c194e1
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationDayMetricTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationDayMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_DAY_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationMetric applicationMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToDay(applicationMetric.getTimeBucket());
+
+ ApplicationMetric newApplicationMetric = ApplicationMetricCopy.copy(applicationMetric);
+ newApplicationMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMetric.getMetricId());
+ newApplicationMetric.setTimeBucket(timeBucket);
+ next.execute(newApplicationMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationHourMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationHourMetricPersistenceWorker.java
new file mode 100644
index 000000000..4f7d4e7b2
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationHourMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationHourMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationHourMetricPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationHourMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_HOUR_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationHourMetricPersistenceDAO.class);
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationHourMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationHourMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationHourMetricTransformNode.java
new file mode 100644
index 000000000..9c7800473
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationHourMetricTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationHourMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_HOUR_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationMetric applicationMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToHour(applicationMetric.getTimeBucket());
+
+ ApplicationMetric newApplicationMetric = ApplicationMetricCopy.copy(applicationMetric);
+ newApplicationMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMetric.getMetricId());
+ newApplicationMetric.setTimeBucket(timeBucket);
+ next.execute(newApplicationMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMetricCopy.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMetricCopy.java
new file mode 100644
index 000000000..266399d2c
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMetricCopy.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
+
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMetricCopy {
+
+ public static ApplicationMetric copy(ApplicationMetric applicationMetric) {
+ ApplicationMetric newApplicationMetric = new ApplicationMetric();
+ newApplicationMetric.setId(applicationMetric.getId());
+ newApplicationMetric.setMetricId(applicationMetric.getMetricId());
+ newApplicationMetric.setSourceValue(applicationMetric.getSourceValue());
+
+ newApplicationMetric.setApplicationId(applicationMetric.getApplicationId());
+
+ newApplicationMetric.setTransactionCalls(applicationMetric.getTransactionCalls());
+ newApplicationMetric.setTransactionDurationSum(applicationMetric.getTransactionDurationSum());
+ newApplicationMetric.setTransactionErrorCalls(applicationMetric.getTransactionErrorCalls());
+ newApplicationMetric.setTransactionErrorDurationSum(applicationMetric.getTransactionErrorDurationSum());
+
+ newApplicationMetric.setBusinessTransactionCalls(applicationMetric.getBusinessTransactionCalls());
+ newApplicationMetric.setBusinessTransactionDurationSum(applicationMetric.getBusinessTransactionDurationSum());
+ newApplicationMetric.setBusinessTransactionErrorCalls(applicationMetric.getBusinessTransactionErrorCalls());
+ newApplicationMetric.setBusinessTransactionErrorDurationSum(applicationMetric.getBusinessTransactionErrorDurationSum());
+
+ newApplicationMetric.setMqTransactionCalls(applicationMetric.getMqTransactionCalls());
+ newApplicationMetric.setMqTransactionDurationSum(applicationMetric.getMqTransactionDurationSum());
+ newApplicationMetric.setMqTransactionErrorCalls(applicationMetric.getMqTransactionErrorCalls());
+ newApplicationMetric.setMqTransactionErrorDurationSum(applicationMetric.getMqTransactionErrorDurationSum());
+
+ newApplicationMetric.setSatisfiedCount(applicationMetric.getSatisfiedCount());
+ newApplicationMetric.setToleratingCount(applicationMetric.getToleratingCount());
+ newApplicationMetric.setFrustratedCount(applicationMetric.getFrustratedCount());
+
+ newApplicationMetric.setTimeBucket(applicationMetric.getTimeBucket());
+
+ return newApplicationMetric;
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricGraph.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMetricGraph.java
similarity index 71%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricGraph.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMetricGraph.java
index c6b91ed91..16771f1a8 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricGraph.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMetricGraph.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
@@ -24,10 +24,12 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCrea
import org.apache.skywalking.apm.collector.core.graph.Graph;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.Node;
import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.remote.RemoteModule;
import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
/**
@@ -48,16 +50,26 @@ public class ApplicationMetricGraph {
Graph graph = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID, ApplicationReferenceMetric.class);
- graph.addNode(new ApplicationMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
- .addNext(new ApplicationMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID).create(workerCreateListener))
- .addNext(new ApplicationMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+ Node remoteNode = graph.addNode(new ApplicationMinuteMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
+ .addNext(new ApplicationMinuteMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationMinuteMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationHourMetricTransformNode())
+ .addNext(new ApplicationHourMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationDayMetricTransformNode())
+ .addNext(new ApplicationDayMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationMonthMetricTransformNode())
+ .addNext(new ApplicationMonthMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
link(graph);
}
private void link(Graph graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_REFERENCE_METRIC_GRAPH_ID, ApplicationReferenceMetric.class)
- .toFinder().findNode(MetricWorkerIdDefine.APPLICATION_REFERENCE_METRIC_AGGREGATION_WORKER_ID, ApplicationReferenceMetric.class)
+ .toFinder().findNode(MetricWorkerIdDefine.APPLICATION_REFERENCE_MINUTE_METRIC_AGGREGATION_WORKER_ID, ApplicationReferenceMetric.class)
.addNext(new NodeProcessor() {
@Override public int id() {
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricAggregationWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMinuteMetricAggregationWorker.java
similarity index 85%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricAggregationWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMinuteMetricAggregationWorker.java
index 0580dd38f..4c21b9559 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricAggregationWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMinuteMetricAggregationWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
@@ -29,25 +29,30 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
-public class ApplicationMetricAggregationWorker extends AggregationWorker {
+public class ApplicationMinuteMetricAggregationWorker extends AggregationWorker {
- public ApplicationMetricAggregationWorker(ModuleManager moduleManager) {
+ public ApplicationMinuteMetricAggregationWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_METRIC_AGGREGATION_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_MINUTE_METRIC_AGGREGATION_WORKER_ID;
}
@Override protected ApplicationMetric transform(ApplicationReferenceMetric applicationReferenceMetric) {
Integer applicationId = applicationReferenceMetric.getBehindApplicationId();
Long timeBucket = applicationReferenceMetric.getTimeBucket();
- String id = String.valueOf(timeBucket)
- + Const.ID_SPLIT + String.valueOf(applicationId)
+ String metricId = String.valueOf(applicationId)
+ Const.ID_SPLIT + applicationReferenceMetric.getSourceValue();
- ApplicationMetric applicationMetric = new ApplicationMetric(id);
+ String id = String.valueOf(timeBucket)
+ + Const.ID_SPLIT + metricId;
+
+ ApplicationMetric applicationMetric = new ApplicationMetric();
+ applicationMetric.setId(id);
+ applicationMetric.setMetricId(metricId);
+
applicationMetric.setApplicationId(applicationId);
applicationMetric.setSourceValue(applicationReferenceMetric.getSourceValue());
@@ -75,14 +80,14 @@ public class ApplicationMetricAggregationWorker extends AggregationWorker {
+ public static class Factory extends AbstractLocalAsyncWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public ApplicationMetricAggregationWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationMetricAggregationWorker(moduleManager);
+ @Override public ApplicationMinuteMetricAggregationWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMinuteMetricAggregationWorker(moduleManager);
}
@Override public int queueSize() {
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMinuteMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMinuteMetricPersistenceWorker.java
new file mode 100644
index 000000000..89c97a0ac
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMinuteMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMinuteMetricPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationMinuteMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_MINUTE_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationMinuteMetricPersistenceDAO.class);
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMinuteMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMinuteMetricRemoteWorker.java
similarity index 78%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricRemoteWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMinuteMetricRemoteWorker.java
index 543d5fbc0..6aea53626 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationMetricRemoteWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMinuteMetricRemoteWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
@@ -30,14 +30,14 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
-public class ApplicationMetricRemoteWorker extends AbstractRemoteWorker {
+public class ApplicationMinuteMetricRemoteWorker extends AbstractRemoteWorker {
- public ApplicationMetricRemoteWorker(ModuleManager moduleManager) {
+ public ApplicationMinuteMetricRemoteWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_METRIC_REMOTE_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_MINUTE_METRIC_REMOTE_WORKER_ID;
}
@Override protected void onWork(ApplicationMetric applicationMetric) throws WorkerException {
@@ -48,13 +48,13 @@ public class ApplicationMetricRemoteWorker extends AbstractRemoteWorker {
+ public static class Factory extends AbstractRemoteWorkerProvider {
public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
super(moduleManager, remoteSenderService, graphId);
}
- @Override public ApplicationMetricRemoteWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationMetricRemoteWorker(moduleManager);
+ @Override public ApplicationMinuteMetricRemoteWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMinuteMetricRemoteWorker(moduleManager);
}
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMonthMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMonthMetricPersistenceWorker.java
new file mode 100644
index 000000000..8419cdb9c
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMonthMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMonthMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMonthMetricPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationMonthMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_MONTH_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationMonthMetricPersistenceDAO.class);
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMonthMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMonthMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMonthMetricTransformNode.java
new file mode 100644
index 000000000..6becd28ba
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/metric/ApplicationMonthMetricTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMonthMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_MONTH_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationMetric applicationMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToMonth(applicationMetric.getTimeBucket());
+
+ ApplicationMetric newApplicationMetric = ApplicationMetricCopy.copy(applicationMetric);
+ newApplicationMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMetric.getMetricId());
+ newApplicationMetric.setTimeBucket(timeBucket);
+ next.execute(newApplicationMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceDayMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceDayMetricPersistenceWorker.java
new file mode 100644
index 000000000..2741c3cb1
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceDayMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceDayMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceDayMetricPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationReferenceDayMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_REFERENCE_DAY_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationReferenceMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationReferenceDayMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationReferenceDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationReferenceDayMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceDayMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceDayMetricTransformNode.java
new file mode 100644
index 000000000..75af43d88
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceDayMetricTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceDayMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_REFERENCE_DAY_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationReferenceMetric applicationReferenceMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToDay(applicationReferenceMetric.getTimeBucket());
+
+ ApplicationReferenceMetric newApplicationReferenceMetric = ApplicationReferenceMetricCopy.copy(applicationReferenceMetric);
+ newApplicationReferenceMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationReferenceMetric.getMetricId());
+ newApplicationReferenceMetric.setTimeBucket(timeBucket);
+ next.execute(newApplicationReferenceMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceHourMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceHourMetricPersistenceWorker.java
new file mode 100644
index 000000000..7a74d2e25
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceHourMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceHourMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceHourMetricPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationReferenceHourMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_REFERENCE_HOUR_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationReferenceMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationReferenceHourMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationReferenceHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationReferenceHourMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceHourMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceHourMetricTransformNode.java
new file mode 100644
index 000000000..eb768da22
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceHourMetricTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceHourMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_REFERENCE_HOUR_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationReferenceMetric applicationReferenceMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToHour(applicationReferenceMetric.getTimeBucket());
+
+ ApplicationReferenceMetric newApplicationReferenceMetric = ApplicationReferenceMetricCopy.copy(applicationReferenceMetric);
+ newApplicationReferenceMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationReferenceMetric.getMetricId());
+ newApplicationReferenceMetric.setTimeBucket(timeBucket);
+ next.execute(newApplicationReferenceMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMetricCopy.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMetricCopy.java
new file mode 100644
index 000000000..4cf5b4ef3
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMetricCopy.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric;
+
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceMetricCopy {
+
+ public static ApplicationReferenceMetric copy(ApplicationReferenceMetric applicationReferenceMetric) {
+ ApplicationReferenceMetric newApplicationReferenceMetric = new ApplicationReferenceMetric();
+ newApplicationReferenceMetric.setId(applicationReferenceMetric.getId());
+ newApplicationReferenceMetric.setMetricId(applicationReferenceMetric.getMetricId());
+ newApplicationReferenceMetric.setSourceValue(applicationReferenceMetric.getSourceValue());
+
+ newApplicationReferenceMetric.setFrontApplicationId(applicationReferenceMetric.getFrontApplicationId());
+ newApplicationReferenceMetric.setBehindApplicationId(applicationReferenceMetric.getBehindApplicationId());
+
+ newApplicationReferenceMetric.setTransactionCalls(applicationReferenceMetric.getTransactionCalls());
+ newApplicationReferenceMetric.setTransactionDurationSum(applicationReferenceMetric.getTransactionDurationSum());
+ newApplicationReferenceMetric.setTransactionErrorCalls(applicationReferenceMetric.getTransactionErrorCalls());
+ newApplicationReferenceMetric.setTransactionErrorDurationSum(applicationReferenceMetric.getTransactionErrorDurationSum());
+
+ newApplicationReferenceMetric.setBusinessTransactionCalls(applicationReferenceMetric.getBusinessTransactionCalls());
+ newApplicationReferenceMetric.setBusinessTransactionDurationSum(applicationReferenceMetric.getBusinessTransactionDurationSum());
+ newApplicationReferenceMetric.setBusinessTransactionErrorCalls(applicationReferenceMetric.getBusinessTransactionErrorCalls());
+ newApplicationReferenceMetric.setBusinessTransactionErrorDurationSum(applicationReferenceMetric.getBusinessTransactionErrorDurationSum());
+
+ newApplicationReferenceMetric.setMqTransactionCalls(applicationReferenceMetric.getMqTransactionCalls());
+ newApplicationReferenceMetric.setMqTransactionDurationSum(applicationReferenceMetric.getMqTransactionDurationSum());
+ newApplicationReferenceMetric.setMqTransactionErrorCalls(applicationReferenceMetric.getMqTransactionErrorCalls());
+ newApplicationReferenceMetric.setMqTransactionErrorDurationSum(applicationReferenceMetric.getMqTransactionErrorDurationSum());
+
+ newApplicationReferenceMetric.setSatisfiedCount(applicationReferenceMetric.getSatisfiedCount());
+ newApplicationReferenceMetric.setToleratingCount(applicationReferenceMetric.getToleratingCount());
+ newApplicationReferenceMetric.setFrustratedCount(applicationReferenceMetric.getFrustratedCount());
+
+ newApplicationReferenceMetric.setTimeBucket(applicationReferenceMetric.getTimeBucket());
+
+ return newApplicationReferenceMetric;
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricGraph.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMetricGraph.java
similarity index 69%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricGraph.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMetricGraph.java
index 50c7a5a36..f6bcf8b17 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricGraph.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMetricGraph.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
@@ -24,10 +24,12 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCrea
import org.apache.skywalking.apm.collector.core.graph.Graph;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.Node;
import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.remote.RemoteModule;
import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetric;
/**
@@ -48,16 +50,26 @@ public class ApplicationReferenceMetricGraph {
Graph graph = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_REFERENCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class);
- graph.addNode(new ApplicationReferenceMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
- .addNext(new ApplicationReferenceMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_REFERENCE_METRIC_GRAPH_ID).create(workerCreateListener))
- .addNext(new ApplicationReferenceMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+ Node remoteNode = graph.addNode(new ApplicationReferenceMinuteMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
+ .addNext(new ApplicationReferenceMinuteMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_REFERENCE_METRIC_GRAPH_ID).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationReferenceMinuteMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationReferenceHourMetricTransformNode())
+ .addNext(new ApplicationReferenceHourMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationReferenceDayMetricTransformNode())
+ .addNext(new ApplicationReferenceDayMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new ApplicationReferenceMonthMetricTransformNode())
+ .addNext(new ApplicationReferenceMonthMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
link(graph);
}
private void link(Graph graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class)
- .toFinder().findNode(MetricWorkerIdDefine.INSTANCE_REFERENCE_METRIC_AGGREGATION_WORKER_ID, InstanceReferenceMetric.class)
+ .toFinder().findNode(MetricWorkerIdDefine.INSTANCE_REFERENCE_MINUTE_METRIC_AGGREGATION_WORKER_ID, InstanceReferenceMetric.class)
.addNext(new NodeProcessor() {
@Override public int id() {
return MetricWorkerIdDefine.APPLICATION_REFERENCE_GRAPH_BRIDGE_WORKER_ID;
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricAggregationWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMinuteMetricAggregationWorker.java
similarity index 86%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricAggregationWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMinuteMetricAggregationWorker.java
index 75bc32225..3910de510 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricAggregationWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMinuteMetricAggregationWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
@@ -34,31 +34,35 @@ import org.apache.skywalking.apm.collector.storage.table.instance.InstanceRefere
/**
* @author peng-yongsheng
*/
-public class ApplicationReferenceMetricAggregationWorker extends AggregationWorker {
+public class ApplicationReferenceMinuteMetricAggregationWorker extends AggregationWorker {
private final InstanceCacheService instanceCacheService;
private final IApdexThresholdService apdexThresholdService;
- public ApplicationReferenceMetricAggregationWorker(ModuleManager moduleManager) {
+ public ApplicationReferenceMinuteMetricAggregationWorker(ModuleManager moduleManager) {
super(moduleManager);
this.instanceCacheService = moduleManager.find(CacheModule.NAME).getService(InstanceCacheService.class);
this.apdexThresholdService = moduleManager.find(ConfigurationModule.NAME).getService(IApdexThresholdService.class);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_REFERENCE_METRIC_AGGREGATION_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_REFERENCE_MINUTE_METRIC_AGGREGATION_WORKER_ID;
}
@Override protected ApplicationReferenceMetric transform(InstanceReferenceMetric instanceReferenceMetric) {
Integer frontApplicationId = instanceCacheService.getApplicationId(instanceReferenceMetric.getFrontInstanceId());
Integer behindApplicationId = instanceCacheService.getApplicationId(instanceReferenceMetric.getBehindInstanceId());
- String id = instanceReferenceMetric.getTimeBucket()
- + Const.ID_SPLIT + frontApplicationId
+ String metricId = frontApplicationId
+ Const.ID_SPLIT + behindApplicationId
+ Const.ID_SPLIT + instanceReferenceMetric.getSourceValue();
- ApplicationReferenceMetric applicationReferenceMetric = new ApplicationReferenceMetric(id);
+ String id = instanceReferenceMetric.getTimeBucket()
+ + Const.ID_SPLIT + metricId;
+
+ ApplicationReferenceMetric applicationReferenceMetric = new ApplicationReferenceMetric();
+ applicationReferenceMetric.setId(id);
+ applicationReferenceMetric.setMetricId(metricId);
applicationReferenceMetric.setFrontApplicationId(frontApplicationId);
applicationReferenceMetric.setBehindApplicationId(behindApplicationId);
applicationReferenceMetric.setSourceValue(instanceReferenceMetric.getSourceValue());
@@ -92,14 +96,14 @@ public class ApplicationReferenceMetricAggregationWorker extends AggregationWork
return applicationReferenceMetric;
}
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
+ public static class Factory extends AbstractLocalAsyncWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public ApplicationReferenceMetricAggregationWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationReferenceMetricAggregationWorker(moduleManager);
+ @Override public ApplicationReferenceMinuteMetricAggregationWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationReferenceMinuteMetricAggregationWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMinuteMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMinuteMetricPersistenceWorker.java
new file mode 100644
index 000000000..72b542911
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMinuteMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceMinuteMetricPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationReferenceMinuteMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_REFERENCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationReferenceMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationReferenceMinuteMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationReferenceMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationReferenceMinuteMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMinuteMetricRemoteWorker.java
similarity index 79%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricRemoteWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMinuteMetricRemoteWorker.java
index ed8f9c80b..a39bd7ad0 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/ApplicationReferenceMetricRemoteWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMinuteMetricRemoteWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
@@ -30,14 +30,14 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
-public class ApplicationReferenceMetricRemoteWorker extends AbstractRemoteWorker {
+public class ApplicationReferenceMinuteMetricRemoteWorker extends AbstractRemoteWorker {
- ApplicationReferenceMetricRemoteWorker(ModuleManager moduleManager) {
+ ApplicationReferenceMinuteMetricRemoteWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.APPLICATION_REFERENCE_METRIC_REMOTE_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_REFERENCE_MINUTE_METRIC_REMOTE_WORKER_ID;
}
@Override protected void onWork(ApplicationReferenceMetric applicationReferenceMetric) throws WorkerException {
@@ -48,13 +48,13 @@ public class ApplicationReferenceMetricRemoteWorker extends AbstractRemoteWorker
return Selector.HashCode;
}
- public static class Factory extends AbstractRemoteWorkerProvider {
+ public static class Factory extends AbstractRemoteWorkerProvider {
public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
super(moduleManager, remoteSenderService, graphId);
}
- @Override public ApplicationReferenceMetricRemoteWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationReferenceMetricRemoteWorker(moduleManager);
+ @Override public ApplicationReferenceMinuteMetricRemoteWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationReferenceMinuteMetricRemoteWorker(moduleManager);
}
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMonthMetricPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMonthMetricPersistenceWorker.java
new file mode 100644
index 000000000..ac6f3b52a
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMonthMetricPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMonthMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceMonthMetricPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationReferenceMonthMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_REFERENCE_MONTH_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationReferenceMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationReferenceMonthMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationReferenceMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationReferenceMonthMetricPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMonthMetricTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMonthMetricTransformNode.java
new file mode 100644
index 000000000..426aee5c4
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/application/refmetric/ApplicationReferenceMonthMetricTransformNode.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceMonthMetricTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_REFERENCE_MONTH_METRIC_TRANSFORM_NODE_ID;
+ }
+
+ @Override
+ public void process(ApplicationReferenceMetric applicationReferenceMetric, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToMonth(applicationReferenceMetric.getTimeBucket());
+
+ ApplicationReferenceMetric newApplicationReferenceMetric = ApplicationReferenceMetricCopy.copy(applicationReferenceMetric);
+ newApplicationReferenceMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationReferenceMetric.getMetricId());
+ newApplicationReferenceMetric.setTimeBucket(timeBucket);
+ next.execute(newApplicationReferenceMetric);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/global/GlobalTraceSpanListener.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/global/GlobalTraceSpanListener.java
index c5239945f..23b293986 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/global/GlobalTraceSpanListener.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/global/GlobalTraceSpanListener.java
@@ -71,7 +71,8 @@ public class GlobalTraceSpanListener implements FirstSpanListener, GlobalTraceId
Graph graph = GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.GLOBAL_TRACE_GRAPH_ID, GlobalTrace.class);
for (String globalTraceId : globalTraceIds) {
- GlobalTrace globalTrace = new GlobalTrace(segmentId + Const.ID_SPLIT + globalTraceId);
+ GlobalTrace globalTrace = new GlobalTrace();
+ globalTrace.setId(segmentId + Const.ID_SPLIT + globalTraceId);
globalTrace.setGlobalTraceId(globalTraceId);
globalTrace.setSegmentId(segmentId);
globalTrace.setTimeBucket(timeBucket);
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/InstHeartBeatPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/heartbeat/InstHeartBeatPersistenceWorker.java
similarity index 90%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/InstHeartBeatPersistenceWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/heartbeat/InstHeartBeatPersistenceWorker.java
index b8bacc2c0..d157d0a9a 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/InstHeartBeatPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/heartbeat/InstHeartBeatPersistenceWorker.java
@@ -16,9 +16,9 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.heartbeat;
-import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@@ -37,7 +37,7 @@ public class InstHeartBeatPersistenceWorker extends PersistenceWorker
}
@Override public int id() {
- return WorkerIdDefine.INST_HEART_BEAT_PERSISTENCE_WORKER_ID;
+ return MetricWorkerIdDefine.INST_HEART_BEAT_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
diff --git a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/InstanceHeartBeatPersistenceGraph.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/heartbeat/InstanceHeartBeatPersistenceGraph.java
similarity index 84%
rename from apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/InstanceHeartBeatPersistenceGraph.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/heartbeat/InstanceHeartBeatPersistenceGraph.java
index 8caf4f4fb..7eab8f080 100644
--- a/apm-collector/apm-collector-analysis/analysis-jvm/jvm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/jvm/provider/worker/InstanceHeartBeatPersistenceGraph.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/heartbeat/InstanceHeartBeatPersistenceGraph.java
@@ -16,9 +16,9 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.heartbeat;
-import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.GraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@@ -38,7 +38,7 @@ public class InstanceHeartBeatPersistenceGraph {
}
public void create() {
- GraphManager.INSTANCE.createIfAbsent(GraphIdDefine.INSTANCE_HEART_BEAT_PERSISTENCE_GRAPH_ID, Instance.class)
+ GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.INSTANCE_HEART_BEAT_PERSISTENCE_GRAPH_ID, Instance.class)
.addNode(new InstHeartBeatPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingCopy.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingCopy.java
new file mode 100644
index 000000000..684d7a418
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingCopy.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping;
+
+import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMappingCopy {
+
+ public static InstanceMapping copy(InstanceMapping instanceMapping) {
+ InstanceMapping newInstanceMapping = new InstanceMapping();
+ newInstanceMapping.setId(instanceMapping.getId());
+ newInstanceMapping.setMetricId(instanceMapping.getMetricId());
+
+ newInstanceMapping.setApplicationId(instanceMapping.getApplicationId());
+ newInstanceMapping.setInstanceId(instanceMapping.getInstanceId());
+ newInstanceMapping.setAddressId(instanceMapping.getAddressId());
+ newInstanceMapping.setTimeBucket(instanceMapping.getTimeBucket());
+ return newInstanceMapping;
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingDayPersistenceWorker.java
similarity index 76%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingPersistenceWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingDayPersistenceWorker.java
index 475a4c32d..d0f31f981 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingPersistenceWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingDayPersistenceWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
@@ -24,20 +24,20 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.dao.IInstanceMappingPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingDayPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping;
/**
* @author peng-yongsheng
*/
-public class InstanceMappingPersistenceWorker extends PersistenceWorker {
+public class InstanceMappingDayPersistenceWorker extends PersistenceWorker {
- InstanceMappingPersistenceWorker(ModuleManager moduleManager) {
+ InstanceMappingDayPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.INSTANCE_MAPPING_PERSISTENCE_WORKER_ID;
+ return MetricWorkerIdDefine.INSTANCE_MAPPING_DAY_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
@@ -46,17 +46,17 @@ public class InstanceMappingPersistenceWorker extends PersistenceWorker persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IInstanceMappingPersistenceDAO.class);
+ return getModuleManager().find(StorageModule.NAME).getService(IInstanceMappingDayPersistenceDAO.class);
}
- public static class Factory extends PersistenceWorkerProvider {
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public InstanceMappingPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new InstanceMappingPersistenceWorker(moduleManager);
+ @Override public InstanceMappingDayPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceMappingDayPersistenceWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingDayTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingDayTransformNode.java
new file mode 100644
index 000000000..ce0c49c05
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingDayTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMappingDayTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.INSTANCE_MAPPING_DAY_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(InstanceMapping instanceMapping, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToDay(instanceMapping.getTimeBucket());
+
+ InstanceMapping newInstanceMapping = InstanceMappingCopy.copy(instanceMapping);
+ newInstanceMapping.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + instanceMapping.getMetricId());
+ newInstanceMapping.setTimeBucket(timeBucket);
+ next.execute(newInstanceMapping);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingGraph.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingGraph.java
similarity index 61%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingGraph.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingGraph.java
index af3081a29..0d2cd1bda 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingGraph.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingGraph.java
@@ -16,11 +16,12 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
+import org.apache.skywalking.apm.collector.core.graph.Node;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.remote.RemoteModule;
import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
@@ -42,9 +43,19 @@ public class InstanceMappingGraph {
public void create() {
RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
- GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.INSTANCE_MAPPING_GRAPH_ID, InstanceMapping.class)
- .addNode(new InstanceMappingAggregationWorker.Factory(moduleManager).create(workerCreateListener))
- .addNext(new InstanceMappingRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.INSTANCE_MAPPING_GRAPH_ID).create(workerCreateListener))
- .addNext(new InstanceMappingPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+ Node remoteNode = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.INSTANCE_MAPPING_GRAPH_ID, InstanceMapping.class)
+ .addNode(new InstanceMappingMinuteAggregationWorker.Factory(moduleManager).create(workerCreateListener))
+ .addNext(new InstanceMappingMinuteRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.INSTANCE_MAPPING_GRAPH_ID).create(workerCreateListener));
+
+ remoteNode.addNext(new InstanceMappingMinutePersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new InstanceMappingHourTransformNode())
+ .addNext(new InstanceMappingHourPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new InstanceMappingDayTransformNode())
+ .addNext(new InstanceMappingDayPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ remoteNode.addNext(new InstanceMappingMonthTransformNode())
+ .addNext(new InstanceMappingMonthPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingHourPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingHourPersistenceWorker.java
new file mode 100644
index 000000000..9c9307dac
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingHourPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingHourPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMappingHourPersistenceWorker extends PersistenceWorker {
+
+ InstanceMappingHourPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.INSTANCE_MAPPING_HOUR_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, InstanceMapping> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IInstanceMappingHourPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public InstanceMappingHourPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceMappingHourPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingHourTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingHourTransformNode.java
new file mode 100644
index 000000000..5acc7c389
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingHourTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMappingHourTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.INSTANCE_MAPPING_HOUR_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(InstanceMapping instanceMapping, Next next) {
+ long timeBucket = TimeBucketUtils.INSTANCE.minuteToHour(instanceMapping.getTimeBucket());
+
+ InstanceMapping newInstanceMapping = InstanceMappingCopy.copy(instanceMapping);
+ newInstanceMapping.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + instanceMapping.getMetricId());
+ newInstanceMapping.setTimeBucket(timeBucket);
+ next.execute(newInstanceMapping);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingAggregationWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMinuteAggregationWorker.java
similarity index 74%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingAggregationWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMinuteAggregationWorker.java
index d621aa197..1154641aa 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingAggregationWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMinuteAggregationWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
@@ -27,24 +27,24 @@ import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMappin
/**
* @author peng-yongsheng
*/
-public class InstanceMappingAggregationWorker extends AggregationWorker {
+public class InstanceMappingMinuteAggregationWorker extends AggregationWorker {
- InstanceMappingAggregationWorker(ModuleManager moduleManager) {
+ InstanceMappingMinuteAggregationWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.INSTANCE_MAPPING_AGGREGATION_WORKER_ID;
+ return MetricWorkerIdDefine.INSTANCE_MAPPING_MINUTE_AGGREGATION_WORKER_ID;
}
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
+ public static class Factory extends AbstractLocalAsyncWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public InstanceMappingAggregationWorker workerInstance(ModuleManager moduleManager) {
- return new InstanceMappingAggregationWorker(moduleManager);
+ @Override public InstanceMappingMinuteAggregationWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceMappingMinuteAggregationWorker(moduleManager);
}
@Override
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMinutePersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMinutePersistenceWorker.java
new file mode 100644
index 000000000..3a95ce025
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMinutePersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingMinutePersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMappingMinutePersistenceWorker extends PersistenceWorker {
+
+ InstanceMappingMinutePersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.INSTANCE_MAPPING_MINUTE_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, InstanceMapping> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IInstanceMappingMinutePersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public InstanceMappingMinutePersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceMappingMinutePersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMinuteRemoteWorker.java
similarity index 79%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingRemoteWorker.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMinuteRemoteWorker.java
index c7b784d3b..ced825b21 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/InstanceMappingRemoteWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMinuteRemoteWorker.java
@@ -16,7 +16,7 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance;
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping;
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
@@ -30,14 +30,14 @@ import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMappin
/**
* @author peng-yongsheng
*/
-public class InstanceMappingRemoteWorker extends AbstractRemoteWorker {
+public class InstanceMappingMinuteRemoteWorker extends AbstractRemoteWorker {
- InstanceMappingRemoteWorker(ModuleManager moduleManager) {
+ InstanceMappingMinuteRemoteWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return MetricWorkerIdDefine.INSTANCE_MAPPING_REMOTE_WORKER_ID;
+ return MetricWorkerIdDefine.INSTANCE_MAPPING_MINUTE_REMOTE_WORKER_ID;
}
@Override protected void onWork(InstanceMapping instanceMapping) throws WorkerException {
@@ -48,13 +48,13 @@ public class InstanceMappingRemoteWorker extends AbstractRemoteWorker {
+ public static class Factory extends AbstractRemoteWorkerProvider {
public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
super(moduleManager, remoteSenderService, graphId);
}
- @Override public InstanceMappingRemoteWorker workerInstance(ModuleManager moduleManager) {
- return new InstanceMappingRemoteWorker(moduleManager);
+ @Override public InstanceMappingMinuteRemoteWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceMappingMinuteRemoteWorker(moduleManager);
}
}
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMonthPersistenceWorker.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMonthPersistenceWorker.java
new file mode 100644
index 000000000..0752040c4
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMonthPersistenceWorker.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.dao.impp.IInstanceMappingMonthPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMappingMonthPersistenceWorker extends PersistenceWorker {
+
+ InstanceMappingMonthPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.INSTANCE_MAPPING_MONTH_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, InstanceMapping> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IInstanceMappingMonthPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public InstanceMappingMonthPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceMappingMonthPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMonthTransformNode.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMonthTransformNode.java
new file mode 100644
index 000000000..46cd30631
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/instance/mapping/InstanceMappingMonthTransformNode.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.instance.mapping;
+
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.core.graph.Next;
+import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMapping;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMappingMonthTransformNode implements NodeProcessor {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.INSTANCE_MAPPING_MONTH_TRANSFORM_NODE_ID;
+ }
+
+ @Override public void process(InstanceMapping instanceMapping, Next