提交 0c44b3a6 编写于 作者: P peng-yongsheng

Merge remote-tracking branch 'upstream/master'

......@@ -60,6 +60,11 @@
<artifactId>jvm-define</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>metric-define</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>register-define</artifactId>
......
......@@ -28,6 +28,7 @@ import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.ServiceNa
import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.TraceSegmentServiceHandler;
import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingHandler;
import org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingListener;
import org.apache.skywalking.apm.collector.analysis.metric.define.AnalysisMetricModule;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.AnalysisSegmentParserModule;
import org.apache.skywalking.apm.collector.cluster.ClusterModule;
import org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService;
......@@ -87,7 +88,7 @@ public class AgentModuleGRPCProvider extends ModuleProvider {
}
@Override public String[] requiredModules() {
return new String[] {ClusterModule.NAME, NamingModule.NAME, GRPCManagerModule.NAME, AnalysisSegmentParserModule.NAME};
return new String[] {ClusterModule.NAME, NamingModule.NAME, GRPCManagerModule.NAME, AnalysisSegmentParserModule.NAME, AnalysisMetricModule.NAME};
}
private void addHandlers(Server gRPCServer) {
......
......@@ -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<ApplicationMappings> responseObserver) {
@Override
public void applicationCodeRegister(Application request, StreamObserver<ApplicationMapping> responseObserver) {
logger.debug("register application");
ProtocolStringList applicationCodes = request.getApplicationCodesList();
ApplicationMappings.Builder builder = ApplicationMappings.newBuilder();
for (int i = 0; i < applicationCodes.size(); i++) {
String applicationCode = applicationCodes.get(i);
int applicationId = applicationIDService.getOrCreateForApplicationCode(applicationCode);
ApplicationMapping.Builder builder = ApplicationMapping.newBuilder();
String applicationCode = request.getApplicationCode();
int applicationId = applicationIDService.getOrCreateForApplicationCode(applicationCode);
if (applicationId != 0) {
KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(applicationCode).setValue(applicationId).build();
builder.addApplications(value);
}
if (applicationId != 0) {
KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(applicationCode).setValue(applicationId).build();
builder.setApplication(value);
}
responseObserver.onNext(builder.build());
responseObserver.onCompleted();
......
......@@ -21,13 +21,17 @@ package org.apache.skywalking.apm.collector.agent.grpc.provider.handler;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import io.grpc.stub.StreamObserver;
import org.apache.skywalking.apm.collector.analysis.metric.define.AnalysisMetricModule;
import org.apache.skywalking.apm.collector.analysis.metric.define.service.IInstanceHeartBeatService;
import org.apache.skywalking.apm.collector.analysis.register.define.AnalysisRegisterModule;
import org.apache.skywalking.apm.collector.analysis.register.define.service.IInstanceIDService;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
import org.apache.skywalking.apm.collector.server.grpc.GRPCHandler;
import org.apache.skywalking.apm.network.proto.ApplicationInstance;
import org.apache.skywalking.apm.network.proto.ApplicationInstanceHeartbeat;
import org.apache.skywalking.apm.network.proto.ApplicationInstanceMapping;
import org.apache.skywalking.apm.network.proto.Downstream;
import org.apache.skywalking.apm.network.proto.InstanceDiscoveryServiceGrpc;
import org.apache.skywalking.apm.network.proto.OSInfo;
import org.slf4j.Logger;
......@@ -41,13 +45,16 @@ public class InstanceDiscoveryServiceHandler extends InstanceDiscoveryServiceGrp
private final Logger logger = LoggerFactory.getLogger(InstanceDiscoveryServiceHandler.class);
private final IInstanceIDService instanceIDService;
private final IInstanceHeartBeatService instanceHeartBeatService;
public InstanceDiscoveryServiceHandler(ModuleManager moduleManager) {
this.instanceIDService = moduleManager.find(AnalysisRegisterModule.NAME).getService(IInstanceIDService.class);
this.instanceHeartBeatService = moduleManager.find(AnalysisMetricModule.NAME).getService(IInstanceHeartBeatService.class);
}
@Override
public void register(ApplicationInstance request, StreamObserver<ApplicationInstanceMapping> responseObserver) {
public void registerInstance(ApplicationInstance request,
StreamObserver<ApplicationInstanceMapping> responseObserver) {
long timeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(request.getRegisterTime());
int instanceId = instanceIDService.getOrCreateByAgentUUID(request.getApplicationId(), request.getAgentUUID(), timeBucket, buildOsInfo(request.getOsinfo()));
ApplicationInstanceMapping.Builder builder = ApplicationInstanceMapping.newBuilder();
......@@ -57,6 +64,12 @@ public class InstanceDiscoveryServiceHandler extends InstanceDiscoveryServiceGrp
responseObserver.onCompleted();
}
@Override public void heartbeat(ApplicationInstanceHeartbeat request, StreamObserver<Downstream> responseObserver) {
int instanceId = request.getApplicationInstanceId();
long heartBeatTime = request.getHeartbeatTime();
this.instanceHeartBeatService.heartBeat(instanceId, heartBeatTime);
}
private String buildOsInfo(OSInfo osinfo) {
JsonObject osInfoJson = new JsonObject();
osInfoJson.addProperty("osName", osinfo.getOsName());
......
......@@ -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<Downstream> 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<Memory> memories) {
memories.forEach(memory -> memoryMetricService.send(instanceId, timeBucket, memory.getIsHeap(), memory.getInit(), memory.getMax(), memory.getUsed(), memory.getCommitted()));
}
......
......@@ -20,9 +20,9 @@ package org.apache.skywalking.apm.collector.agent.grpc.provider.handler;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import org.apache.skywalking.apm.network.proto.ApplicationMappings;
import org.apache.skywalking.apm.network.proto.Application;
import org.apache.skywalking.apm.network.proto.ApplicationMapping;
import org.apache.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc;
import org.apache.skywalking.apm.network.proto.Applications;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -39,8 +39,8 @@ public class ApplicationRegisterServiceHandlerTestCase {
ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).usePlaintext(true).build();
stub = ApplicationRegisterServiceGrpc.newBlockingStub(channel);
Applications application = Applications.newBuilder().addApplicationCodes("test141").build();
ApplicationMappings mapping = stub.batchRegister(application);
logger.debug(mapping.getApplications(0).getKey() + ", " + mapping.getApplications(0).getValue());
Application application = Application.newBuilder().setApplicationCode("test141").build();
ApplicationMapping mapping = stub.applicationCodeRegister(application);
logger.debug(mapping.getApplication().getKey() + ", " + mapping.getApplication().getValue());
}
}
/*
* 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());
}
}
/*
* 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());
}
}
......@@ -21,7 +21,7 @@ package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker;
import org.apache.skywalking.apm.collector.analysis.metric.define.MetricSource;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerException;
import org.apache.skywalking.apm.collector.core.data.Data;
import org.apache.skywalking.apm.collector.core.data.StreamData;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.Const;
import org.apache.skywalking.apm.collector.core.util.NumberFormatUtils;
......@@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
/**
* @author peng-yongsheng
*/
public abstract class AlarmAssertWorker<INPUT extends Data & Metric, OUTPUT extends Data & Alarm> extends AbstractLocalAsyncWorker<INPUT, OUTPUT> {
public abstract class AlarmAssertWorker<INPUT extends StreamData & Metric, OUTPUT extends StreamData & Alarm> extends AbstractLocalAsyncWorker<INPUT, OUTPUT> {
private final Logger logger = LoggerFactory.getLogger(AlarmAssertWorker.class);
......
......@@ -19,7 +19,7 @@
package org.apache.skywalking.apm.collector.analysis.alarm.provider.worker;
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
import org.apache.skywalking.apm.collector.core.data.Data;
import org.apache.skywalking.apm.collector.core.data.StreamData;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.table.Metric;
import org.apache.skywalking.apm.collector.storage.table.alarm.Alarm;
......@@ -27,7 +27,7 @@ import org.apache.skywalking.apm.collector.storage.table.alarm.Alarm;
/**
* @author peng-yongsheng
*/
public abstract class AlarmAssertWorkerProvider<INPUT extends Data & Metric, OUTPUT extends Data & Alarm, WORKER_TYPE extends AlarmAssertWorker<INPUT, OUTPUT>> extends AbstractLocalAsyncWorkerProvider<INPUT, OUTPUT, WORKER_TYPE> {
public abstract class AlarmAssertWorkerProvider<INPUT extends StreamData & Metric, OUTPUT extends StreamData & Alarm, WORKER_TYPE extends AlarmAssertWorker<INPUT, OUTPUT>> extends AbstractLocalAsyncWorkerProvider<INPUT, OUTPUT, WORKER_TYPE> {
public AlarmAssertWorkerProvider(ModuleManager moduleManager) {
super(moduleManager);
......
......@@ -45,7 +45,8 @@ public class ApplicationMetricAlarmAssertWorker extends AlarmAssertWorker<Applic
}
@Override protected ApplicationAlarm newAlarmObject(String id, ApplicationMetric inputMetric) {
ApplicationAlarm applicationAlarm = new ApplicationAlarm(id + Const.ID_SPLIT + inputMetric.getApplicationId());
ApplicationAlarm applicationAlarm = new ApplicationAlarm();
applicationAlarm.setId(id + Const.ID_SPLIT + inputMetric.getApplicationId());
applicationAlarm.setApplicationId(inputMetric.getApplicationId());
return applicationAlarm;
}
......
......@@ -64,7 +64,7 @@ public class ApplicationMetricAlarmGraph {
private void link(Graph<ApplicationMetric> graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID, ApplicationMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.APPLICATION_METRIC_PERSISTENCE_WORKER_ID, ApplicationMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.APPLICATION_MINUTE_METRIC_PERSISTENCE_WORKER_ID, ApplicationMetric.class)
.addNext(new NodeProcessor<ApplicationMetric, ApplicationMetric>() {
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmList;
/**
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarm;
/**
......
......@@ -39,7 +39,8 @@ public class ApplicationMetricAlarmToListNodeProcessor implements NodeProcessor<
+ Const.ID_SPLIT + applicationAlarm.getAlarmType()
+ Const.ID_SPLIT + applicationAlarm.getApplicationId();
ApplicationAlarmList applicationAlarmList = new ApplicationAlarmList(id);
ApplicationAlarmList applicationAlarmList = new ApplicationAlarmList();
applicationAlarmList.setId(id);
applicationAlarmList.setApplicationId(applicationAlarm.getApplicationId());
applicationAlarmList.setSourceValue(applicationAlarm.getSourceValue());
applicationAlarmList.setAlarmType(applicationAlarm.getAlarmType());
......
......@@ -45,7 +45,8 @@ public class ApplicationReferenceMetricAlarmAssertWorker extends AlarmAssertWork
}
@Override protected ApplicationReferenceAlarm newAlarmObject(String id, ApplicationReferenceMetric inputMetric) {
ApplicationReferenceAlarm applicationReferenceAlarm = new ApplicationReferenceAlarm(id + Const.ID_SPLIT + inputMetric.getFrontApplicationId() + Const.ID_SPLIT + inputMetric.getBehindApplicationId());
ApplicationReferenceAlarm applicationReferenceAlarm = new ApplicationReferenceAlarm();
applicationReferenceAlarm.setId(id + Const.ID_SPLIT + inputMetric.getFrontApplicationId() + Const.ID_SPLIT + inputMetric.getBehindApplicationId());
applicationReferenceAlarm.setFrontApplicationId(inputMetric.getFrontApplicationId());
applicationReferenceAlarm.setBehindApplicationId(inputMetric.getBehindApplicationId());
return applicationReferenceAlarm;
......
......@@ -65,7 +65,7 @@ public class ApplicationReferenceMetricAlarmGraph {
private void link(Graph<ApplicationReferenceMetric> graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.APPLICATION_REFERENCE_METRIC_GRAPH_ID, ApplicationReferenceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.APPLICATION_REFERENCE_METRIC_PERSISTENCE_WORKER_ID, ApplicationReferenceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.APPLICATION_REFERENCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID, ApplicationReferenceMetric.class)
.addNext(new NodeProcessor<ApplicationReferenceMetric, ApplicationReferenceMetric>() {
@Override public int id() {
return AlarmWorkerIdDefine.APPLICATION_REFERENCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarmList;
/**
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IApplicationReferenceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationReferenceAlarm;
/**
......
......@@ -41,7 +41,8 @@ public class ApplicationReferenceMetricAlarmToListNodeProcessor implements NodeP
+ Const.ID_SPLIT + applicationReferenceAlarm.getFrontApplicationId()
+ Const.ID_SPLIT + applicationReferenceAlarm.getBehindApplicationId();
ApplicationReferenceAlarmList applicationReferenceAlarmList = new ApplicationReferenceAlarmList(id);
ApplicationReferenceAlarmList applicationReferenceAlarmList = new ApplicationReferenceAlarmList();
applicationReferenceAlarmList.setId(id);
applicationReferenceAlarmList.setFrontApplicationId(applicationReferenceAlarm.getFrontApplicationId());
applicationReferenceAlarmList.setBehindApplicationId(applicationReferenceAlarm.getBehindApplicationId());
applicationReferenceAlarmList.setSourceValue(applicationReferenceAlarm.getSourceValue());
......
......@@ -45,7 +45,8 @@ public class InstanceMetricAlarmAssertWorker extends AlarmAssertWorker<InstanceM
}
@Override protected InstanceAlarm newAlarmObject(String id, InstanceMetric inputMetric) {
InstanceAlarm instanceAlarm = new InstanceAlarm(id + Const.ID_SPLIT + inputMetric.getInstanceId());
InstanceAlarm instanceAlarm = new InstanceAlarm();
instanceAlarm.setId(id + Const.ID_SPLIT + inputMetric.getInstanceId());
instanceAlarm.setApplicationId(inputMetric.getApplicationId());
instanceAlarm.setInstanceId(inputMetric.getInstanceId());
return instanceAlarm;
......
......@@ -64,7 +64,7 @@ public class InstanceMetricAlarmGraph {
private void link(Graph<InstanceMetric> graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.INSTANCE_METRIC_GRAPH_ID, InstanceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.INSTANCE_METRIC_PERSISTENCE_WORKER_ID, InstanceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.INSTANCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID, InstanceMetric.class)
.addNext(new NodeProcessor<InstanceMetric, InstanceMetric>() {
@Override public int id() {
return AlarmWorkerIdDefine.INSTANCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IInstanceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarmList;
/**
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IInstanceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarm;
/**
......
......@@ -39,7 +39,8 @@ public class InstanceMetricAlarmToListNodeProcessor implements NodeProcessor<Ins
+ Const.ID_SPLIT + instanceAlarm.getAlarmType()
+ Const.ID_SPLIT + instanceAlarm.getInstanceId();
InstanceAlarmList instanceAlarmList = new InstanceAlarmList(id);
InstanceAlarmList instanceAlarmList = new InstanceAlarmList();
instanceAlarmList.setId(id);
instanceAlarmList.setApplicationId(instanceAlarm.getApplicationId());
instanceAlarmList.setInstanceId(instanceAlarm.getInstanceId());
instanceAlarmList.setSourceValue(instanceAlarm.getSourceValue());
......
......@@ -45,7 +45,8 @@ public class InstanceReferenceMetricAlarmAssertWorker extends AlarmAssertWorker<
}
@Override protected InstanceReferenceAlarm newAlarmObject(String id, InstanceReferenceMetric inputMetric) {
InstanceReferenceAlarm instanceReferenceAlarm = new InstanceReferenceAlarm(id + Const.ID_SPLIT + inputMetric.getFrontInstanceId() + Const.ID_SPLIT + inputMetric.getBehindInstanceId());
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());
......
......@@ -64,7 +64,7 @@ public class InstanceReferenceMetricAlarmGraph {
private void link(Graph<InstanceReferenceMetric> graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.INSTANCE_REFERENCE_METRIC_GRAPH_ID, InstanceReferenceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.INSTANCE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID, InstanceReferenceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.INSTANCE_REFERENCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID, InstanceReferenceMetric.class)
.addNext(new NodeProcessor<InstanceReferenceMetric, InstanceReferenceMetric>() {
@Override public int id() {
return AlarmWorkerIdDefine.INSTANCE_REFERENCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IInstanceReferenceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList;
/**
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IInstanceReferenceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IInstanceReferenceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarm;
/**
......
......@@ -41,7 +41,8 @@ public class InstanceReferenceMetricAlarmToListNodeProcessor implements NodeProc
+ Const.ID_SPLIT + instanceReferenceAlarm.getFrontInstanceId()
+ Const.ID_SPLIT + instanceReferenceAlarm.getBehindInstanceId();
InstanceReferenceAlarmList instanceReferenceAlarmList = new InstanceReferenceAlarmList(id);
InstanceReferenceAlarmList instanceReferenceAlarmList = new InstanceReferenceAlarmList();
instanceReferenceAlarmList.setId(id);
instanceReferenceAlarmList.setFrontApplicationId(instanceReferenceAlarm.getFrontApplicationId());
instanceReferenceAlarmList.setBehindApplicationId(instanceReferenceAlarm.getBehindApplicationId());
instanceReferenceAlarmList.setFrontInstanceId(instanceReferenceAlarm.getFrontInstanceId());
......
......@@ -45,7 +45,8 @@ public class ServiceMetricAlarmAssertWorker extends AlarmAssertWorker<ServiceMet
}
@Override protected ServiceAlarm newAlarmObject(String id, ServiceMetric inputMetric) {
ServiceAlarm serviceAlarm = new ServiceAlarm(id + Const.ID_SPLIT + inputMetric.getServiceId());
ServiceAlarm serviceAlarm = new ServiceAlarm();
serviceAlarm.setId(id + Const.ID_SPLIT + inputMetric.getServiceId());
serviceAlarm.setApplicationId(inputMetric.getApplicationId());
serviceAlarm.setInstanceId(inputMetric.getInstanceId());
serviceAlarm.setServiceId(inputMetric.getServiceId());
......
......@@ -64,7 +64,7 @@ public class ServiceMetricAlarmGraph {
private void link(Graph<ServiceMetric> graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_METRIC_GRAPH_ID, ServiceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.SERVICE_METRIC_PERSISTENCE_WORKER_ID, ServiceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.SERVICE_MINUTE_METRIC_PERSISTENCE_WORKER_ID, ServiceMetric.class)
.addNext(new NodeProcessor<ServiceMetric, ServiceMetric>() {
@Override public int id() {
return AlarmWorkerIdDefine.SERVICE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IServiceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList;
/**
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IServiceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarm;
/**
......
......@@ -39,7 +39,8 @@ public class ServiceMetricAlarmToListNodeProcessor implements NodeProcessor<Serv
+ Const.ID_SPLIT + serviceAlarm.getAlarmType()
+ Const.ID_SPLIT + serviceAlarm.getServiceId();
ServiceAlarmList serviceAlarmList = new ServiceAlarmList(id);
ServiceAlarmList serviceAlarmList = new ServiceAlarmList();
serviceAlarmList.setId(id);
serviceAlarmList.setApplicationId(serviceAlarm.getApplicationId());
serviceAlarmList.setInstanceId(serviceAlarm.getInstanceId());
serviceAlarmList.setServiceId(serviceAlarm.getServiceId());
......
......@@ -49,7 +49,8 @@ public class ServiceReferenceMetricAlarmAssertWorker extends AlarmAssertWorker<S
}
@Override protected ServiceReferenceAlarm newAlarmObject(String id, ServiceReferenceMetric inputMetric) {
ServiceReferenceAlarm serviceReferenceAlarm = new ServiceReferenceAlarm(id + Const.ID_SPLIT + inputMetric.getFrontServiceId() + Const.ID_SPLIT + inputMetric.getBehindServiceId());
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());
......
......@@ -64,7 +64,7 @@ public class ServiceReferenceMetricAlarmGraph {
private void link(Graph<ServiceReferenceMetric> graph) {
GraphManager.INSTANCE.findGraph(MetricGraphIdDefine.SERVICE_REFERENCE_METRIC_GRAPH_ID, ServiceReferenceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.SERVICE_REFERENCE_METRIC_PERSISTENCE_WORKER_ID, ServiceReferenceMetric.class)
.toFinder().findNode(MetricWorkerIdDefine.SERVICE_REFERENCE_MINUTE_METRIC_PERSISTENCE_WORKER_ID, ServiceReferenceMetric.class)
.addNext(new NodeProcessor<ServiceReferenceMetric, ServiceReferenceMetric>() {
@Override public int id() {
return AlarmWorkerIdDefine.SERVICE_REFERENCE_METRIC_ALARM_GRAPH_BRIDGE_WORKER_ID;
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmListPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarmList;
/**
......
......@@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IServiceReferenceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.alarm.IServiceReferenceAlarmPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.alarm.ServiceReferenceAlarm;
/**
......
......@@ -40,7 +40,8 @@ public class ServiceReferenceMetricAlarmToListNodeProcessor implements NodeProce
+ Const.ID_SPLIT + serviceReferenceAlarm.getFrontServiceId()
+ Const.ID_SPLIT + serviceReferenceAlarm.getBehindServiceId();
ServiceReferenceAlarmList serviceReferenceAlarmList = new ServiceReferenceAlarmList(id);
ServiceReferenceAlarmList serviceReferenceAlarmList = new ServiceReferenceAlarmList();
serviceReferenceAlarmList.setId(id);
serviceReferenceAlarmList.setFrontApplicationId(serviceReferenceAlarm.getFrontApplicationId());
serviceReferenceAlarmList.setBehindApplicationId(serviceReferenceAlarm.getBehindApplicationId());
serviceReferenceAlarmList.setFrontInstanceId(serviceReferenceAlarm.getFrontInstanceId());
......
......@@ -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
};
}
......
......@@ -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;
}
......@@ -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;
}
......@@ -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);
}
......@@ -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);
}
......@@ -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();
......
......@@ -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());
......
......@@ -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());
......
......@@ -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());
......
......@@ -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());
......
/*
* 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<CpuMetric> {
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<CpuMetric, CpuDayMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public CpuDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new CpuDayMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<CpuMetric, CpuMetric> {
@Override public int id() {
return WorkerIdDefine.CPU_DAY_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(CpuMetric cpuMetric, Next<CpuMetric> 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);
}
}
/*
* 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<CpuMetric> {
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<CpuMetric, CpuHourMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public CpuHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new CpuHourMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<CpuMetric, CpuMetric> {
@Override public int id() {
return WorkerIdDefine.CPU_HOUR_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(CpuMetric cpuMetric, Next<CpuMetric> 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);
}
}
/*
* 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<CpuMetric, CpuMetric> {
@Override public int id() {
return WorkerIdDefine.CPU_METRIC_BRIDGE_NODE_ID;
}
@Override public void process(CpuMetric metric, Next<CpuMetric> next) {
next.execute(metric);
}
}
/*
* 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;
}
}
......@@ -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<CpuMetric, CpuMetric> 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));
}
}
/*
* 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<CpuMetric> {
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<CpuMetric, CpuMinuteMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public CpuMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new CpuMinuteMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<CpuMetric, CpuMetric> {
@Override public int id() {
return WorkerIdDefine.CPU_MINUTE_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(CpuMetric cpuMetric, Next<CpuMetric> 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);
}
}
/*
* 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<CpuMetric> {
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<CpuMetric, CpuMonthMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public CpuMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new CpuMonthMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<CpuMetric, CpuMetric> {
@Override public int id() {
return WorkerIdDefine.CPU_MONTH_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(CpuMetric cpuMetric, Next<CpuMetric> 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);
}
}
......@@ -16,7 +16,7 @@
*
*/
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.cpu;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
......@@ -24,20 +24,20 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.ICpuMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.cpump.ICpuSecondMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetric;
/**
* @author peng-yongsheng
*/
public class CpuMetricPersistenceWorker extends PersistenceWorker<CpuMetric> {
public class CpuSecondMetricPersistenceWorker extends PersistenceWorker<CpuMetric> {
public CpuMetricPersistenceWorker(ModuleManager moduleManager) {
public CpuSecondMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.CPU_METRIC_PERSISTENCE_WORKER_ID;
return WorkerIdDefine.CPU_SECOND_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
......@@ -46,17 +46,17 @@ public class CpuMetricPersistenceWorker extends PersistenceWorker<CpuMetric> {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, CpuMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(ICpuMetricPersistenceDAO.class);
return getModuleManager().find(StorageModule.NAME).getService(ICpuSecondMetricPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<CpuMetric, CpuMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<CpuMetric, CpuSecondMetricPersistenceWorker> {
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
......
/*
* 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<GCMetric> {
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<GCMetric, GCDayMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public GCDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new GCDayMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<GCMetric, GCMetric> {
@Override public int id() {
return WorkerIdDefine.GC_DAY_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(GCMetric gcMetric, Next<GCMetric> 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);
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCHourMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
/**
* @author peng-yongsheng
*/
public class GCHourMetricPersistenceWorker extends PersistenceWorker<GCMetric> {
public GCHourMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.GC_HOUR_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return true;
}
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, GCMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IGCHourMetricPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<GCMetric, GCHourMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public GCHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new GCHourMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<GCMetric, GCMetric> {
@Override public int id() {
return WorkerIdDefine.GC_HOUR_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(GCMetric gcMetric, Next<GCMetric> 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);
}
}
/*
* 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<GCMetric, GCMetric> {
@Override public int id() {
return WorkerIdDefine.GC_METRIC_BRIDGE_NODE_ID;
}
@Override public void process(GCMetric metric, Next<GCMetric> next) {
next.execute(metric);
}
}
/*
* 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;
}
}
......@@ -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<GCMetric, GCMetric> 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));
}
}
/*
* 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<GCMetric> {
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<GCMetric, GCMinuteMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public GCMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new GCMinuteMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<GCMetric, GCMetric> {
@Override public int id() {
return WorkerIdDefine.GC_MINUTE_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(GCMetric gcMetric, Next<GCMetric> 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);
}
}
/*
* 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<GCMetric> {
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<GCMetric, GCMonthMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public GCMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new GCMonthMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<GCMetric, GCMetric> {
@Override public int id() {
return WorkerIdDefine.GC_MONTH_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(GCMetric gcMetric, Next<GCMetric> 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);
}
}
......@@ -16,7 +16,7 @@
*
*/
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.gc;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
......@@ -24,20 +24,20 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IGCMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.gcmp.IGCSecondMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetric;
/**
* @author peng-yongsheng
*/
public class GCMetricPersistenceWorker extends PersistenceWorker<GCMetric> {
public class GCSecondMetricPersistenceWorker extends PersistenceWorker<GCMetric> {
public GCMetricPersistenceWorker(ModuleManager moduleManager) {
public GCSecondMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.GC_METRIC_PERSISTENCE_WORKER_ID;
return WorkerIdDefine.GC_SECOND_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
......@@ -46,17 +46,17 @@ public class GCMetricPersistenceWorker extends PersistenceWorker<GCMetric> {
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, GCMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IGCMetricPersistenceDAO.class);
return getModuleManager().find(StorageModule.NAME).getService(IGCSecondMetricPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<GCMetric, GCMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<GCMetric, GCSecondMetricPersistenceWorker> {
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
......
/*
* 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<MemoryMetric> {
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<MemoryMetric, MemoryDayMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public MemoryDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new MemoryDayMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<MemoryMetric, MemoryMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_DAY_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(MemoryMetric memoryMetric, Next<MemoryMetric> 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);
}
}
......@@ -16,7 +16,7 @@
*
*/
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
......@@ -24,39 +24,39 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IMemoryPoolMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemoryHourMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
/**
* @author peng-yongsheng
*/
public class MemoryPoolMetricPersistenceWorker extends PersistenceWorker<MemoryPoolMetric> {
public class MemoryHourMetricPersistenceWorker extends PersistenceWorker<MemoryMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_POOL_METRIC_PERSISTENCE_WORKER_ID;
public MemoryHourMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
public MemoryPoolMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
@Override public int id() {
return WorkerIdDefine.MEMORY_HOUR_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
return false;
return true;
}
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, MemoryPoolMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IMemoryPoolMetricPersistenceDAO.class);
@Override protected IPersistenceDAO<?, ?, MemoryMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IMemoryHourMetricPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<MemoryPoolMetric, MemoryPoolMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<MemoryMetric, MemoryHourMetricPersistenceWorker> {
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
......
/*
* 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<MemoryMetric, MemoryMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_HOUR_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(MemoryMetric memoryMetric, Next<MemoryMetric> 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);
}
}
/*
* 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<MemoryMetric, MemoryMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_METRIC_BRIDGE_NODE_ID;
}
@Override public void process(MemoryMetric metric, Next<MemoryMetric> next) {
next.execute(metric);
}
}
/*
* 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;
}
}
......@@ -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<MemoryMetric, MemoryMetric> 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));
}
}
/*
* 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<MemoryMetric> {
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<MemoryMetric, MemoryMinuteMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public MemoryMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new MemoryMinuteMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<MemoryMetric, MemoryMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_MINUTE_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(MemoryMetric memoryMetric, Next<MemoryMetric> 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);
}
}
/*
* 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<MemoryMetric> {
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<MemoryMetric, MemoryMonthMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public MemoryMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new MemoryMonthMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<MemoryMetric, MemoryMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_MONTH_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(MemoryMetric memoryMetric, Next<MemoryMetric> 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);
}
}
......@@ -16,7 +16,7 @@
*
*/
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker;
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memory;
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
......@@ -24,20 +24,20 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.IMemoryMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.dao.memorymp.IMemorySecondMetricPersistenceDAO;
import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetric;
/**
* @author peng-yongsheng
*/
public class MemoryMetricPersistenceWorker extends PersistenceWorker<MemoryMetric> {
public class MemorySecondMetricPersistenceWorker extends PersistenceWorker<MemoryMetric> {
public MemoryMetricPersistenceWorker(ModuleManager moduleManager) {
public MemorySecondMetricPersistenceWorker(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public int id() {
return WorkerIdDefine.MEMORY_METRIC_PERSISTENCE_WORKER_ID;
return WorkerIdDefine.MEMORY_SECOND_METRIC_PERSISTENCE_WORKER_ID;
}
@Override protected boolean needMergeDBData() {
......@@ -46,17 +46,17 @@ public class MemoryMetricPersistenceWorker extends PersistenceWorker<MemoryMetri
@SuppressWarnings("unchecked")
@Override protected IPersistenceDAO<?, ?, MemoryMetric> persistenceDAO() {
return getModuleManager().find(StorageModule.NAME).getService(IMemoryMetricPersistenceDAO.class);
return getModuleManager().find(StorageModule.NAME).getService(IMemorySecondMetricPersistenceDAO.class);
}
public static class Factory extends PersistenceWorkerProvider<MemoryMetric, MemoryMetricPersistenceWorker> {
public static class Factory extends PersistenceWorkerProvider<MemoryMetric, MemorySecondMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public MemoryMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new MemoryMetricPersistenceWorker(moduleManager);
@Override public MemorySecondMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new MemorySecondMetricPersistenceWorker(moduleManager);
}
@Override
......
/*
* 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<MemoryPoolMetric> {
@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<MemoryPoolMetric, MemoryPoolDayMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public MemoryPoolDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new MemoryPoolDayMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<MemoryPoolMetric, MemoryPoolMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_POOL_DAY_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(MemoryPoolMetric memoryPoolMetric, Next<MemoryPoolMetric> 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);
}
}
/*
* 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<MemoryPoolMetric> {
@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<MemoryPoolMetric, MemoryPoolHourMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public MemoryPoolHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new MemoryPoolHourMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<MemoryPoolMetric, MemoryPoolMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_POOL_HOUR_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(MemoryPoolMetric memoryPoolMetric, Next<MemoryPoolMetric> 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);
}
}
/*
* 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<MemoryPoolMetric, MemoryPoolMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_POOL_METRIC_BRIDGE_NODE_ID;
}
@Override public void process(MemoryPoolMetric metric, Next<MemoryPoolMetric> next) {
next.execute(metric);
}
}
/*
* 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;
}
}
......@@ -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<MemoryPoolMetric, MemoryPoolMetric> 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));
}
}
/*
* 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<MemoryPoolMetric> {
@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<MemoryPoolMetric, MemoryPoolMinuteMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public MemoryPoolMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new MemoryPoolMinuteMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<MemoryPoolMetric, MemoryPoolMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_POOL_MINUTE_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(MemoryPoolMetric memoryPoolMetric, Next<MemoryPoolMetric> 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);
}
}
/*
* 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<MemoryPoolMetric> {
@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<MemoryPoolMetric, MemoryPoolMonthMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public MemoryPoolMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new MemoryPoolMonthMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
/*
* 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<MemoryPoolMetric, MemoryPoolMetric> {
@Override public int id() {
return WorkerIdDefine.MEMORY_POOL_MONTH_METRIC_TRANSFORM_NODE_ID;
}
@Override public void process(MemoryPoolMetric memoryPoolMetric, Next<MemoryPoolMetric> 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);
}
}
/*
* 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<MemoryPoolMetric> {
@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<MemoryPoolMetric, MemoryPoolSecondMetricPersistenceWorker> {
public Factory(ModuleManager moduleManager) {
super(moduleManager);
}
@Override public MemoryPoolSecondMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
return new MemoryPoolSecondMetricPersistenceWorker(moduleManager);
}
@Override
public int queueSize() {
return 1024;
}
}
}
......@@ -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};
}
}
......@@ -32,8 +32,9 @@ public class MetricGraphIdDefine {
public static final int APPLICATION_COMPONENT_GRAPH_ID = 406;
public static final int APPLICATION_MAPPING_GRAPH_ID = 407;
public static final int SERVICE_ENTRY_GRAPH_ID = 408;
public static final int GLOBAL_TRACE_GRAPH_ID = 409;
public static final int SEGMENT_COST_GRAPH_ID = 410;
public static final int INSTANCE_MAPPING_GRAPH_ID = 411;
public static final int INSTANCE_HEART_BEAT_PERSISTENCE_GRAPH_ID = 412;
}
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册