diff --git a/README.md b/README.md
index cdb892f3f..0ac610447 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ microservices, cloud native and container-based (Docker, K8s, Mesos) architectur
Underlying technology is a distributed tracing system.
[](https://travis-ci.org/apache/incubator-skywalking)
-[](https://coveralls.io/github/apache/incubator-skywalking?branch=master)
+[](https://twitter.com/AsfSkyWalking)
[](https://gitter.im/openskywalking/Lobby)
[](http://opentracing.io)
@@ -22,12 +22,13 @@ Underlying technology is a distributed tracing system.
* Pure Java server implementation, provide RESTful and gRPC services. Compatibility with other language agents/SDKs.
* The UI released on [skywalking-ui](https://github.com/apache/incubator-skywalking-ui)
-# Architecture
-
-
# Document
-[](docs/README.md) [](docs/README_ZH.md)
+[](docs/README.md) [](docs/README_ZH.md)
+# 5.x Architecture
+
+
+# Code of conduct
This project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to wusheng@apache.org.
# Screenshots
diff --git a/README_ZH.md b/README_ZH.md
index 5e60fb898..6a274fc04 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -7,7 +7,7 @@ Apache SkyWalking | [English](README.md)
其核心是个分布式追踪系统。
[](https://travis-ci.org/apache/incubator-skywalking)
-[](https://coveralls.io/github/apache/incubator-skywalking?branch=master)
+[](https://twitter.com/AsfSkyWalking)
[](https://gitter.im/openskywalking/Lobby)
[](http://opentracing.io)
@@ -24,12 +24,14 @@ Apache SkyWalking | [English](README.md)
* UI工程请查看 [skywalking-ui](https://github.com/apache/incubator-skywalking-ui)
* 中文QQ群:392443393
-# Architecture
-
-
# Document
-[](docs/README.md) [](docs/README_ZH.md)
+[](docs/README.md) [](docs/README_ZH.md)
+
+# 5.x Architecture
+
+
+# code of conduct
This project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to wusheng@apache.org.
# Screenshots
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 e76c9d610..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
@@ -23,10 +23,12 @@ import org.apache.skywalking.apm.collector.agent.grpc.define.AgentGRPCModule;
import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.ApplicationRegisterServiceHandler;
import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.InstanceDiscoveryServiceHandler;
import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.JVMMetricsServiceHandler;
+import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.NetworkAddressRegisterServiceHandler;
import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.ServiceNameDiscoveryServiceHandler;
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;
@@ -86,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) {
@@ -95,5 +97,6 @@ public class AgentModuleGRPCProvider extends ModuleProvider {
gRPCServer.addHandler(new ServiceNameDiscoveryServiceHandler(getManager()));
gRPCServer.addHandler(new JVMMetricsServiceHandler(getManager()));
gRPCServer.addHandler(new TraceSegmentServiceHandler(getManager()));
+ gRPCServer.addHandler(new NetworkAddressRegisterServiceHandler(getManager()));
}
}
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 b8072fbd7..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.getOrCreate(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 38f174ef3..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,14 +21,16 @@ 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.ApplicationInstanceRecover;
import org.apache.skywalking.apm.network.proto.Downstream;
import org.apache.skywalking.apm.network.proto.InstanceDiscoveryServiceGrpc;
import org.apache.skywalking.apm.network.proto.OSInfo;
@@ -43,15 +45,18 @@ 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.getOrCreate(request.getApplicationId(), request.getAgentUUID(), timeBucket, buildOsInfo(request.getOsinfo()));
+ int instanceId = instanceIDService.getOrCreateByAgentUUID(request.getApplicationId(), request.getAgentUUID(), timeBucket, buildOsInfo(request.getOsinfo()));
ApplicationInstanceMapping.Builder builder = ApplicationInstanceMapping.newBuilder();
builder.setApplicationId(request.getApplicationId());
builder.setApplicationInstanceId(instanceId);
@@ -59,12 +64,10 @@ public class InstanceDiscoveryServiceHandler extends InstanceDiscoveryServiceGrp
responseObserver.onCompleted();
}
- @Override
- public void registerRecover(ApplicationInstanceRecover request, StreamObserver responseObserver) {
- long timeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(request.getRegisterTime());
- instanceIDService.recover(request.getApplicationInstanceId(), request.getApplicationId(), timeBucket, buildOsInfo(request.getOsinfo()));
- responseObserver.onNext(Downstream.newBuilder().build());
- 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) {
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/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/NetworkAddressRegisterServiceHandler.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/NetworkAddressRegisterServiceHandler.java
new file mode 100644
index 000000000..a00de671c
--- /dev/null
+++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/NetworkAddressRegisterServiceHandler.java
@@ -0,0 +1,65 @@
+/*
+ * 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 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.INetworkAddressIDService;
+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.KeyWithIntegerValue;
+import org.apache.skywalking.apm.network.proto.NetworkAddressMappings;
+import org.apache.skywalking.apm.network.proto.NetworkAddressRegisterServiceGrpc;
+import org.apache.skywalking.apm.network.proto.NetworkAddresses;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author peng-yongsheng
+ */
+public class NetworkAddressRegisterServiceHandler extends NetworkAddressRegisterServiceGrpc.NetworkAddressRegisterServiceImplBase implements GRPCHandler {
+
+ private final Logger logger = LoggerFactory.getLogger(NetworkAddressRegisterServiceHandler.class);
+
+ private final INetworkAddressIDService networkAddressIDService;
+
+ public NetworkAddressRegisterServiceHandler(ModuleManager moduleManager) {
+ this.networkAddressIDService = moduleManager.find(AnalysisRegisterModule.NAME).getService(INetworkAddressIDService.class);
+ }
+
+ @Override
+ public void batchRegister(NetworkAddresses request, StreamObserver responseObserver) {
+ logger.debug("register application");
+ ProtocolStringList addressesList = request.getAddressesList();
+
+ NetworkAddressMappings.Builder builder = NetworkAddressMappings.newBuilder();
+ for (int i = 0; i < addressesList.size(); i++) {
+ String networkAddress = addressesList.get(i);
+ int addressId = networkAddressIDService.getOrCreate(networkAddress);
+
+ if (addressId != 0) {
+ KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(networkAddress).setValue(addressId).build();
+ builder.addAddressIds(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/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
similarity index 82%
rename from apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandlerTestCase.java
rename to 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 ca2814508..50d9e82dc 100644
--- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/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
@@ -16,14 +16,13 @@
*
*/
-
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;
@@ -40,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-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/AgentModuleJettyProvider.java b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/AgentModuleJettyProvider.java
index 8ca30e585..0deed7837 100644
--- a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/AgentModuleJettyProvider.java
+++ b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/AgentModuleJettyProvider.java
@@ -22,6 +22,7 @@ import java.util.Properties;
import org.apache.skywalking.apm.collector.agent.jetty.define.AgentJettyModule;
import org.apache.skywalking.apm.collector.agent.jetty.provider.handler.ApplicationRegisterServletHandler;
import org.apache.skywalking.apm.collector.agent.jetty.provider.handler.InstanceDiscoveryServletHandler;
+import org.apache.skywalking.apm.collector.agent.jetty.provider.handler.NetworkAddressRegisterServletHandler;
import org.apache.skywalking.apm.collector.agent.jetty.provider.handler.ServiceNameDiscoveryServiceHandler;
import org.apache.skywalking.apm.collector.agent.jetty.provider.handler.TraceSegmentServletHandler;
import org.apache.skywalking.apm.collector.agent.jetty.provider.handler.naming.AgentJettyNamingHandler;
@@ -93,5 +94,6 @@ public class AgentModuleJettyProvider extends ModuleProvider {
jettyServer.addHandler(new ApplicationRegisterServletHandler(getManager()));
jettyServer.addHandler(new InstanceDiscoveryServletHandler(getManager()));
jettyServer.addHandler(new ServiceNameDiscoveryServiceHandler(getManager()));
+ jettyServer.addHandler(new NetworkAddressRegisterServletHandler(getManager()));
}
}
diff --git a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/handler/ApplicationRegisterServletHandler.java b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/handler/ApplicationRegisterServletHandler.java
index 77296190e..7cb6fbd2f 100644
--- a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/handler/ApplicationRegisterServletHandler.java
+++ b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/handler/ApplicationRegisterServletHandler.java
@@ -62,7 +62,7 @@ public class ApplicationRegisterServletHandler extends JettyHandler {
JsonArray applicationCodes = gson.fromJson(req.getReader(), JsonArray.class);
for (int i = 0; i < applicationCodes.size(); i++) {
String applicationCode = applicationCodes.get(i).getAsString();
- int applicationId = applicationIDService.getOrCreate(applicationCode);
+ int applicationId = applicationIDService.getOrCreateForApplicationCode(applicationCode);
JsonObject mapping = new JsonObject();
mapping.addProperty(APPLICATION_CODE, applicationCode);
mapping.addProperty(APPLICATION_ID, applicationId);
diff --git a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/handler/InstanceDiscoveryServletHandler.java b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/handler/InstanceDiscoveryServletHandler.java
index feac02102..0fd473b65 100644
--- a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/handler/InstanceDiscoveryServletHandler.java
+++ b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/handler/InstanceDiscoveryServletHandler.java
@@ -68,7 +68,7 @@ public class InstanceDiscoveryServletHandler extends JettyHandler {
long registerTime = instance.get(REGISTER_TIME).getAsLong();
JsonObject osInfo = instance.get(OS_INFO).getAsJsonObject();
- int instanceId = instanceIDService.getOrCreate(applicationId, agentUUID, registerTime, osInfo.toString());
+ int instanceId = instanceIDService.getOrCreateByAgentUUID(applicationId, agentUUID, registerTime, osInfo.toString());
responseJson.addProperty(APPLICATION_ID, applicationId);
responseJson.addProperty(INSTANCE_ID, instanceId);
} catch (IOException e) {
diff --git a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/handler/NetworkAddressRegisterServletHandler.java b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/handler/NetworkAddressRegisterServletHandler.java
new file mode 100644
index 000000000..c5768e767
--- /dev/null
+++ b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/agent/jetty/provider/handler/NetworkAddressRegisterServletHandler.java
@@ -0,0 +1,77 @@
+/*
+ * 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.jetty.provider.handler;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.skywalking.apm.collector.analysis.register.define.AnalysisRegisterModule;
+import org.apache.skywalking.apm.collector.analysis.register.define.service.INetworkAddressIDService;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException;
+import org.apache.skywalking.apm.collector.server.jetty.JettyHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author peng-yongsheng
+ */
+public class NetworkAddressRegisterServletHandler extends JettyHandler {
+
+ private final Logger logger = LoggerFactory.getLogger(NetworkAddressRegisterServletHandler.class);
+
+ private final INetworkAddressIDService networkAddressIDService;
+ private Gson gson = new Gson();
+ private static final String NETWORK_ADDRESS = "n";
+ private static final String ADDRESS_ID = "i";
+
+ public NetworkAddressRegisterServletHandler(ModuleManager moduleManager) {
+ this.networkAddressIDService = moduleManager.find(AnalysisRegisterModule.NAME).getService(INetworkAddressIDService.class);
+ }
+
+ @Override public String pathSpec() {
+ return "/networkAddress/register";
+ }
+
+ @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException {
+ JsonArray responseArray = new JsonArray();
+ try {
+ JsonArray networkAddresses = gson.fromJson(req.getReader(), JsonArray.class);
+ for (int i = 0; i < networkAddresses.size(); i++) {
+ String networkAddress = networkAddresses.get(i).getAsString();
+ logger.debug("network address register, network address: {}", networkAddress);
+ int addressId = networkAddressIDService.getOrCreate(networkAddress);
+ JsonObject mapping = new JsonObject();
+ mapping.addProperty(ADDRESS_ID, addressId);
+ mapping.addProperty(NETWORK_ADDRESS, networkAddress);
+ responseArray.add(mapping);
+ }
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ }
+ return responseArray;
+ }
+}
diff --git a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-consumer.json b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-consumer.json
index 453dce3eb..4c80222bd 100644
--- a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-consumer.json
+++ b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-consumer.json
@@ -14,7 +14,7 @@
24040000
],
"ai": -1,
- "ii": 1,
+ "ii": 2,
"rs": [],
"ss": [
{
diff --git a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-provider.json b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-provider.json
index a566c2850..e446706f2 100644
--- a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-provider.json
+++ b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-provider.json
@@ -14,7 +14,7 @@
48780000
],
"ai": 2,
- "ii": 2,
+ "ii": 3,
"ss": [
{
"si": 0,
@@ -37,13 +37,13 @@
185809,
24040000
],
- "pii": 1,
+ "pii": 2,
"psp": 0,
"psi": 0,
"psn": "/dubbox-case/case/dubbox-rest",
"ni": 0,
"nn": "172.25.0.4:20880",
- "eii": 1,
+ "eii": 2,
"esi": 0,
"esn": "/dubbox-case/case/dubbox-rest",
"rn": 0
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmGraphIdDefine.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmGraphIdDefine.java
new file mode 100644
index 000000000..91cafc79a
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmGraphIdDefine.java
@@ -0,0 +1,31 @@
+/*
+ * 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.alarm.define.graph;
+
+/**
+ * @author peng-yongsheng
+ */
+public class AlarmGraphIdDefine {
+ public static final int SERVICE_METRIC_ALARM_GRAPH_ID = 500;
+ public static final int INSTANCE_METRIC_ALARM_GRAPH_ID = 501;
+ public static final int APPLICATION_METRIC_ALARM_GRAPH_ID = 502;
+ public static final int SERVICE_REFERENCE_METRIC_ALARM_GRAPH_ID = 503;
+ public static final int INSTANCE_REFERENCE_METRIC_ALARM_GRAPH_ID = 504;
+ public static final int APPLICATION_REFERENCE_METRIC_ALARM_GRAPH_ID = 505;
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmWorkerIdDefine.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmWorkerIdDefine.java
new file mode 100644
index 000000000..0241473f6
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-define/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/define/graph/AlarmWorkerIdDefine.java
@@ -0,0 +1,66 @@
+/*
+ * 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.alarm.define.graph;
+
+/**
+ * @author peng-yongsheng
+ */
+public class AlarmWorkerIdDefine {
+ public static final int SERVICE_METRIC_ALARM_ASSERT_WORKER_ID = 500;
+ public static final int SERVICE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID = 501;
+ public static final int SERVICE_METRIC_ALARM_REMOTE_WORKER_ID = 502;
+ public static final int SERVICE_METRIC_ALARM_PERSISTENCE_WORKER_ID = 503;
+ public static final int SERVICE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID = 504;
+ public static final int SERVICE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID = 505;
+
+ public static final int INSTANCE_METRIC_ALARM_ASSERT_WORKER_ID = 510;
+ public static final int INSTANCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID = 511;
+ public static final int INSTANCE_METRIC_ALARM_REMOTE_WORKER_ID = 512;
+ public static final int INSTANCE_METRIC_ALARM_PERSISTENCE_WORKER_ID = 513;
+ public static final int INSTANCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID = 514;
+ public static final int INSTANCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID = 515;
+
+ public static final int APPLICATION_METRIC_ALARM_ASSERT_WORKER_ID = 520;
+ public static final int APPLICATION_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID = 521;
+ public static final int APPLICATION_METRIC_ALARM_REMOTE_WORKER_ID = 522;
+ public static final int APPLICATION_METRIC_ALARM_PERSISTENCE_WORKER_ID = 523;
+ public static final int APPLICATION_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID = 524;
+ public static final int APPLICATION_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID = 525;
+
+ public static final int SERVICE_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID = 530;
+ public static final int SERVICE_REFERENCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID = 531;
+ public static final int SERVICE_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID = 532;
+ public static final int SERVICE_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID = 533;
+ public static final int SERVICE_REFERENCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID = 534;
+ public static final int SERVICE_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID = 535;
+
+ public static final int INSTANCE_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID = 540;
+ public static final int INSTANCE_REFERENCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID = 541;
+ public static final int INSTANCE_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID = 542;
+ public static final int INSTANCE_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID = 543;
+ public static final int INSTANCE_REFERENCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID = 544;
+ public static final int INSTANCE_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID = 545;
+
+ public static final int APPLICATION_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID = 550;
+ public static final int APPLICATION_REFERENCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID = 551;
+ public static final int APPLICATION_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID = 552;
+ public static final int APPLICATION_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID = 553;
+ public static final int APPLICATION_REFERENCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID = 554;
+ public static final int APPLICATION_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID = 555;
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/pom.xml b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/pom.xml
index 6ba73c217..5afb68de9 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/pom.xml
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/pom.xml
@@ -36,6 +36,16 @@
alarm-define${project.version}
+
+ org.apache.skywalking
+ metric-define
+ ${project.version}
+
+
+ org.apache.skywalking
+ collector-configuration-define
+ ${project.version}
+ org.apache.skywalkingcollector-storage-define
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AlertingModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AlertingModuleProvider.java
deleted file mode 100644
index 802f5f55a..000000000
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AlertingModuleProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.alarm.provider;
-
-import java.util.Properties;
-import org.apache.skywalking.apm.collector.analysis.alarm.define.AnalysisAlarmModule;
-import org.apache.skywalking.apm.collector.core.module.Module;
-import org.apache.skywalking.apm.collector.core.module.ModuleProvider;
-import org.apache.skywalking.apm.collector.core.module.ServiceNotProvidedException;
-
-/**
- * @author peng-yongsheng
- */
-public class AlertingModuleProvider extends ModuleProvider {
-
- @Override public String name() {
- return "default";
- }
-
- @Override public Class extends Module> module() {
- return AnalysisAlarmModule.class;
- }
-
- @Override public void prepare(Properties config) throws ServiceNotProvidedException {
-
- }
-
- @Override public void start(Properties config) throws ServiceNotProvidedException {
-
- }
-
- @Override public void notifyAfterCompleted() throws ServiceNotProvidedException {
-
- }
-
- @Override public String[] requiredModules() {
- return new String[0];
- }
-}
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java
new file mode 100644
index 000000000..9c560ff4a
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/AnalysisAlarmModuleProvider.java
@@ -0,0 +1,88 @@
+/*
+ * 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.alarm.provider;
+
+import java.util.Properties;
+import org.apache.skywalking.apm.collector.analysis.alarm.define.AnalysisAlarmModule;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.application.ApplicationMetricAlarmGraph;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.application.ApplicationReferenceMetricAlarmGraph;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.instance.InstanceMetricAlarmGraph;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.instance.InstanceReferenceMetricAlarmGraph;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.service.ServiceMetricAlarmGraph;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.service.ServiceReferenceMetricAlarmGraph;
+import org.apache.skywalking.apm.collector.analysis.metric.define.AnalysisMetricModule;
+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.configuration.ConfigurationModule;
+import org.apache.skywalking.apm.collector.core.module.Module;
+import org.apache.skywalking.apm.collector.core.module.ModuleProvider;
+import org.apache.skywalking.apm.collector.core.module.ServiceNotProvidedException;
+import org.apache.skywalking.apm.collector.remote.RemoteModule;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+
+/**
+ * @author peng-yongsheng
+ */
+public class AnalysisAlarmModuleProvider extends ModuleProvider {
+
+ @Override public String name() {
+ return "default";
+ }
+
+ @Override public Class extends Module> module() {
+ return AnalysisAlarmModule.class;
+ }
+
+ @Override public void prepare(Properties config) throws ServiceNotProvidedException {
+
+ }
+
+ @Override public void start(Properties config) throws ServiceNotProvidedException {
+ WorkerCreateListener workerCreateListener = new WorkerCreateListener();
+
+ ServiceMetricAlarmGraph serviceMetricAlarmGraph = new ServiceMetricAlarmGraph(getManager(), workerCreateListener);
+ serviceMetricAlarmGraph.create();
+
+ InstanceMetricAlarmGraph instanceMetricAlarmGraph = new InstanceMetricAlarmGraph(getManager(), workerCreateListener);
+ instanceMetricAlarmGraph.create();
+
+ ApplicationMetricAlarmGraph applicationMetricAlarmGraph = new ApplicationMetricAlarmGraph(getManager(), workerCreateListener);
+ applicationMetricAlarmGraph.create();
+
+ ServiceReferenceMetricAlarmGraph serviceReferenceMetricAlarmGraph = new ServiceReferenceMetricAlarmGraph(getManager(), workerCreateListener);
+ serviceReferenceMetricAlarmGraph.create();
+
+ InstanceReferenceMetricAlarmGraph instanceReferenceMetricAlarmGraph = new InstanceReferenceMetricAlarmGraph(getManager(), workerCreateListener);
+ instanceReferenceMetricAlarmGraph.create();
+
+ ApplicationReferenceMetricAlarmGraph applicationReferenceMetricAlarmGraph = new ApplicationReferenceMetricAlarmGraph(getManager(), workerCreateListener);
+ applicationReferenceMetricAlarmGraph.create();
+
+ PersistenceTimer persistenceTimer = new PersistenceTimer(AnalysisAlarmModule.NAME);
+ persistenceTimer.start(getManager(), workerCreateListener.getPersistenceWorkers());
+ }
+
+ @Override public void notifyAfterCompleted() throws ServiceNotProvidedException {
+
+ }
+
+ @Override public String[] requiredModules() {
+ return new String[] {RemoteModule.NAME, AnalysisMetricModule.NAME, ConfigurationModule.NAME, StorageModule.NAME};
+ }
+}
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
new file mode 100644
index 000000000..c00db5644
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlarmAssertWorker.java
@@ -0,0 +1,123 @@
+/*
+ * 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.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.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;
+import org.apache.skywalking.apm.collector.storage.table.Metric;
+import org.apache.skywalking.apm.collector.storage.table.alarm.Alarm;
+import org.apache.skywalking.apm.collector.storage.table.alarm.AlarmType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author peng-yongsheng
+ */
+public abstract class AlarmAssertWorker extends AbstractLocalAsyncWorker {
+
+ private final Logger logger = LoggerFactory.getLogger(AlarmAssertWorker.class);
+
+ public AlarmAssertWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override protected final void onWork(INPUT inputMetric) throws WorkerException {
+ errorRateAlarmAssert(inputMetric);
+ averageResponseTimeAlarmAssert(inputMetric);
+ }
+
+ protected abstract OUTPUT newAlarmObject(String id, INPUT inputMetric);
+
+ protected abstract Double calleeErrorRateThreshold();
+
+ protected abstract Double callerErrorRateThreshold();
+
+ private void errorRateAlarmAssert(INPUT inputMetric) {
+ Double errorRate = Double.valueOf(inputMetric.getTransactionErrorCalls()) / Double.valueOf(inputMetric.getTransactionCalls());
+ errorRate = NumberFormatUtils.rateNumberFormat(errorRate);
+
+ if (inputMetric.getSourceValue().equals(MetricSource.Callee.getValue())) {
+ if (errorRate >= calleeErrorRateThreshold()) {
+ String id = String.valueOf(MetricSource.Callee.getValue()) + Const.ID_SPLIT + AlarmType.ERROR_RATE.getValue();
+ OUTPUT alarm = newAlarmObject(id, inputMetric);
+ alarm.setAlarmType(AlarmType.ERROR_RATE.getValue());
+ alarm.setLastTimeBucket(inputMetric.getTimeBucket());
+ alarm.setSourceValue(MetricSource.Callee.getValue());
+ alarm.setAlarmContent("");
+
+ onNext(alarm);
+ }
+ } else if (inputMetric.getSourceValue().equals(MetricSource.Caller.getValue())) {
+ if (errorRate >= callerErrorRateThreshold()) {
+ String id = String.valueOf(MetricSource.Caller.getValue()) + Const.ID_SPLIT + AlarmType.ERROR_RATE.getValue();
+ OUTPUT alarm = newAlarmObject(id, inputMetric);
+ alarm.setAlarmType(AlarmType.ERROR_RATE.getValue());
+ alarm.setLastTimeBucket(inputMetric.getTimeBucket());
+ alarm.setSourceValue(MetricSource.Caller.getValue());
+ alarm.setAlarmContent("");
+
+ onNext(alarm);
+ }
+ } else {
+ logger.error("Please check the metric source, the value must be {} or {}", MetricSource.Caller.getValue(), MetricSource.Callee.getValue());
+ }
+ }
+
+ protected abstract Double calleeAverageResponseTimeThreshold();
+
+ protected abstract Double callerAverageResponseTimeThreshold();
+
+ private void averageResponseTimeAlarmAssert(INPUT inputMetric) {
+ Long transactionSuccessDurationSum = inputMetric.getTransactionDurationSum() - inputMetric.getTransactionErrorDurationSum();
+ Long transactionSuccessCalls = inputMetric.getTransactionCalls() - inputMetric.getTransactionErrorCalls();
+ Double averageResponseTime = Double.valueOf(transactionSuccessDurationSum) / Double.valueOf(transactionSuccessCalls);
+
+ if (inputMetric.getSourceValue().equals(MetricSource.Callee.getValue())) {
+
+ if (averageResponseTime >= calleeAverageResponseTimeThreshold()) {
+ String id = String.valueOf(MetricSource.Callee.getValue()) + Const.ID_SPLIT + AlarmType.SLOW_RTT.getValue();
+ OUTPUT alarm = newAlarmObject(id, inputMetric);
+ alarm.setAlarmType(AlarmType.SLOW_RTT.getValue());
+ alarm.setLastTimeBucket(inputMetric.getTimeBucket());
+ alarm.setSourceValue(MetricSource.Callee.getValue());
+ alarm.setAlarmContent("");
+
+ onNext(alarm);
+ } else if (inputMetric.getSourceValue().equals(MetricSource.Caller.getValue())) {
+ if (averageResponseTime >= callerAverageResponseTimeThreshold()) {
+ String id = String.valueOf(MetricSource.Caller.getValue()) + Const.ID_SPLIT + AlarmType.SLOW_RTT.getValue();
+ OUTPUT alarm = newAlarmObject(id, inputMetric);
+ alarm.setAlarmType(AlarmType.SLOW_RTT.getValue());
+ alarm.setLastTimeBucket(inputMetric.getTimeBucket());
+ alarm.setSourceValue(MetricSource.Caller.getValue());
+ alarm.setAlarmContent("");
+
+ onNext(alarm);
+ }
+ } else {
+ logger.error("Please check the metric source, the value must be {} or {}", MetricSource.Caller.getValue(), MetricSource.Callee.getValue());
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlertingListAggregationWorker.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
similarity index 66%
rename from apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlertingListAggregationWorker.java
rename to apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlarmAssertWorkerProvider.java
index 6e0f4e602..d95418146 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlertingListAggregationWorker.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
@@ -18,25 +18,18 @@
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker;
-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.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
+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.alerting.AlertingList;
+import org.apache.skywalking.apm.collector.storage.table.Metric;
+import org.apache.skywalking.apm.collector.storage.table.alarm.Alarm;
/**
* @author peng-yongsheng
*/
-public class AlertingListAggregationWorker extends AbstractLocalAsyncWorker {
+public abstract class AlarmAssertWorkerProvider> extends AbstractLocalAsyncWorkerProvider {
- public AlertingListAggregationWorker(ModuleManager moduleManager) {
+ public AlarmAssertWorkerProvider(ModuleManager moduleManager) {
super(moduleManager);
}
-
- @Override public int id() {
- return 0;
- }
-
- @Override protected void onWork(AlertingList message) throws WorkerException {
-
- }
}
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
new file mode 100644
index 000000000..0a2e6d352
--- /dev/null
+++ 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
@@ -0,0 +1,85 @@
+/*
+ * 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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorker;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorkerProvider;
+import org.apache.skywalking.apm.collector.configuration.ConfigurationModule;
+import org.apache.skywalking.apm.collector.configuration.service.IApplicationAlarmRuleConfig;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarm;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMetricAlarmAssertWorker extends AlarmAssertWorker {
+
+ private final IApplicationAlarmRuleConfig applicationAlarmRuleConfig;
+
+ public ApplicationMetricAlarmAssertWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ this.applicationAlarmRuleConfig = moduleManager.find(ConfigurationModule.NAME).getService(IApplicationAlarmRuleConfig.class);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.APPLICATION_METRIC_ALARM_ASSERT_WORKER_ID;
+ }
+
+ @Override protected ApplicationAlarm newAlarmObject(String id, ApplicationMetric inputMetric) {
+ ApplicationAlarm applicationAlarm = new ApplicationAlarm();
+ applicationAlarm.setId(id + Const.ID_SPLIT + inputMetric.getApplicationId());
+ applicationAlarm.setApplicationId(inputMetric.getApplicationId());
+ return applicationAlarm;
+ }
+
+ @Override protected Double calleeErrorRateThreshold() {
+ return applicationAlarmRuleConfig.calleeErrorRateThreshold();
+ }
+
+ @Override protected Double callerErrorRateThreshold() {
+ return applicationAlarmRuleConfig.callerErrorRateThreshold();
+ }
+
+ @Override protected Double calleeAverageResponseTimeThreshold() {
+ return applicationAlarmRuleConfig.calleeAverageResponseTimeThreshold();
+ }
+
+ @Override protected Double callerAverageResponseTimeThreshold() {
+ return applicationAlarmRuleConfig.callerAverageResponseTimeThreshold();
+ }
+
+ public static class Factory extends AlarmAssertWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationMetricAlarmAssertWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMetricAlarmAssertWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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/ApplicationMetricAlarmGraph.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmGraph.java
new file mode 100644
index 000000000..0733dbab0
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmGraph.java
@@ -0,0 +1,79 @@
+/*
+ * 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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
+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.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.alarm.ApplicationAlarm;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMetricAlarmGraph {
+
+ private final ModuleManager moduleManager;
+ private final WorkerCreateListener workerCreateListener;
+
+ public ApplicationMetricAlarmGraph(ModuleManager moduleManager, WorkerCreateListener workerCreateListener) {
+ this.moduleManager = moduleManager;
+ this.workerCreateListener = workerCreateListener;
+ }
+
+ public void create() {
+ RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
+
+ Graph graph = GraphManager.INSTANCE.createIfAbsent(AlarmGraphIdDefine.APPLICATION_METRIC_ALARM_GRAPH_ID, ApplicationMetric.class);
+
+ graph.addNode(new ApplicationMetricAlarmAssertWorker.Factory(moduleManager).create(workerCreateListener))
+ .addNext(new ApplicationMetricAlarmRemoteWorker.Factory(moduleManager, remoteSenderService, AlarmGraphIdDefine.APPLICATION_METRIC_ALARM_GRAPH_ID).create(workerCreateListener))
+ .addNext(new ApplicationMetricAlarmPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ graph.toFinder().findNode(AlarmWorkerIdDefine.APPLICATION_METRIC_ALARM_REMOTE_WORKER_ID, ApplicationAlarm.class)
+ .addNext(new ApplicationMetricAlarmToListNodeProcessor())
+ .addNext(new ApplicationMetricAlarmListPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ link(graph);
+ }
+
+ private void link(Graph graph) {
+ GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_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;
+ }
+
+ @Override public void process(ApplicationMetric instanceMetric,
+ Next next) {
+ graph.start(instanceMetric);
+ }
+ });
+ }
+}
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
new file mode 100644
index 000000000..88963870f
--- /dev/null
+++ 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
@@ -0,0 +1,66 @@
+/*
+ * 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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.alarm.IApplicationAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMetricAlarmListPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationMetricAlarmListPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.APPLICATION_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationAlarmList> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationAlarmListPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationMetricAlarmListPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMetricAlarmListPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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
new file mode 100644
index 000000000..43be3e21f
--- /dev/null
+++ 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
@@ -0,0 +1,66 @@
+/*
+ * 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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.alarm.IApplicationAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMetricAlarmPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationMetricAlarmPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.APPLICATION_METRIC_ALARM_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationAlarm> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationAlarmPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationMetricAlarmPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMetricAlarmPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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/ApplicationMetricAlarmRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmRemoteWorker.java
new file mode 100644
index 000000000..8bf49284b
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationMetricAlarmRemoteWorker.java
@@ -0,0 +1,61 @@
+/*
+ * 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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorkerProvider;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
+import org.apache.skywalking.apm.collector.remote.service.Selector;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMetricAlarmRemoteWorker extends AbstractRemoteWorker {
+
+ public ApplicationMetricAlarmRemoteWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.APPLICATION_METRIC_ALARM_REMOTE_WORKER_ID;
+ }
+
+ @Override public Selector selector() {
+ return Selector.HashCode;
+ }
+
+ @Override protected void onWork(ApplicationAlarm message) throws WorkerException {
+ onNext(message);
+ }
+
+ public static class Factory extends AbstractRemoteWorkerProvider {
+
+ public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
+ super(moduleManager, remoteSenderService, graphId);
+ }
+
+ @Override public ApplicationMetricAlarmRemoteWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationMetricAlarmRemoteWorker(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/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
new file mode 100644
index 000000000..fbebedf06
--- /dev/null
+++ 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
@@ -0,0 +1,51 @@
+/*
+ * 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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.storage.table.alarm.ApplicationAlarm;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMetricAlarmToListNodeProcessor implements NodeProcessor {
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.APPLICATION_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID;
+ }
+
+ @Override public void process(ApplicationAlarm applicationAlarm, Next next) {
+ String id = applicationAlarm.getLastTimeBucket() + Const.ID_SPLIT + applicationAlarm.getSourceValue()
+ + Const.ID_SPLIT + applicationAlarm.getAlarmType()
+ + Const.ID_SPLIT + applicationAlarm.getApplicationId();
+
+ ApplicationAlarmList applicationAlarmList = new ApplicationAlarmList();
+ applicationAlarmList.setId(id);
+ applicationAlarmList.setApplicationId(applicationAlarm.getApplicationId());
+ applicationAlarmList.setSourceValue(applicationAlarm.getSourceValue());
+ applicationAlarmList.setAlarmType(applicationAlarm.getAlarmType());
+ applicationAlarmList.setTimeBucket(applicationAlarm.getLastTimeBucket());
+ applicationAlarmList.setAlarmContent(applicationAlarm.getAlarmContent());
+ next.execute(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/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
new file mode 100644
index 000000000..a68912e1f
--- /dev/null
+++ 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
@@ -0,0 +1,86 @@
+/*
+ * 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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorker;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorkerProvider;
+import org.apache.skywalking.apm.collector.configuration.ConfigurationModule;
+import org.apache.skywalking.apm.collector.configuration.service.IApplicationReferenceAlarmRuleConfig;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceMetricAlarmAssertWorker extends AlarmAssertWorker {
+
+ private final IApplicationReferenceAlarmRuleConfig applicationReferenceAlarmRuleConfig;
+
+ public ApplicationReferenceMetricAlarmAssertWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ this.applicationReferenceAlarmRuleConfig = moduleManager.find(ConfigurationModule.NAME).getService(IApplicationReferenceAlarmRuleConfig.class);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID;
+ }
+
+ @Override protected ApplicationReferenceAlarm newAlarmObject(String id, ApplicationReferenceMetric inputMetric) {
+ 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;
+ }
+
+ @Override protected Double calleeErrorRateThreshold() {
+ return applicationReferenceAlarmRuleConfig.calleeErrorRateThreshold();
+ }
+
+ @Override protected Double callerErrorRateThreshold() {
+ return applicationReferenceAlarmRuleConfig.callerErrorRateThreshold();
+ }
+
+ @Override protected Double calleeAverageResponseTimeThreshold() {
+ return applicationReferenceAlarmRuleConfig.calleeAverageResponseTimeThreshold();
+ }
+
+ @Override protected Double callerAverageResponseTimeThreshold() {
+ return applicationReferenceAlarmRuleConfig.callerAverageResponseTimeThreshold();
+ }
+
+ public static class Factory extends AlarmAssertWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationReferenceMetricAlarmAssertWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationReferenceMetricAlarmAssertWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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
new file mode 100644
index 000000000..121aed10a
--- /dev/null
+++ 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
@@ -0,0 +1,80 @@
+/*
+ * 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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
+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.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.alarm.ApplicationReferenceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceMetricAlarmGraph {
+
+ private final ModuleManager moduleManager;
+ private final WorkerCreateListener workerCreateListener;
+
+ public ApplicationReferenceMetricAlarmGraph(ModuleManager moduleManager,
+ WorkerCreateListener workerCreateListener) {
+ this.moduleManager = moduleManager;
+ this.workerCreateListener = workerCreateListener;
+ }
+
+ public void create() {
+ RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
+
+ Graph graph = GraphManager.INSTANCE.createIfAbsent(AlarmGraphIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_GRAPH_ID, ApplicationReferenceMetric.class);
+
+ graph.addNode(new ApplicationReferenceMetricAlarmAssertWorker.Factory(moduleManager).create(workerCreateListener))
+ .addNext(new ApplicationReferenceMetricAlarmRemoteWorker.Factory(moduleManager, remoteSenderService, AlarmGraphIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_GRAPH_ID).create(workerCreateListener))
+ .addNext(new ApplicationReferenceMetricAlarmPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ graph.toFinder().findNode(AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID, ApplicationReferenceAlarm.class)
+ .addNext(new ApplicationReferenceMetricAlarmToListNodeProcessor())
+ .addNext(new ApplicationReferenceMetricAlarmListPersistenceWorker.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_MINUTE_METRIC_PERSISTENCE_WORKER_ID, ApplicationReferenceMetric.class)
+ .addNext(new NodeProcessor() {
+ @Override public int id() {
+ return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
+ }
+
+ @Override public void process(ApplicationReferenceMetric applicationReferenceMetric,
+ Next next) {
+ graph.start(applicationReferenceMetric);
+ }
+ });
+ }
+}
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
new file mode 100644
index 000000000..fc7f38761
--- /dev/null
+++ 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
@@ -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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.alarm.IApplicationReferenceAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceMetricAlarmListPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationReferenceMetricAlarmListPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationReferenceAlarmList> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationReferenceAlarmListPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override
+ public ApplicationReferenceMetricAlarmListPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationReferenceMetricAlarmListPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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
new file mode 100644
index 000000000..c8f760111
--- /dev/null
+++ 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
@@ -0,0 +1,66 @@
+/*
+ * 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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.alarm.IApplicationReferenceAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceMetricAlarmPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationReferenceMetricAlarmPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationReferenceAlarm> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationReferenceAlarmPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationReferenceMetricAlarmPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationReferenceMetricAlarmPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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/ApplicationReferenceMetricAlarmRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmRemoteWorker.java
new file mode 100644
index 000000000..f52cfc74a
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/application/ApplicationReferenceMetricAlarmRemoteWorker.java
@@ -0,0 +1,61 @@
+/*
+ * 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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorkerProvider;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
+import org.apache.skywalking.apm.collector.remote.service.Selector;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceMetricAlarmRemoteWorker extends AbstractRemoteWorker {
+
+ public ApplicationReferenceMetricAlarmRemoteWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID;
+ }
+
+ @Override public Selector selector() {
+ return Selector.HashCode;
+ }
+
+ @Override protected void onWork(ApplicationReferenceAlarm message) throws WorkerException {
+ onNext(message);
+ }
+
+ public static class Factory extends AbstractRemoteWorkerProvider {
+
+ public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
+ super(moduleManager, remoteSenderService, graphId);
+ }
+
+ @Override public ApplicationReferenceMetricAlarmRemoteWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationReferenceMetricAlarmRemoteWorker(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/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
new file mode 100644
index 000000000..de4874adb
--- /dev/null
+++ 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
@@ -0,0 +1,54 @@
+/*
+ * 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.alarm.provider.worker.application;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.storage.table.alarm.ApplicationReferenceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationReferenceMetricAlarmToListNodeProcessor implements NodeProcessor {
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID;
+ }
+
+ @Override
+ public void process(ApplicationReferenceAlarm applicationReferenceAlarm, Next next) {
+ String id = applicationReferenceAlarm.getLastTimeBucket() + Const.ID_SPLIT + applicationReferenceAlarm.getSourceValue()
+ + Const.ID_SPLIT + applicationReferenceAlarm.getAlarmType()
+ + Const.ID_SPLIT + applicationReferenceAlarm.getFrontApplicationId()
+ + Const.ID_SPLIT + applicationReferenceAlarm.getBehindApplicationId();
+
+ ApplicationReferenceAlarmList applicationReferenceAlarmList = new ApplicationReferenceAlarmList();
+ applicationReferenceAlarmList.setId(id);
+ applicationReferenceAlarmList.setFrontApplicationId(applicationReferenceAlarm.getFrontApplicationId());
+ applicationReferenceAlarmList.setBehindApplicationId(applicationReferenceAlarm.getBehindApplicationId());
+ applicationReferenceAlarmList.setSourceValue(applicationReferenceAlarm.getSourceValue());
+ applicationReferenceAlarmList.setAlarmType(applicationReferenceAlarm.getAlarmType());
+ applicationReferenceAlarmList.setTimeBucket(applicationReferenceAlarm.getLastTimeBucket());
+ applicationReferenceAlarmList.setAlarmContent(applicationReferenceAlarm.getAlarmContent());
+ next.execute(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/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
new file mode 100644
index 000000000..2b02dd7df
--- /dev/null
+++ 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
@@ -0,0 +1,86 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorker;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorkerProvider;
+import org.apache.skywalking.apm.collector.configuration.ConfigurationModule;
+import org.apache.skywalking.apm.collector.configuration.service.IInstanceAlarmRuleConfig;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMetricAlarmAssertWorker extends AlarmAssertWorker {
+
+ private final IInstanceAlarmRuleConfig instanceAlarmRuleConfig;
+
+ public InstanceMetricAlarmAssertWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ this.instanceAlarmRuleConfig = moduleManager.find(ConfigurationModule.NAME).getService(IInstanceAlarmRuleConfig.class);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.INSTANCE_METRIC_ALARM_ASSERT_WORKER_ID;
+ }
+
+ @Override protected InstanceAlarm newAlarmObject(String id, InstanceMetric inputMetric) {
+ InstanceAlarm instanceAlarm = new InstanceAlarm();
+ instanceAlarm.setId(id + Const.ID_SPLIT + inputMetric.getInstanceId());
+ instanceAlarm.setApplicationId(inputMetric.getApplicationId());
+ instanceAlarm.setInstanceId(inputMetric.getInstanceId());
+ return instanceAlarm;
+ }
+
+ @Override protected Double calleeErrorRateThreshold() {
+ return instanceAlarmRuleConfig.calleeErrorRateThreshold();
+ }
+
+ @Override protected Double callerErrorRateThreshold() {
+ return instanceAlarmRuleConfig.callerErrorRateThreshold();
+ }
+
+ @Override protected Double calleeAverageResponseTimeThreshold() {
+ return instanceAlarmRuleConfig.calleeAverageResponseTimeThreshold();
+ }
+
+ @Override protected Double callerAverageResponseTimeThreshold() {
+ return instanceAlarmRuleConfig.callerAverageResponseTimeThreshold();
+ }
+
+ public static class Factory extends AlarmAssertWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public InstanceMetricAlarmAssertWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceMetricAlarmAssertWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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/InstanceMetricAlarmGraph.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmGraph.java
new file mode 100644
index 000000000..5954314bb
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmGraph.java
@@ -0,0 +1,79 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
+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.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.alarm.InstanceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMetricAlarmGraph {
+
+ private final ModuleManager moduleManager;
+ private final WorkerCreateListener workerCreateListener;
+
+ public InstanceMetricAlarmGraph(ModuleManager moduleManager, WorkerCreateListener workerCreateListener) {
+ this.moduleManager = moduleManager;
+ this.workerCreateListener = workerCreateListener;
+ }
+
+ public void create() {
+ RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
+
+ Graph graph = GraphManager.INSTANCE.createIfAbsent(AlarmGraphIdDefine.INSTANCE_METRIC_ALARM_GRAPH_ID, InstanceMetric.class);
+
+ graph.addNode(new InstanceMetricAlarmAssertWorker.Factory(moduleManager).create(workerCreateListener))
+ .addNext(new InstanceMetricAlarmRemoteWorker.Factory(moduleManager, remoteSenderService, AlarmGraphIdDefine.INSTANCE_METRIC_ALARM_GRAPH_ID).create(workerCreateListener))
+ .addNext(new InstanceMetricAlarmPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ graph.toFinder().findNode(AlarmWorkerIdDefine.INSTANCE_METRIC_ALARM_REMOTE_WORKER_ID, InstanceAlarm.class)
+ .addNext(new InstanceMetricAlarmToListNodeProcessor())
+ .addNext(new InstanceMetricAlarmListPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ link(graph);
+ }
+
+ private void link(Graph graph) {
+ GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.INSTANCE_METRIC_GRAPH_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;
+ }
+
+ @Override public void process(InstanceMetric instanceMetric,
+ Next next) {
+ graph.start(instanceMetric);
+ }
+ });
+ }
+}
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
new file mode 100644
index 000000000..120d943df
--- /dev/null
+++ 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
@@ -0,0 +1,66 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.alarm.IInstanceAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMetricAlarmListPersistenceWorker extends PersistenceWorker {
+
+ public InstanceMetricAlarmListPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.INSTANCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, InstanceAlarmList> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IInstanceAlarmListPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public InstanceMetricAlarmListPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceMetricAlarmListPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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
new file mode 100644
index 000000000..6fce174ae
--- /dev/null
+++ 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
@@ -0,0 +1,66 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.alarm.IInstanceAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMetricAlarmPersistenceWorker extends PersistenceWorker {
+
+ public InstanceMetricAlarmPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.INSTANCE_METRIC_ALARM_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, InstanceAlarm> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IInstanceAlarmPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public InstanceMetricAlarmPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceMetricAlarmPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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/InstanceMetricAlarmRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmRemoteWorker.java
new file mode 100644
index 000000000..0edad65d6
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceMetricAlarmRemoteWorker.java
@@ -0,0 +1,61 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorkerProvider;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
+import org.apache.skywalking.apm.collector.remote.service.Selector;
+import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMetricAlarmRemoteWorker extends AbstractRemoteWorker {
+
+ public InstanceMetricAlarmRemoteWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.INSTANCE_METRIC_ALARM_REMOTE_WORKER_ID;
+ }
+
+ @Override public Selector selector() {
+ return Selector.HashCode;
+ }
+
+ @Override protected void onWork(InstanceAlarm message) throws WorkerException {
+ onNext(message);
+ }
+
+ public static class Factory extends AbstractRemoteWorkerProvider {
+
+ public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
+ super(moduleManager, remoteSenderService, graphId);
+ }
+
+ @Override public InstanceMetricAlarmRemoteWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceMetricAlarmRemoteWorker(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/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
new file mode 100644
index 000000000..463a64e7d
--- /dev/null
+++ 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
@@ -0,0 +1,52 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.storage.table.alarm.InstanceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceMetricAlarmToListNodeProcessor implements NodeProcessor {
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.INSTANCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID;
+ }
+
+ @Override public void process(InstanceAlarm instanceAlarm, Next next) {
+ String id = instanceAlarm.getLastTimeBucket() + Const.ID_SPLIT + instanceAlarm.getSourceValue()
+ + Const.ID_SPLIT + instanceAlarm.getAlarmType()
+ + Const.ID_SPLIT + instanceAlarm.getInstanceId();
+
+ InstanceAlarmList instanceAlarmList = new InstanceAlarmList();
+ instanceAlarmList.setId(id);
+ instanceAlarmList.setApplicationId(instanceAlarm.getApplicationId());
+ instanceAlarmList.setInstanceId(instanceAlarm.getInstanceId());
+ instanceAlarmList.setSourceValue(instanceAlarm.getSourceValue());
+ instanceAlarmList.setAlarmType(instanceAlarm.getAlarmType());
+ instanceAlarmList.setTimeBucket(instanceAlarm.getLastTimeBucket());
+ instanceAlarmList.setAlarmContent(instanceAlarm.getAlarmContent());
+ next.execute(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/InstanceReferenceMetricAlarmAssertWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmAssertWorker.java
new file mode 100644
index 000000000..f8e2bf5af
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmAssertWorker.java
@@ -0,0 +1,88 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorker;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorkerProvider;
+import org.apache.skywalking.apm.collector.configuration.ConfigurationModule;
+import org.apache.skywalking.apm.collector.configuration.service.IInstanceReferenceAlarmRuleConfig;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceReferenceMetricAlarmAssertWorker extends AlarmAssertWorker {
+
+ private final IInstanceReferenceAlarmRuleConfig instanceReferenceAlarmRuleConfig;
+
+ public InstanceReferenceMetricAlarmAssertWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ this.instanceReferenceAlarmRuleConfig = moduleManager.find(ConfigurationModule.NAME).getService(IInstanceReferenceAlarmRuleConfig.class);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID;
+ }
+
+ @Override protected InstanceReferenceAlarm newAlarmObject(String id, InstanceReferenceMetric inputMetric) {
+ InstanceReferenceAlarm instanceReferenceAlarm = new InstanceReferenceAlarm();
+ instanceReferenceAlarm.setId(id + Const.ID_SPLIT + inputMetric.getFrontInstanceId() + Const.ID_SPLIT + inputMetric.getBehindInstanceId());
+ instanceReferenceAlarm.setFrontApplicationId(inputMetric.getFrontApplicationId());
+ instanceReferenceAlarm.setBehindApplicationId(inputMetric.getBehindApplicationId());
+ instanceReferenceAlarm.setFrontInstanceId(inputMetric.getFrontInstanceId());
+ instanceReferenceAlarm.setBehindInstanceId(inputMetric.getBehindInstanceId());
+ return instanceReferenceAlarm;
+ }
+
+ @Override protected Double calleeErrorRateThreshold() {
+ return instanceReferenceAlarmRuleConfig.calleeErrorRateThreshold();
+ }
+
+ @Override protected Double callerErrorRateThreshold() {
+ return instanceReferenceAlarmRuleConfig.callerErrorRateThreshold();
+ }
+
+ @Override protected Double calleeAverageResponseTimeThreshold() {
+ return instanceReferenceAlarmRuleConfig.calleeAverageResponseTimeThreshold();
+ }
+
+ @Override protected Double callerAverageResponseTimeThreshold() {
+ return instanceReferenceAlarmRuleConfig.callerAverageResponseTimeThreshold();
+ }
+
+ public static class Factory extends AlarmAssertWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public InstanceReferenceMetricAlarmAssertWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceReferenceMetricAlarmAssertWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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/InstanceReferenceMetricAlarmGraph.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmGraph.java
new file mode 100644
index 000000000..7ef12e1a6
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmGraph.java
@@ -0,0 +1,79 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
+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.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.alarm.InstanceReferenceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.instance.InstanceReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceReferenceMetricAlarmGraph {
+
+ private final ModuleManager moduleManager;
+ private final WorkerCreateListener workerCreateListener;
+
+ public InstanceReferenceMetricAlarmGraph(ModuleManager moduleManager, WorkerCreateListener workerCreateListener) {
+ this.moduleManager = moduleManager;
+ this.workerCreateListener = workerCreateListener;
+ }
+
+ public void create() {
+ RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
+
+ Graph graph = GraphManager.INSTANCE.createIfAbsent(AlarmGraphIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_GRAPH_ID, InstanceReferenceMetric.class);
+
+ graph.addNode(new InstanceReferenceMetricAlarmAssertWorker.Factory(moduleManager).create(workerCreateListener))
+ .addNext(new InstanceReferenceMetricAlarmRemoteWorker.Factory(moduleManager, remoteSenderService, AlarmGraphIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_GRAPH_ID).create(workerCreateListener))
+ .addNext(new InstanceReferenceMetricAlarmPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ graph.toFinder().findNode(AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID, InstanceReferenceAlarm.class)
+ .addNext(new InstanceReferenceMetricAlarmToListNodeProcessor())
+ .addNext(new InstanceReferenceMetricAlarmListPersistenceWorker.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_MINUTE_METRIC_PERSISTENCE_WORKER_ID, InstanceReferenceMetric.class)
+ .addNext(new NodeProcessor() {
+ @Override public int id() {
+ return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
+ }
+
+ @Override public void process(InstanceReferenceMetric instanceReferenceMetric,
+ Next next) {
+ graph.start(instanceReferenceMetric);
+ }
+ });
+ }
+}
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
new file mode 100644
index 000000000..d0d9ffd45
--- /dev/null
+++ 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
@@ -0,0 +1,66 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.alarm.IInstanceReferenceAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceReferenceMetricAlarmListPersistenceWorker extends PersistenceWorker {
+
+ public InstanceReferenceMetricAlarmListPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, InstanceReferenceAlarmList> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IInstanceReferenceAlarmListPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public InstanceReferenceMetricAlarmListPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceReferenceMetricAlarmListPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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
new file mode 100644
index 000000000..97f271d2b
--- /dev/null
+++ 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
@@ -0,0 +1,66 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.alarm.IInstanceReferenceAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceReferenceMetricAlarmPersistenceWorker extends PersistenceWorker {
+
+ public InstanceReferenceMetricAlarmPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, InstanceReferenceAlarm> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IInstanceReferenceAlarmPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public InstanceReferenceMetricAlarmPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceReferenceMetricAlarmPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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/InstanceReferenceMetricAlarmRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmRemoteWorker.java
new file mode 100644
index 000000000..24840ec79
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/instance/InstanceReferenceMetricAlarmRemoteWorker.java
@@ -0,0 +1,61 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorkerProvider;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
+import org.apache.skywalking.apm.collector.remote.service.Selector;
+import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceReferenceMetricAlarmRemoteWorker extends AbstractRemoteWorker {
+
+ public InstanceReferenceMetricAlarmRemoteWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID;
+ }
+
+ @Override public Selector selector() {
+ return Selector.HashCode;
+ }
+
+ @Override protected void onWork(InstanceReferenceAlarm message) throws WorkerException {
+ onNext(message);
+ }
+
+ public static class Factory extends AbstractRemoteWorkerProvider {
+
+ public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
+ super(moduleManager, remoteSenderService, graphId);
+ }
+
+ @Override public InstanceReferenceMetricAlarmRemoteWorker workerInstance(ModuleManager moduleManager) {
+ return new InstanceReferenceMetricAlarmRemoteWorker(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/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
new file mode 100644
index 000000000..553ddebe2
--- /dev/null
+++ 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
@@ -0,0 +1,56 @@
+/*
+ * 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.alarm.provider.worker.instance;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.storage.table.alarm.InstanceReferenceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceReferenceMetricAlarmToListNodeProcessor implements NodeProcessor {
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID;
+ }
+
+ @Override
+ public void process(InstanceReferenceAlarm instanceReferenceAlarm, Next next) {
+ String id = instanceReferenceAlarm.getLastTimeBucket() + Const.ID_SPLIT + instanceReferenceAlarm.getSourceValue()
+ + Const.ID_SPLIT + instanceReferenceAlarm.getAlarmType()
+ + Const.ID_SPLIT + instanceReferenceAlarm.getFrontInstanceId()
+ + Const.ID_SPLIT + instanceReferenceAlarm.getBehindInstanceId();
+
+ InstanceReferenceAlarmList instanceReferenceAlarmList = new InstanceReferenceAlarmList();
+ instanceReferenceAlarmList.setId(id);
+ instanceReferenceAlarmList.setFrontApplicationId(instanceReferenceAlarm.getFrontApplicationId());
+ instanceReferenceAlarmList.setBehindApplicationId(instanceReferenceAlarm.getBehindApplicationId());
+ instanceReferenceAlarmList.setFrontInstanceId(instanceReferenceAlarm.getFrontInstanceId());
+ instanceReferenceAlarmList.setBehindInstanceId(instanceReferenceAlarm.getBehindInstanceId());
+ instanceReferenceAlarmList.setSourceValue(instanceReferenceAlarm.getSourceValue());
+ instanceReferenceAlarmList.setAlarmType(instanceReferenceAlarm.getAlarmType());
+ instanceReferenceAlarmList.setTimeBucket(instanceReferenceAlarm.getLastTimeBucket());
+ instanceReferenceAlarmList.setAlarmContent(instanceReferenceAlarm.getAlarmContent());
+ next.execute(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/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
new file mode 100644
index 000000000..e7a8242cc
--- /dev/null
+++ 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
@@ -0,0 +1,87 @@
+/*
+ * 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.alarm.provider.worker.service;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorker;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorkerProvider;
+import org.apache.skywalking.apm.collector.configuration.ConfigurationModule;
+import org.apache.skywalking.apm.collector.configuration.service.IServiceAlarmRuleConfig;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceMetricAlarmAssertWorker extends AlarmAssertWorker {
+
+ private final IServiceAlarmRuleConfig serviceAlarmRuleConfig;
+
+ public ServiceMetricAlarmAssertWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ this.serviceAlarmRuleConfig = moduleManager.find(ConfigurationModule.NAME).getService(IServiceAlarmRuleConfig.class);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_ASSERT_WORKER_ID;
+ }
+
+ @Override protected ServiceAlarm newAlarmObject(String id, ServiceMetric inputMetric) {
+ ServiceAlarm serviceAlarm = new ServiceAlarm();
+ serviceAlarm.setId(id + Const.ID_SPLIT + inputMetric.getServiceId());
+ serviceAlarm.setApplicationId(inputMetric.getApplicationId());
+ serviceAlarm.setInstanceId(inputMetric.getInstanceId());
+ serviceAlarm.setServiceId(inputMetric.getServiceId());
+ return serviceAlarm;
+ }
+
+ @Override protected Double calleeErrorRateThreshold() {
+ return serviceAlarmRuleConfig.calleeErrorRateThreshold();
+ }
+
+ @Override protected Double callerErrorRateThreshold() {
+ return serviceAlarmRuleConfig.callerErrorRateThreshold();
+ }
+
+ @Override protected Double calleeAverageResponseTimeThreshold() {
+ return serviceAlarmRuleConfig.calleeAverageResponseTimeThreshold();
+ }
+
+ @Override protected Double callerAverageResponseTimeThreshold() {
+ return serviceAlarmRuleConfig.callerAverageResponseTimeThreshold();
+ }
+
+ public static class Factory extends AlarmAssertWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ServiceMetricAlarmAssertWorker workerInstance(ModuleManager moduleManager) {
+ return new ServiceMetricAlarmAssertWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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/ServiceMetricAlarmGraph.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmGraph.java
new file mode 100644
index 000000000..18d87ad6d
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmGraph.java
@@ -0,0 +1,79 @@
+/*
+ * 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.alarm.provider.worker.service;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
+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.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.alarm.ServiceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceMetricAlarmGraph {
+
+ private final ModuleManager moduleManager;
+ private final WorkerCreateListener workerCreateListener;
+
+ public ServiceMetricAlarmGraph(ModuleManager moduleManager, WorkerCreateListener workerCreateListener) {
+ this.moduleManager = moduleManager;
+ this.workerCreateListener = workerCreateListener;
+ }
+
+ public void create() {
+ RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
+
+ Graph graph = GraphManager.INSTANCE.createIfAbsent(AlarmGraphIdDefine.SERVICE_METRIC_ALARM_GRAPH_ID, ServiceMetric.class);
+
+ graph.addNode(new ServiceMetricAlarmAssertWorker.Factory(moduleManager).create(workerCreateListener))
+ .addNext(new ServiceMetricAlarmRemoteWorker.Factory(moduleManager, remoteSenderService, AlarmGraphIdDefine.SERVICE_METRIC_ALARM_GRAPH_ID).create(workerCreateListener))
+ .addNext(new ServiceMetricAlarmPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ graph.toFinder().findNode(AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_REMOTE_WORKER_ID, ServiceAlarm.class)
+ .addNext(new ServiceMetricAlarmToListNodeProcessor())
+ .addNext(new ServiceMetricAlarmListPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ link(graph);
+ }
+
+ private void link(Graph graph) {
+ GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_METRIC_GRAPH_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;
+ }
+
+ @Override public void process(ServiceMetric serviceMetric,
+ Next next) {
+ graph.start(serviceMetric);
+ }
+ });
+ }
+}
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
new file mode 100644
index 000000000..e72568e6d
--- /dev/null
+++ 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
@@ -0,0 +1,66 @@
+/*
+ * 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.alarm.provider.worker.service;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.alarm.IServiceAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceMetricAlarmListPersistenceWorker extends PersistenceWorker {
+
+ public ServiceMetricAlarmListPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ServiceAlarmList> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IServiceAlarmListPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ServiceMetricAlarmListPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ServiceMetricAlarmListPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlertingListPersistenceWorker.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
similarity index 62%
rename from apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlertingListPersistenceWorker.java
rename to 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 0546a497d..50c75841a 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/AlertingListPersistenceWorker.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
@@ -16,45 +16,46 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.service;
-import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
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.IAlertingListPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.table.alerting.AlertingList;
+import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarm;
/**
* @author peng-yongsheng
*/
-public class AlertingListPersistenceWorker extends PersistenceWorker {
+public class ServiceMetricAlarmPersistenceWorker extends PersistenceWorker {
- public AlertingListPersistenceWorker(ModuleManager moduleManager) {
+ public ServiceMetricAlarmPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return 114;
+ return AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
- @Override protected IPersistenceDAO persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IAlertingListPersistenceDAO.class);
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ServiceAlarm> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IServiceAlarmPersistenceDAO.class);
}
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
-
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public AlertingListPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new AlertingListPersistenceWorker(moduleManager);
+ @Override public ServiceMetricAlarmPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ServiceMetricAlarmPersistenceWorker(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/service/ServiceEntryRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmRemoteWorker.java
similarity index 67%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/service/ServiceEntryRemoteWorker.java
rename to apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmRemoteWorker.java
index e16f4a7bd..538dd7553 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/service/ServiceEntryRemoteWorker.java
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceMetricAlarmRemoteWorker.java
@@ -16,46 +16,46 @@
*
*/
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service;
+package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.service;
-import org.apache.skywalking.apm.collector.analysis.metric.define.graph.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
import org.apache.skywalking.apm.collector.remote.service.Selector;
-import org.apache.skywalking.apm.collector.storage.table.service.ServiceEntry;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarm;
/**
* @author peng-yongsheng
*/
-public class ServiceEntryRemoteWorker extends AbstractRemoteWorker {
+public class ServiceMetricAlarmRemoteWorker extends AbstractRemoteWorker {
- public ServiceEntryRemoteWorker(ModuleManager moduleManager) {
+ public ServiceMetricAlarmRemoteWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return WorkerIdDefine.SERVICE_ENTRY_REMOTE_WORKER_ID;
- }
-
- @Override protected void onWork(ServiceEntry serviceEntry) throws WorkerException {
- onNext(serviceEntry);
+ return AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_REMOTE_WORKER_ID;
}
@Override public Selector selector() {
return Selector.HashCode;
}
- public static class Factory extends AbstractRemoteWorkerProvider {
+ @Override protected void onWork(ServiceAlarm message) throws WorkerException {
+ onNext(message);
+ }
+
+ public static class Factory extends AbstractRemoteWorkerProvider {
public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
super(moduleManager, remoteSenderService, graphId);
}
- @Override public ServiceEntryRemoteWorker workerInstance(ModuleManager moduleManager) {
- return new ServiceEntryRemoteWorker(moduleManager);
+ @Override public ServiceMetricAlarmRemoteWorker workerInstance(ModuleManager moduleManager) {
+ return new ServiceMetricAlarmRemoteWorker(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/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
new file mode 100644
index 000000000..ab0d6a802
--- /dev/null
+++ 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
@@ -0,0 +1,53 @@
+/*
+ * 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.alarm.provider.worker.service;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.storage.table.alarm.ServiceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceMetricAlarmToListNodeProcessor implements NodeProcessor {
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID;
+ }
+
+ @Override public void process(ServiceAlarm serviceAlarm, Next next) {
+ String id = serviceAlarm.getLastTimeBucket() + Const.ID_SPLIT + serviceAlarm.getSourceValue()
+ + Const.ID_SPLIT + serviceAlarm.getAlarmType()
+ + Const.ID_SPLIT + serviceAlarm.getServiceId();
+
+ ServiceAlarmList serviceAlarmList = new ServiceAlarmList();
+ serviceAlarmList.setId(id);
+ serviceAlarmList.setApplicationId(serviceAlarm.getApplicationId());
+ serviceAlarmList.setInstanceId(serviceAlarm.getInstanceId());
+ serviceAlarmList.setServiceId(serviceAlarm.getServiceId());
+ serviceAlarmList.setSourceValue(serviceAlarm.getSourceValue());
+ serviceAlarmList.setAlarmType(serviceAlarm.getAlarmType());
+ serviceAlarmList.setTimeBucket(serviceAlarm.getLastTimeBucket());
+ serviceAlarmList.setAlarmContent(serviceAlarm.getAlarmContent());
+ next.execute(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/ServiceReferenceMetricAlarmAssertWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmAssertWorker.java
new file mode 100644
index 000000000..a644c01a3
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmAssertWorker.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.analysis.alarm.provider.worker.service;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorker;
+import org.apache.skywalking.apm.collector.analysis.alarm.provider.worker.AlarmAssertWorkerProvider;
+import org.apache.skywalking.apm.collector.configuration.ConfigurationModule;
+import org.apache.skywalking.apm.collector.configuration.service.IServiceReferenceAlarmRuleConfig;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.core.util.Const;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetric;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceReferenceMetricAlarmAssertWorker extends AlarmAssertWorker {
+
+ private final Logger logger = LoggerFactory.getLogger(ServiceReferenceMetricAlarmAssertWorker.class);
+
+ private final IServiceReferenceAlarmRuleConfig serviceReferenceAlarmRuleConfig;
+
+ public ServiceReferenceMetricAlarmAssertWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ this.serviceReferenceAlarmRuleConfig = moduleManager.find(ConfigurationModule.NAME).getService(IServiceReferenceAlarmRuleConfig.class);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_ASSERT_WORKER_ID;
+ }
+
+ @Override protected ServiceReferenceAlarm newAlarmObject(String id, ServiceReferenceMetric inputMetric) {
+ ServiceReferenceAlarm serviceReferenceAlarm = new ServiceReferenceAlarm();
+ serviceReferenceAlarm.setId(id + Const.ID_SPLIT + inputMetric.getFrontServiceId() + Const.ID_SPLIT + inputMetric.getBehindServiceId());
+ serviceReferenceAlarm.setFrontApplicationId(inputMetric.getFrontApplicationId());
+ serviceReferenceAlarm.setBehindApplicationId(inputMetric.getBehindApplicationId());
+ serviceReferenceAlarm.setFrontInstanceId(inputMetric.getFrontInstanceId());
+ serviceReferenceAlarm.setBehindInstanceId(inputMetric.getBehindInstanceId());
+ serviceReferenceAlarm.setFrontServiceId(inputMetric.getFrontServiceId());
+ serviceReferenceAlarm.setBehindServiceId(inputMetric.getBehindServiceId());
+ return serviceReferenceAlarm;
+ }
+
+ @Override protected Double calleeErrorRateThreshold() {
+ return serviceReferenceAlarmRuleConfig.calleeErrorRateThreshold();
+ }
+
+ @Override protected Double callerErrorRateThreshold() {
+ return serviceReferenceAlarmRuleConfig.callerErrorRateThreshold();
+ }
+
+ @Override protected Double calleeAverageResponseTimeThreshold() {
+ return serviceReferenceAlarmRuleConfig.calleeAverageResponseTimeThreshold();
+ }
+
+ @Override protected Double callerAverageResponseTimeThreshold() {
+ return serviceReferenceAlarmRuleConfig.callerAverageResponseTimeThreshold();
+ }
+
+ public static class Factory extends AlarmAssertWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ServiceReferenceMetricAlarmAssertWorker workerInstance(ModuleManager moduleManager) {
+ return new ServiceReferenceMetricAlarmAssertWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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/ServiceReferenceMetricAlarmGraph.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmGraph.java
new file mode 100644
index 000000000..eda88d430
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmGraph.java
@@ -0,0 +1,79 @@
+/*
+ * 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.alarm.provider.worker.service;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
+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.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.alarm.ServiceReferenceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceReferenceMetricAlarmGraph {
+
+ private final ModuleManager moduleManager;
+ private final WorkerCreateListener workerCreateListener;
+
+ public ServiceReferenceMetricAlarmGraph(ModuleManager moduleManager, WorkerCreateListener workerCreateListener) {
+ this.moduleManager = moduleManager;
+ this.workerCreateListener = workerCreateListener;
+ }
+
+ public void create() {
+ RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
+
+ Graph graph = GraphManager.INSTANCE.createIfAbsent(AlarmGraphIdDefine.SERVICE_REFERENCE_METRIC_ALARM_GRAPH_ID, ServiceReferenceMetric.class);
+
+ graph.addNode(new ServiceReferenceMetricAlarmAssertWorker.Factory(moduleManager).create(workerCreateListener))
+ .addNext(new ServiceReferenceMetricAlarmRemoteWorker.Factory(moduleManager, remoteSenderService, AlarmGraphIdDefine.SERVICE_REFERENCE_METRIC_ALARM_GRAPH_ID).create(workerCreateListener))
+ .addNext(new ServiceReferenceMetricAlarmPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ graph.toFinder().findNode(AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID, ServiceReferenceAlarm.class)
+ .addNext(new ServiceReferenceMetricAlarmToListNodeProcessor())
+ .addNext(new ServiceReferenceMetricAlarmListPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
+
+ link(graph);
+ }
+
+ private void link(Graph graph) {
+ GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_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;
+ }
+
+ @Override public void process(ServiceReferenceMetric serviceReferenceMetric,
+ Next next) {
+ graph.start(serviceReferenceMetric);
+ }
+ });
+ }
+}
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
new file mode 100644
index 000000000..968231321
--- /dev/null
+++ 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
@@ -0,0 +1,66 @@
+/*
+ * 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.alarm.provider.worker.service;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.alarm.IServiceReferenceAlarmListPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceReferenceMetricAlarmListPersistenceWorker extends PersistenceWorker {
+
+ public ServiceReferenceMetricAlarmListPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_LIST_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ServiceReferenceAlarmList> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IServiceReferenceAlarmListPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ServiceReferenceMetricAlarmListPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ServiceReferenceMetricAlarmListPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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
new file mode 100644
index 000000000..ddfdaaa56
--- /dev/null
+++ 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
@@ -0,0 +1,66 @@
+/*
+ * 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.alarm.provider.worker.service;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.alarm.IServiceReferenceAlarmPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceReferenceMetricAlarmPersistenceWorker extends PersistenceWorker {
+
+ public ServiceReferenceMetricAlarmPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ServiceReferenceAlarm> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IServiceReferenceAlarmPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ServiceReferenceMetricAlarmPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ServiceReferenceMetricAlarmPersistenceWorker(moduleManager);
+ }
+
+ @Override
+ public int queueSize() {
+ return 1024;
+ }
+ }
+}
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/ServiceReferenceMetricAlarmRemoteWorker.java b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmRemoteWorker.java
new file mode 100644
index 000000000..7914d8b12
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/alarm/provider/worker/service/ServiceReferenceMetricAlarmRemoteWorker.java
@@ -0,0 +1,61 @@
+/*
+ * 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.alarm.provider.worker.service;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorkerProvider;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
+import org.apache.skywalking.apm.collector.remote.service.Selector;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceReferenceMetricAlarmRemoteWorker extends AbstractRemoteWorker {
+
+ public ServiceReferenceMetricAlarmRemoteWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_REMOTE_WORKER_ID;
+ }
+
+ @Override public Selector selector() {
+ return Selector.HashCode;
+ }
+
+ @Override protected void onWork(ServiceReferenceAlarm message) throws WorkerException {
+ onNext(message);
+ }
+
+ public static class Factory extends AbstractRemoteWorkerProvider {
+
+ public Factory(ModuleManager moduleManager, RemoteSenderService remoteSenderService, int graphId) {
+ super(moduleManager, remoteSenderService, graphId);
+ }
+
+ @Override public ServiceReferenceMetricAlarmRemoteWorker workerInstance(ModuleManager moduleManager) {
+ return new ServiceReferenceMetricAlarmRemoteWorker(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/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
new file mode 100644
index 000000000..2d1fb048a
--- /dev/null
+++ 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
@@ -0,0 +1,57 @@
+/*
+ * 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.alarm.provider.worker.service;
+
+import org.apache.skywalking.apm.collector.analysis.alarm.define.graph.AlarmWorkerIdDefine;
+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.storage.table.alarm.ServiceReferenceAlarm;
+import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarmList;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceReferenceMetricAlarmToListNodeProcessor implements NodeProcessor {
+
+ @Override public int id() {
+ return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_TO_LIST_NODE_PROCESSOR_ID;
+ }
+
+ @Override public void process(ServiceReferenceAlarm serviceReferenceAlarm, Next next) {
+ String id = serviceReferenceAlarm.getLastTimeBucket() + Const.ID_SPLIT + serviceReferenceAlarm.getSourceValue()
+ + Const.ID_SPLIT + serviceReferenceAlarm.getAlarmType()
+ + Const.ID_SPLIT + serviceReferenceAlarm.getFrontServiceId()
+ + Const.ID_SPLIT + serviceReferenceAlarm.getBehindServiceId();
+
+ ServiceReferenceAlarmList serviceReferenceAlarmList = new ServiceReferenceAlarmList();
+ serviceReferenceAlarmList.setId(id);
+ serviceReferenceAlarmList.setFrontApplicationId(serviceReferenceAlarm.getFrontApplicationId());
+ serviceReferenceAlarmList.setBehindApplicationId(serviceReferenceAlarm.getBehindApplicationId());
+ serviceReferenceAlarmList.setFrontInstanceId(serviceReferenceAlarm.getFrontInstanceId());
+ serviceReferenceAlarmList.setBehindInstanceId(serviceReferenceAlarm.getBehindInstanceId());
+ serviceReferenceAlarmList.setFrontServiceId(serviceReferenceAlarm.getFrontServiceId());
+ serviceReferenceAlarmList.setBehindServiceId(serviceReferenceAlarm.getBehindServiceId());
+ serviceReferenceAlarmList.setSourceValue(serviceReferenceAlarm.getSourceValue());
+ serviceReferenceAlarmList.setAlarmType(serviceReferenceAlarm.getAlarmType());
+ serviceReferenceAlarmList.setTimeBucket(serviceReferenceAlarm.getLastTimeBucket());
+ serviceReferenceAlarmList.setAlarmContent(serviceReferenceAlarm.getAlarmContent());
+ next.execute(serviceReferenceAlarmList);
+ }
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/resources/META-INF/services/org.apache.skywalking.apm.collector.core.module.ModuleProvider b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/resources/META-INF/services/org.apache.skywalking.apm.collector.core.module.ModuleProvider
index 2adafe72c..ec63fccad 100644
--- a/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/resources/META-INF/services/org.apache.skywalking.apm.collector.core.module.ModuleProvider
+++ b/apm-collector/apm-collector-analysis/analysis-alarm/alarm-provider/src/main/resources/META-INF/services/org.apache.skywalking.apm.collector.core.module.ModuleProvider
@@ -16,23 +16,4 @@
#
#
-#
-# 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.
-#
-#
-
-
-org.apache.skywalking.apm.collector.analysis.alarm.provider.AlertingModuleProvider
+org.apache.skywalking.apm.collector.analysis.alarm.provider.AnalysisAlarmModuleProvider
\ No newline at end of file
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 69%
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 1ec5ae9f8..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,46 +16,47 @@
*
*/
-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.base.AbstractLocalAsyncWorkerProvider;
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.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() {
return false;
}
- @Override protected IPersistenceDAO persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(ICpuMetricPersistenceDAO.class);
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, CpuMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(ICpuSecondMetricPersistenceDAO.class);
}
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
+ 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/MemoryMetricPersistenceWorker.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
similarity index 68%
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/gc/GCHourMetricPersistenceWorker.java
index 3f2cac647..08b9addcb 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/gc/GCHourMetricPersistenceWorker.java
@@ -16,46 +16,47 @@
*
*/
-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.base.AbstractLocalAsyncWorkerProvider;
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.IMemoryMetricPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
+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 MemoryMetricPersistenceWorker extends PersistenceWorker {
+public class GCHourMetricPersistenceWorker extends PersistenceWorker {
- public MemoryMetricPersistenceWorker(ModuleManager moduleManager) {
+ public GCHourMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return WorkerIdDefine.MEMORY_METRIC_PERSISTENCE_WORKER_ID;
+ return WorkerIdDefine.GC_HOUR_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
- return false;
+ return true;
}
- @Override protected IPersistenceDAO persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IMemoryMetricPersistenceDAO.class);
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, GCMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IGCHourMetricPersistenceDAO.class);
}
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public MemoryMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new MemoryMetricPersistenceWorker(moduleManager);
+ @Override public GCHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new GCHourMetricPersistenceWorker(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/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 69%
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 2e08e6677..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,46 +16,47 @@
*
*/
-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.base.AbstractLocalAsyncWorkerProvider;
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.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() {
return false;
}
- @Override protected IPersistenceDAO persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IGCMetricPersistenceDAO.class);
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, GCMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IGCSecondMetricPersistenceDAO.class);
}
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
+ 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 70%
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 83e5766c5..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,46 +16,47 @@
*
*/
-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.base.AbstractLocalAsyncWorkerProvider;
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.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;
}
- @Override protected IPersistenceDAO persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IMemoryPoolMetricPersistenceDAO.class);
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, MemoryMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IMemoryHourMetricPersistenceDAO.class);
}
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
+ 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/memory/MemorySecondMetricPersistenceWorker.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
new file mode 100644
index 000000000..d1105e5b3
--- /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/MemorySecondMetricPersistenceWorker.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.IMemorySecondMetricPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MemorySecondMetricPersistenceWorker extends PersistenceWorker {
+
+ public MemorySecondMetricPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return WorkerIdDefine.MEMORY_SECOND_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, MemoryMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IMemorySecondMetricPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public MemorySecondMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new MemorySecondMetricPersistenceWorker(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/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-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/MetricSource.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/MetricSource.java
similarity index 77%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/MetricSource.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/MetricSource.java
index f65969627..7757e13ec 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/MetricSource.java
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/MetricSource.java
@@ -16,12 +16,21 @@
*
*/
-
-package org.apache.skywalking.apm.collector.analysis.metric.provider.worker;
+package org.apache.skywalking.apm.collector.analysis.metric.define;
/**
* @author peng-yongsheng
*/
public enum MetricSource {
- Exit, Entry
+ Caller(0), Callee(1);
+
+ private final int value;
+
+ private MetricSource(int value) {
+ this.value = value;
+ }
+
+ public int getValue() {
+ return value;
+ }
}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/GraphIdDefine.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
similarity index 90%
rename from apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/GraphIdDefine.java
rename to apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricGraphIdDefine.java
index 356742db4..d4b69bed7 100644
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/GraphIdDefine.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
@@ -21,7 +21,7 @@ package org.apache.skywalking.apm.collector.analysis.metric.define.graph;
/**
* @author peng-yongsheng
*/
-public class GraphIdDefine {
+public class MetricGraphIdDefine {
public static final int SERVICE_REFERENCE_METRIC_GRAPH_ID = 400;
public static final int INSTANCE_REFERENCE_METRIC_GRAPH_ID = 401;
public static final int APPLICATION_REFERENCE_METRIC_GRAPH_ID = 402;
@@ -32,7 +32,9 @@ public class GraphIdDefine {
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
new file mode 100644
index 000000000..a275a4417
--- /dev/null
+++ b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/MetricWorkerIdDefine.java
@@ -0,0 +1,125 @@
+/*
+ * 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.define.graph;
+
+/**
+ * @author peng-yongsheng
+ */
+public class MetricWorkerIdDefine {
+ 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_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_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_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_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_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 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_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 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;
+
+ public static final int INSTANCE_REFERENCE_GRAPH_BRIDGE_WORKER_ID = 429;
+ public static final int APPLICATION_REFERENCE_GRAPH_BRIDGE_WORKER_ID = 430;
+ public static final int SERVICE_METRIC_GRAPH_BRIDGE_WORKER_ID = 431;
+ 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 INST_HEART_BEAT_PERSISTENCE_WORKER_ID = 400;
+}
diff --git a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/WorkerIdDefine.java b/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/WorkerIdDefine.java
deleted file mode 100644
index e2877d83a..000000000
--- a/apm-collector/apm-collector-analysis/analysis-metric/metric-define/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/define/graph/WorkerIdDefine.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.define.graph;
-
-/**
- * @author peng-yongsheng
- */
-public class WorkerIdDefine {
- 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 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 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 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 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 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_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 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 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 GLOBAL_TRACE_PERSISTENCE_WORKER_ID = 427;
- public static final int SEGMENT_COST_PERSISTENCE_WORKER_ID = 428;
-
- public static final int INSTANCE_REFERENCE_GRAPH_BRIDGE_WORKER_ID = 429;
- public static final int APPLICATION_REFERENCE_GRAPH_BRIDGE_WORKER_ID = 430;
- public static final int SERVICE_METRIC_GRAPH_BRIDGE_WORKER_ID = 431;
- public static final int INSTANCE_METRIC_GRAPH_BRIDGE_WORKER_ID = 432;
-}
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 2ef9ace1a..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,23 +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.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;
@@ -61,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 {
@@ -87,7 +91,7 @@ public class AnalysisMetricModuleProvider extends ModuleProvider {
segmentParserListenerRegister.register(new ServiceReferenceMetricSpanListener.Factory());
segmentParserListenerRegister.register(new ApplicationComponentSpanListener.Factory());
segmentParserListenerRegister.register(new ApplicationMappingSpanListener.Factory());
- segmentParserListenerRegister.register(new ServiceEntrySpanListener.Factory());
+ segmentParserListenerRegister.register(new InstanceMappingSpanListener.Factory());
segmentParserListenerRegister.register(new GlobalTraceSpanListener.Factory());
segmentParserListenerRegister.register(new SegmentCostSpanListener.Factory());
}
@@ -117,13 +121,16 @@ public class AnalysisMetricModuleProvider extends ModuleProvider {
ApplicationMappingGraph applicationMappingGraph = new ApplicationMappingGraph(getManager(), workerCreateListener);
applicationMappingGraph.create();
- ServiceEntryGraph serviceEntryGraph = new ServiceEntryGraph(getManager(), workerCreateListener);
- serviceEntryGraph.create();
+ InstanceMappingGraph instanceMappingGraph = new InstanceMappingGraph(getManager(), workerCreateListener);
+ instanceMappingGraph.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/component/ApplicationComponentDayPersistenceWorker.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
new file mode 100644
index 000000000..4da338c07
--- /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/ApplicationComponentDayPersistenceWorker.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.IApplicationComponentDayPersistenceDAO;
+import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationComponentDayPersistenceWorker extends PersistenceWorker {
+
+ public ApplicationComponentDayPersistenceWorker(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_COMPONENT_DAY_PERSISTENCE_WORKER_ID;
+ }
+
+ @Override protected boolean needMergeDBData() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationComponent> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentDayPersistenceDAO.class);
+ }
+
+ public static class Factory extends PersistenceWorkerProvider {
+
+ public Factory(ModuleManager moduleManager) {
+ super(moduleManager);
+ }
+
+ @Override public ApplicationComponentDayPersistenceWorker workerInstance(ModuleManager moduleManager) {
+ return new ApplicationComponentDayPersistenceWorker(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/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 59%
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 d274a8a0d..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.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.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(GraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID, ApplicationComponent.class)
- .addNode(new ApplicationComponentAggregationWorker.Factory(moduleManager).create(workerCreateListener))
- .addNext(new ApplicationComponentRemoteWorker.Factory(moduleManager, remoteSenderService, GraphIdDefine.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 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/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 6dfac7a4e..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,9 +16,9 @@
*
*/
-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.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@@ -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 WorkerIdDefine.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 67%
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 faa6127b2..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,46 +16,47 @@
*
*/
-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.WorkerIdDefine;
-import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
+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.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 WorkerIdDefine.APPLICATION_REFERENCE_METRIC_PERSISTENCE_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_COMPONENT_MINUTE_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
- @Override protected IPersistenceDAO persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IApplicationReferenceMetricPersistenceDAO.class);
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationComponent> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentMinutePersistenceDAO.class);
}
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
+ 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 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/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 2190876dd..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,9 +16,9 @@
*
*/
-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.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
@@ -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 WorkerIdDefine.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 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/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 2f59e5ba2..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,11 +16,11 @@
*
*/
-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;
-import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.SpanDecorator;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.EntrySpanListener;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.ExitSpanListener;
@@ -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);
@@ -73,10 +71,10 @@ public class ApplicationComponentSpanListener implements EntrySpanListener, Exit
}
@Override public void build() {
- Graph graph = GraphManager.INSTANCE.findGraph(GraphIdDefine.APPLICATION_COMPONENT_GRAPH_ID, ApplicationComponent.class);
+ 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 66%
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 8e2d2ced2..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,46 +16,47 @@
*
*/
-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.WorkerIdDefine;
-import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
+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.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 WorkerIdDefine.APPLICATION_MAPPING_PERSISTENCE_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_MAPPING_DAY_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
- @Override protected IPersistenceDAO persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingPersistenceDAO.class);
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationMapping> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationMappingDayPersistenceDAO.class);
}
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
+ 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 61%
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 f87d9cd02..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.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.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(GraphIdDefine.APPLICATION_MAPPING_GRAPH_ID, ApplicationMapping.class)
- .addNode(new ApplicationMappingAggregationWorker.Factory(moduleManager).create(workerCreateListener))
- .addNext(new ApplicationMappingRemoteWorker.Factory(moduleManager, remoteSenderService, GraphIdDefine.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 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/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 b56c99d04..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,9 +16,9 @@
*
*/
-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.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@@ -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 WorkerIdDefine.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 77%
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 9ac4faeec..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,9 +16,9 @@
*
*/
-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.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
@@ -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 WorkerIdDefine.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 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/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 cc3cddbad..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,11 +16,11 @@
*
*/
-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;
-import org.apache.skywalking.apm.collector.analysis.metric.define.graph.GraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.SpanDecorator;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.EntrySpanListener;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.listener.FirstSpanListener;
@@ -46,14 +46,17 @@ public class ApplicationMappingSpanListener implements FirstSpanListener, EntryS
private long timeBucket;
@Override public void parseEntry(SpanDecorator spanDecorator, int applicationId, int instanceId, String segmentId) {
- logger.debug("node mapping listener parse reference");
+ logger.debug("application mapping listener parse reference");
if (spanDecorator.getRefsCount() > 0) {
- ApplicationMapping applicationMapping = new ApplicationMapping(Const.EMPTY_STRING);
- applicationMapping.setApplicationId(applicationId);
- applicationMapping.setAddressId(spanDecorator.getRefs(0).getNetworkAddressId());
- String id = String.valueOf(applicationId) + Const.ID_SPLIT + String.valueOf(applicationMapping.getAddressId());
- applicationMapping.setId(id);
- applicationMappings.add(applicationMapping);
+ for (int i = 0; i < spanDecorator.getRefsCount(); i++) {
+ ApplicationMapping applicationMapping = new ApplicationMapping();
+ applicationMapping.setApplicationId(applicationId);
+ applicationMapping.setAddressId(spanDecorator.getRefs(i).getNetworkAddressId());
+
+ String metricId = String.valueOf(applicationId) + Const.ID_SPLIT + String.valueOf(applicationMapping.getAddressId());
+ applicationMapping.setMetricId(metricId);
+ applicationMappings.add(applicationMapping);
+ }
}
}
@@ -64,12 +67,12 @@ public class ApplicationMappingSpanListener implements FirstSpanListener, EntryS
}
@Override public void build() {
- logger.debug("node mapping listener build");
- Graph graph = GraphManager.INSTANCE.findGraph(GraphIdDefine.APPLICATION_MAPPING_GRAPH_ID, ApplicationMapping.class);
+ 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 node mapping aggregation worker, id: {}", applicationMapping.getId());
+ 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/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/metric/ApplicationDayMetricPersistenceWorker.java
similarity index 68%
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/metric/ApplicationDayMetricPersistenceWorker.java
index a1e23a0c7..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/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/metric/ApplicationDayMetricPersistenceWorker.java
@@ -16,46 +16,47 @@
*
*/
-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.WorkerIdDefine;
-import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
+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.IApplicationComponentPersistenceDAO;
-import org.apache.skywalking.apm.collector.storage.table.application.ApplicationComponent;
+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 ApplicationComponentPersistenceWorker extends PersistenceWorker {
+public class ApplicationDayMetricPersistenceWorker extends PersistenceWorker {
- public ApplicationComponentPersistenceWorker(ModuleManager moduleManager) {
+ public ApplicationDayMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
- return WorkerIdDefine.APPLICATION_COMPONENT_PERSISTENCE_WORKER_ID;
+ return MetricWorkerIdDefine.APPLICATION_DAY_METRIC_PERSISTENCE_WORKER_ID;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override protected IPersistenceDAO, ?, ApplicationMetric> persistenceDAO() {
+ return getModuleManager().find(StorageModule.NAME).getService(IApplicationDayMetricPersistenceDAO.class);
}
@Override protected boolean needMergeDBData() {
return true;
}
- @Override protected IPersistenceDAO persistenceDAO() {
- return getModuleManager().find(StorageModule.NAME).getService(IApplicationComponentPersistenceDAO.class);
- }
-
- public static class Factory extends AbstractLocalAsyncWorkerProvider {
+ public static class Factory extends PersistenceWorkerProvider {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
- @Override public ApplicationComponentPersistenceWorker workerInstance(ModuleManager moduleManager) {
- return new ApplicationComponentPersistenceWorker(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/metric/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
new file mode 100644
index 000000000..16771f1a8
--- /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/ApplicationMetricGraph.java
@@ -0,0 +1,86 @@
+/*
+ * 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.MetricGraphIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCreateListener;
+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;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationMetricGraph {
+
+ private final ModuleManager moduleManager;
+ private final WorkerCreateListener workerCreateListener;
+
+ public ApplicationMetricGraph(ModuleManager moduleManager, WorkerCreateListener workerCreateListener) {
+ this.moduleManager = moduleManager;
+ this.workerCreateListener = workerCreateListener;
+ }
+
+ public void create() {
+ RemoteSenderService remoteSenderService = moduleManager.find(RemoteModule.NAME).getService(RemoteSenderService.class);
+
+ Graph graph = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID, ApplicationReferenceMetric.class);
+
+ 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_MINUTE_METRIC_AGGREGATION_WORKER_ID, ApplicationReferenceMetric.class)
+ .addNext(new NodeProcessor() {
+
+ @Override public int id() {
+ return MetricWorkerIdDefine.APPLICATION_METRIC_GRAPH_BRIDGE_WORKER_ID;
+ }
+
+ @Override
+ public void process(ApplicationReferenceMetric applicationReferenceMetric,
+ Next next) {
+ graph.start(applicationReferenceMetric);
+ }
+ });
+ }
+}
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 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/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 98364e00b..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,9 +16,9 @@
*
*/
-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.WorkerIdDefine;
+import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.AggregationWorker;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
@@ -29,21 +29,32 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
/**
* @author peng-yongsheng
*/
-public class ApplicationMetricAggregationWorker extends AggregationWorker {
+public class ApplicationMinuteMetricAggregationWorker extends AggregationWorker