Application metric pyramid aggregate.
This commit is contained in:
parent
0145361ad9
commit
a09aee872b
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -72,9 +72,15 @@ public class MetricWorkerIdDefine {
|
|||
public static final int INSTANCE_MONTH_METRIC_PERSISTENCE_WORKER_ID = 4507;
|
||||
public static final int INSTANCE_MONTH_METRIC_TRANSFORM_NODE_ID = 4508;
|
||||
|
||||
public static final int APPLICATION_METRIC_AGGREGATION_WORKER_ID = 415;
|
||||
public static final int APPLICATION_METRIC_REMOTE_WORKER_ID = 416;
|
||||
public static final int APPLICATION_METRIC_PERSISTENCE_WORKER_ID = 417;
|
||||
public static final int APPLICATION_MINUTE_METRIC_AGGREGATION_WORKER_ID = 4600;
|
||||
public static final int APPLICATION_MINUTE_METRIC_REMOTE_WORKER_ID = 4601;
|
||||
public static final int APPLICATION_MINUTE_METRIC_PERSISTENCE_WORKER_ID = 4602;
|
||||
public static final int APPLICATION_HOUR_METRIC_PERSISTENCE_WORKER_ID = 4603;
|
||||
public static final int APPLICATION_HOUR_METRIC_TRANSFORM_NODE_ID = 4604;
|
||||
public static final int APPLICATION_DAY_METRIC_PERSISTENCE_WORKER_ID = 4605;
|
||||
public static final int APPLICATION_DAY_METRIC_TRANSFORM_NODE_ID = 4606;
|
||||
public static final int APPLICATION_MONTH_METRIC_PERSISTENCE_WORKER_ID = 4607;
|
||||
public static final int APPLICATION_MONTH_METRIC_TRANSFORM_NODE_ID = 4608;
|
||||
|
||||
public static final int APPLICATION_COMPONENT_AGGREGATION_WORKER_ID = 418;
|
||||
public static final int APPLICATION_COMPONENT_REMOTE_WORKER_ID = 419;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.appli
|
|||
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationComponentSpanListener;
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationMappingGraph;
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationMappingSpanListener;
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.ApplicationMetricGraph;
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric.ApplicationMetricGraph;
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.refmetric.ApplicationReferenceMetricGraph;
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.global.GlobalTraceGraph;
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.provider.worker.global.GlobalTraceSpanListener;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
|
||||
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
|
||||
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
|
||||
|
|
@ -24,39 +24,39 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.impl.Persistenc
|
|||
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
|
||||
import org.apache.skywalking.apm.collector.storage.StorageModule;
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationMetricPersistenceWorker extends PersistenceWorker<ApplicationMetric> {
|
||||
public class ApplicationDayMetricPersistenceWorker extends PersistenceWorker<ApplicationMetric> {
|
||||
|
||||
public ApplicationMetricPersistenceWorker(ModuleManager moduleManager) {
|
||||
public ApplicationDayMetricPersistenceWorker(ModuleManager moduleManager) {
|
||||
super(moduleManager);
|
||||
}
|
||||
|
||||
@Override public int id() {
|
||||
return MetricWorkerIdDefine.APPLICATION_METRIC_PERSISTENCE_WORKER_ID;
|
||||
return MetricWorkerIdDefine.APPLICATION_DAY_METRIC_PERSISTENCE_WORKER_ID;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override protected IPersistenceDAO<?, ?, ApplicationMetric> persistenceDAO() {
|
||||
return getModuleManager().find(StorageModule.NAME).getService(IApplicationMetricPersistenceDAO.class);
|
||||
return getModuleManager().find(StorageModule.NAME).getService(IApplicationDayMetricPersistenceDAO.class);
|
||||
}
|
||||
|
||||
@Override protected boolean needMergeDBData() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class Factory extends PersistenceWorkerProvider<ApplicationMetric, ApplicationMetricPersistenceWorker> {
|
||||
public static class Factory extends PersistenceWorkerProvider<ApplicationMetric, ApplicationDayMetricPersistenceWorker> {
|
||||
|
||||
public Factory(ModuleManager moduleManager) {
|
||||
super(moduleManager);
|
||||
}
|
||||
|
||||
@Override public ApplicationMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
|
||||
return new ApplicationMetricPersistenceWorker(moduleManager);
|
||||
@Override public ApplicationDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
|
||||
return new ApplicationDayMetricPersistenceWorker(moduleManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
|
||||
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
|
||||
import org.apache.skywalking.apm.collector.core.graph.Next;
|
||||
import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationDayMetricTransformNode implements NodeProcessor<ApplicationMetric, ApplicationMetric> {
|
||||
|
||||
@Override public int id() {
|
||||
return MetricWorkerIdDefine.APPLICATION_DAY_METRIC_TRANSFORM_NODE_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ApplicationMetric applicationMetric, Next<ApplicationMetric> next) {
|
||||
long timeBucket = TimeBucketUtils.INSTANCE.minuteToDay(applicationMetric.getTimeBucket());
|
||||
applicationMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMetric.getMetricId());
|
||||
applicationMetric.setTimeBucket(timeBucket);
|
||||
|
||||
next.execute(applicationMetric);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
|
||||
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
|
||||
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
|
||||
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
|
||||
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
|
||||
import org.apache.skywalking.apm.collector.storage.StorageModule;
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationHourMetricPersistenceWorker extends PersistenceWorker<ApplicationMetric> {
|
||||
|
||||
public ApplicationHourMetricPersistenceWorker(ModuleManager moduleManager) {
|
||||
super(moduleManager);
|
||||
}
|
||||
|
||||
@Override public int id() {
|
||||
return MetricWorkerIdDefine.APPLICATION_HOUR_METRIC_PERSISTENCE_WORKER_ID;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override protected IPersistenceDAO<?, ?, ApplicationMetric> persistenceDAO() {
|
||||
return getModuleManager().find(StorageModule.NAME).getService(IApplicationHourMetricPersistenceDAO.class);
|
||||
}
|
||||
|
||||
@Override protected boolean needMergeDBData() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class Factory extends PersistenceWorkerProvider<ApplicationMetric, ApplicationHourMetricPersistenceWorker> {
|
||||
|
||||
public Factory(ModuleManager moduleManager) {
|
||||
super(moduleManager);
|
||||
}
|
||||
|
||||
@Override public ApplicationHourMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
|
||||
return new ApplicationHourMetricPersistenceWorker(moduleManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queueSize() {
|
||||
return 1024;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
|
||||
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
|
||||
import org.apache.skywalking.apm.collector.core.graph.Next;
|
||||
import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationHourMetricTransformNode implements NodeProcessor<ApplicationMetric, ApplicationMetric> {
|
||||
|
||||
@Override public int id() {
|
||||
return MetricWorkerIdDefine.APPLICATION_HOUR_METRIC_TRANSFORM_NODE_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ApplicationMetric applicationMetric, Next<ApplicationMetric> next) {
|
||||
long timeBucket = TimeBucketUtils.INSTANCE.minuteToHour(applicationMetric.getTimeBucket());
|
||||
applicationMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMetric.getMetricId());
|
||||
applicationMetric.setTimeBucket(timeBucket);
|
||||
|
||||
next.execute(applicationMetric);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
|
||||
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
|
||||
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractLocalAsyncWorkerProvider;
|
||||
|
|
@ -36,18 +36,23 @@ public class ApplicationMetricAggregationWorker extends AggregationWorker<Applic
|
|||
}
|
||||
|
||||
@Override public int id() {
|
||||
return MetricWorkerIdDefine.APPLICATION_METRIC_AGGREGATION_WORKER_ID;
|
||||
return MetricWorkerIdDefine.APPLICATION_MINUTE_METRIC_AGGREGATION_WORKER_ID;
|
||||
}
|
||||
|
||||
@Override protected ApplicationMetric transform(ApplicationReferenceMetric applicationReferenceMetric) {
|
||||
Integer applicationId = applicationReferenceMetric.getBehindApplicationId();
|
||||
Long timeBucket = applicationReferenceMetric.getTimeBucket();
|
||||
|
||||
String id = String.valueOf(timeBucket)
|
||||
+ Const.ID_SPLIT + String.valueOf(applicationId)
|
||||
String metricId = String.valueOf(applicationId)
|
||||
+ Const.ID_SPLIT + applicationReferenceMetric.getSourceValue();
|
||||
|
||||
ApplicationMetric applicationMetric = new ApplicationMetric(id);
|
||||
String id = String.valueOf(timeBucket)
|
||||
+ Const.ID_SPLIT + metricId;
|
||||
|
||||
ApplicationMetric applicationMetric = new ApplicationMetric();
|
||||
applicationMetric.setId(id);
|
||||
applicationMetric.setMetricId(metricId);
|
||||
|
||||
applicationMetric.setApplicationId(applicationId);
|
||||
applicationMetric.setSourceValue(applicationReferenceMetric.getSourceValue());
|
||||
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
|
||||
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricGraphIdDefine;
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
|
||||
|
|
@ -24,10 +24,12 @@ import org.apache.skywalking.apm.collector.analysis.worker.model.base.WorkerCrea
|
|||
import org.apache.skywalking.apm.collector.core.graph.Graph;
|
||||
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
|
||||
import org.apache.skywalking.apm.collector.core.graph.Next;
|
||||
import org.apache.skywalking.apm.collector.core.graph.Node;
|
||||
import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
|
||||
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
|
||||
import org.apache.skywalking.apm.collector.remote.RemoteModule;
|
||||
import org.apache.skywalking.apm.collector.remote.service.RemoteSenderService;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationReferenceMetric;
|
||||
|
||||
/**
|
||||
|
|
@ -48,9 +50,19 @@ public class ApplicationMetricGraph {
|
|||
|
||||
Graph<ApplicationReferenceMetric> graph = GraphManager.INSTANCE.createIfAbsent(MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID, ApplicationReferenceMetric.class);
|
||||
|
||||
graph.addNode(new ApplicationMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
|
||||
.addNext(new ApplicationMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID).create(workerCreateListener))
|
||||
.addNext(new ApplicationMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
|
||||
Node<ApplicationMetric, ApplicationMetric> remoteNode = graph.addNode(new ApplicationMetricAggregationWorker.Factory(moduleManager).create(workerCreateListener))
|
||||
.addNext(new ApplicationMetricRemoteWorker.Factory(moduleManager, remoteSenderService, MetricGraphIdDefine.APPLICATION_METRIC_GRAPH_ID).create(workerCreateListener));
|
||||
|
||||
remoteNode.addNext(new ApplicationMinuteMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
|
||||
|
||||
remoteNode.addNext(new ApplicationHourMetricTransformNode())
|
||||
.addNext(new ApplicationHourMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
|
||||
|
||||
remoteNode.addNext(new ApplicationDayMetricTransformNode())
|
||||
.addNext(new ApplicationDayMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
|
||||
|
||||
remoteNode.addNext(new ApplicationMonthMetricTransformNode())
|
||||
.addNext(new ApplicationMonthMetricPersistenceWorker.Factory(moduleManager).create(workerCreateListener));
|
||||
|
||||
link(graph);
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application;
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
|
||||
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
|
||||
import org.apache.skywalking.apm.collector.analysis.worker.model.base.AbstractRemoteWorker;
|
||||
|
|
@ -37,7 +37,7 @@ public class ApplicationMetricRemoteWorker extends AbstractRemoteWorker<Applicat
|
|||
}
|
||||
|
||||
@Override public int id() {
|
||||
return MetricWorkerIdDefine.APPLICATION_METRIC_REMOTE_WORKER_ID;
|
||||
return MetricWorkerIdDefine.APPLICATION_MINUTE_METRIC_REMOTE_WORKER_ID;
|
||||
}
|
||||
|
||||
@Override protected void onWork(ApplicationMetric applicationMetric) throws WorkerException {
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
|
||||
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
|
||||
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
|
||||
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
|
||||
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
|
||||
import org.apache.skywalking.apm.collector.storage.StorageModule;
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationMinuteMetricPersistenceWorker extends PersistenceWorker<ApplicationMetric> {
|
||||
|
||||
public ApplicationMinuteMetricPersistenceWorker(ModuleManager moduleManager) {
|
||||
super(moduleManager);
|
||||
}
|
||||
|
||||
@Override public int id() {
|
||||
return MetricWorkerIdDefine.APPLICATION_MINUTE_METRIC_PERSISTENCE_WORKER_ID;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override protected IPersistenceDAO<?, ?, ApplicationMetric> persistenceDAO() {
|
||||
return getModuleManager().find(StorageModule.NAME).getService(IApplicationMinuteMetricPersistenceDAO.class);
|
||||
}
|
||||
|
||||
@Override protected boolean needMergeDBData() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class Factory extends PersistenceWorkerProvider<ApplicationMetric, ApplicationMinuteMetricPersistenceWorker> {
|
||||
|
||||
public Factory(ModuleManager moduleManager) {
|
||||
super(moduleManager);
|
||||
}
|
||||
|
||||
@Override public ApplicationMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
|
||||
return new ApplicationMinuteMetricPersistenceWorker(moduleManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queueSize() {
|
||||
return 1024;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
|
||||
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
|
||||
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
|
||||
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
|
||||
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
|
||||
import org.apache.skywalking.apm.collector.storage.StorageModule;
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationMonthMetricPersistenceWorker extends PersistenceWorker<ApplicationMetric> {
|
||||
|
||||
public ApplicationMonthMetricPersistenceWorker(ModuleManager moduleManager) {
|
||||
super(moduleManager);
|
||||
}
|
||||
|
||||
@Override public int id() {
|
||||
return MetricWorkerIdDefine.APPLICATION_MONTH_METRIC_PERSISTENCE_WORKER_ID;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override protected IPersistenceDAO<?, ?, ApplicationMetric> persistenceDAO() {
|
||||
return getModuleManager().find(StorageModule.NAME).getService(IApplicationMonthMetricPersistenceDAO.class);
|
||||
}
|
||||
|
||||
@Override protected boolean needMergeDBData() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class Factory extends PersistenceWorkerProvider<ApplicationMetric, ApplicationMonthMetricPersistenceWorker> {
|
||||
|
||||
public Factory(ModuleManager moduleManager) {
|
||||
super(moduleManager);
|
||||
}
|
||||
|
||||
@Override public ApplicationMonthMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
|
||||
return new ApplicationMonthMetricPersistenceWorker(moduleManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queueSize() {
|
||||
return 1024;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
|
||||
|
||||
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
|
||||
import org.apache.skywalking.apm.collector.core.graph.Next;
|
||||
import org.apache.skywalking.apm.collector.core.graph.NodeProcessor;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationMonthMetricTransformNode implements NodeProcessor<ApplicationMetric, ApplicationMetric> {
|
||||
|
||||
@Override public int id() {
|
||||
return MetricWorkerIdDefine.APPLICATION_MONTH_METRIC_TRANSFORM_NODE_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ApplicationMetric applicationMetric, Next<ApplicationMetric> next) {
|
||||
long timeBucket = TimeBucketUtils.INSTANCE.minuteToMonth(applicationMetric.getTimeBucket());
|
||||
applicationMetric.setId(String.valueOf(timeBucket) + Const.ID_SPLIT + applicationMetric.getMetricId());
|
||||
applicationMetric.setTimeBucket(timeBucket);
|
||||
|
||||
next.execute(applicationMetric);
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentPers
|
|||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO;
|
||||
|
|
@ -122,7 +122,7 @@ public class StorageModule extends Module {
|
|||
classes.add(IGlobalTracePersistenceDAO.class);
|
||||
classes.add(IApplicationComponentPersistenceDAO.class);
|
||||
classes.add(IApplicationMappingPersistenceDAO.class);
|
||||
classes.add(IApplicationMetricPersistenceDAO.class);
|
||||
classes.add(IApplicationMinuteMetricPersistenceDAO.class);
|
||||
classes.add(IApplicationReferenceMinuteMetricPersistenceDAO.class);
|
||||
classes.add(ISegmentCostPersistenceDAO.class);
|
||||
classes.add(ISegmentPersistenceDAO.class);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.dao;
|
||||
package org.apache.skywalking.apm.collector.storage.dao.amp;
|
||||
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
|
@ -24,5 +24,5 @@ import org.apache.skywalking.apm.collector.storage.table.application.Application
|
|||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface IApplicationMetricPersistenceDAO<Insert, Update, DataImpl extends ApplicationMetric> extends IPersistenceDAO<Insert, Update, DataImpl> {
|
||||
public interface IApplicationDayMetricPersistenceDAO<INSERT, UPDATE, STREAM_DATA extends ApplicationMetric> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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.storage.dao.amp;
|
||||
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface IApplicationHourMetricPersistenceDAO<INSERT, UPDATE, STREAM_DATA extends ApplicationMetric> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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.storage.dao.amp;
|
||||
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface IApplicationMinuteMetricPersistenceDAO<INSERT, UPDATE, STREAM_DATA extends ApplicationMetric> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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.storage.dao.amp;
|
||||
|
||||
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface IApplicationMonthMetricPersistenceDAO<INSERT, UPDATE, STREAM_DATA extends ApplicationMetric> extends IPersistenceDAO<INSERT, UPDATE, STREAM_DATA> {
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
package org.apache.skywalking.apm.collector.storage.table.application;
|
||||
|
||||
import org.apache.skywalking.apm.collector.core.data.Column;
|
||||
import org.apache.skywalking.apm.collector.core.data.AbstractData;
|
||||
import org.apache.skywalking.apm.collector.core.data.StreamData;
|
||||
import org.apache.skywalking.apm.collector.core.data.operator.AddOperation;
|
||||
import org.apache.skywalking.apm.collector.core.data.operator.NonOperation;
|
||||
import org.apache.skywalking.apm.collector.storage.table.Metric;
|
||||
|
|
@ -27,10 +27,11 @@ import org.apache.skywalking.apm.collector.storage.table.Metric;
|
|||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationMetric extends AbstractData implements Metric {
|
||||
public class ApplicationMetric extends StreamData implements Metric {
|
||||
|
||||
private static final Column[] STRING_COLUMNS = {
|
||||
new Column(ApplicationMetricTable.COLUMN_ID, new NonOperation()),
|
||||
new Column(ApplicationMetricTable.COLUMN_METRIC_ID, new NonOperation()),
|
||||
};
|
||||
|
||||
private static final Column[] LONG_COLUMNS = {
|
||||
|
|
@ -64,8 +65,24 @@ public class ApplicationMetric extends AbstractData implements Metric {
|
|||
|
||||
private static final Column[] BYTE_COLUMNS = {};
|
||||
|
||||
public ApplicationMetric(String id) {
|
||||
super(id, STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
|
||||
public ApplicationMetric() {
|
||||
super(STRING_COLUMNS, LONG_COLUMNS, DOUBLE_COLUMNS, INTEGER_COLUMNS, BOOLEAN_COLUMNS, BYTE_COLUMNS);
|
||||
}
|
||||
|
||||
@Override public String getId() {
|
||||
return getDataString(0);
|
||||
}
|
||||
|
||||
@Override public void setId(String id) {
|
||||
setDataString(0, id);
|
||||
}
|
||||
|
||||
@Override public String getMetricId() {
|
||||
return getDataString(1);
|
||||
}
|
||||
|
||||
@Override public void setMetricId(String metricId) {
|
||||
setDataString(1, metricId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentPers
|
|||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO;
|
||||
|
|
@ -93,7 +93,7 @@ import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationEsCacheDAO;
|
|||
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationEsRegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationMappingEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationMappingEsUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationMetricEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.amp.ApplicationMinuteMetricEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationReferenceAlarmEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.ApplicationReferenceAlarmListEsPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.dao.armp.ApplicationReferenceMinuteMetricEsPersistenceDAO;
|
||||
|
|
@ -235,7 +235,7 @@ public class StorageModuleEsProvider extends ModuleProvider {
|
|||
this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceEsPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(IApplicationComponentPersistenceDAO.class, new ApplicationComponentEsPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(IApplicationMappingPersistenceDAO.class, new ApplicationMappingEsPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(IApplicationMetricPersistenceDAO.class, new ApplicationMetricEsPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricEsPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricEsPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(ISegmentCostPersistenceDAO.class, new SegmentCostEsPersistenceDAO(elasticSearchClient));
|
||||
this.registerServiceImplementation(ISegmentPersistenceDAO.class, new SegmentEsPersistenceDAO(elasticSearchClient));
|
||||
|
|
|
|||
|
|
@ -1,147 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.es.dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.update.UpdateRequestBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.reindex.BulkByScrollResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationMetricEsPersistenceDAO extends EsDAO implements IApplicationMetricPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationMetric> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ApplicationMetricEsPersistenceDAO.class);
|
||||
|
||||
public ApplicationMetricEsPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override public ApplicationMetric get(String id) {
|
||||
GetResponse getResponse = getClient().prepareGet(ApplicationMetricTable.TABLE, id).get();
|
||||
if (getResponse.isExists()) {
|
||||
ApplicationMetric applicationMetric = new ApplicationMetric(id);
|
||||
Map<String, Object> source = getResponse.getSource();
|
||||
applicationMetric.setApplicationId(((Number)source.get(ApplicationMetricTable.COLUMN_APPLICATION_ID)).intValue());
|
||||
applicationMetric.setSourceValue(((Number)source.get(ApplicationMetricTable.COLUMN_SOURCE_VALUE)).intValue());
|
||||
|
||||
applicationMetric.setTransactionCalls(((Number)source.get(ApplicationMetricTable.COLUMN_TRANSACTION_CALLS)).longValue());
|
||||
applicationMetric.setTransactionErrorCalls(((Number)source.get(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)).longValue());
|
||||
applicationMetric.setTransactionDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_TRANSACTION_DURATION_SUM)).longValue());
|
||||
applicationMetric.setTransactionErrorDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)).longValue());
|
||||
|
||||
applicationMetric.setBusinessTransactionCalls(((Number)source.get(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)).longValue());
|
||||
applicationMetric.setBusinessTransactionErrorCalls(((Number)source.get(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)).longValue());
|
||||
applicationMetric.setBusinessTransactionDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)).longValue());
|
||||
applicationMetric.setBusinessTransactionErrorDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)).longValue());
|
||||
|
||||
applicationMetric.setMqTransactionCalls(((Number)source.get(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_CALLS)).longValue());
|
||||
applicationMetric.setMqTransactionErrorCalls(((Number)source.get(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)).longValue());
|
||||
applicationMetric.setMqTransactionDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)).longValue());
|
||||
applicationMetric.setMqTransactionErrorDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)).longValue());
|
||||
|
||||
applicationMetric.setSatisfiedCount(((Number)source.get(ApplicationMetricTable.COLUMN_SATISFIED_COUNT)).longValue());
|
||||
applicationMetric.setToleratingCount(((Number)source.get(ApplicationMetricTable.COLUMN_TOLERATING_COUNT)).longValue());
|
||||
applicationMetric.setFrustratedCount(((Number)source.get(ApplicationMetricTable.COLUMN_FRUSTRATED_COUNT)).longValue());
|
||||
applicationMetric.setTimeBucket(((Number)source.get(ApplicationMetricTable.COLUMN_TIME_BUCKET)).longValue());
|
||||
return applicationMetric;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public IndexRequestBuilder prepareBatchInsert(ApplicationMetric data) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ApplicationMetricTable.COLUMN_APPLICATION_ID, data.getApplicationId());
|
||||
source.put(ApplicationMetricTable.COLUMN_SOURCE_VALUE, data.getSourceValue());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum());
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum());
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum());
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_SATISFIED_COUNT, data.getSatisfiedCount());
|
||||
source.put(ApplicationMetricTable.COLUMN_TOLERATING_COUNT, data.getToleratingCount());
|
||||
source.put(ApplicationMetricTable.COLUMN_FRUSTRATED_COUNT, data.getFrustratedCount());
|
||||
source.put(ApplicationMetricTable.COLUMN_TIME_BUCKET, data.getTimeBucket());
|
||||
|
||||
return getClient().prepareIndex(ApplicationMetricTable.TABLE, data.getId()).setSource(source);
|
||||
}
|
||||
|
||||
@Override public UpdateRequestBuilder prepareBatchUpdate(ApplicationMetric data) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ApplicationMetricTable.COLUMN_APPLICATION_ID, data.getApplicationId());
|
||||
source.put(ApplicationMetricTable.COLUMN_SOURCE_VALUE, data.getSourceValue());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_CALLS, data.getTransactionCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, data.getTransactionErrorCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_DURATION_SUM, data.getTransactionDurationSum());
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, data.getTransactionErrorDurationSum());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, data.getBusinessTransactionCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, data.getBusinessTransactionErrorCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, data.getBusinessTransactionDurationSum());
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, data.getBusinessTransactionErrorDurationSum());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_CALLS, data.getMqTransactionCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, data.getMqTransactionErrorCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, data.getMqTransactionDurationSum());
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, data.getMqTransactionErrorDurationSum());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_SATISFIED_COUNT, data.getSatisfiedCount());
|
||||
source.put(ApplicationMetricTable.COLUMN_TOLERATING_COUNT, data.getToleratingCount());
|
||||
source.put(ApplicationMetricTable.COLUMN_FRUSTRATED_COUNT, data.getFrustratedCount());
|
||||
|
||||
return getClient().prepareUpdate(ApplicationMetricTable.TABLE, data.getId()).setDoc(source);
|
||||
}
|
||||
|
||||
@Override public void deleteHistory(Long startTimestamp, Long endTimestamp) {
|
||||
long startTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(startTimestamp);
|
||||
long endTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(endTimestamp);
|
||||
BulkByScrollResponse response = getClient().prepareDelete()
|
||||
.filter(QueryBuilders.rangeQuery(ApplicationMetricTable.COLUMN_TIME_BUCKET).gte(startTimeBucket).lte(endTimeBucket))
|
||||
.source(ApplicationMetricTable.TABLE)
|
||||
.get();
|
||||
|
||||
long deleted = response.getDeleted();
|
||||
logger.info("Delete {} rows history from {} index.", deleted, ApplicationMetricTable.TABLE);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* 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.storage.es.dao.amp;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.storage.es.base.dao.AbstractPersistenceEsDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public abstract class AbstractApplicationMetricEsPersistenceDAO extends AbstractPersistenceEsDAO<ApplicationMetric> {
|
||||
|
||||
AbstractApplicationMetricEsPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected final String timeBucketColumnNameForDelete() {
|
||||
return ApplicationMetricTable.COLUMN_TIME_BUCKET;
|
||||
}
|
||||
|
||||
@Override protected final ApplicationMetric esDataToStreamData(Map<String, Object> source) {
|
||||
ApplicationMetric applicationMetric = new ApplicationMetric();
|
||||
applicationMetric.setId((String)source.get(ApplicationMetricTable.COLUMN_ID));
|
||||
applicationMetric.setMetricId((String)source.get(ApplicationMetricTable.COLUMN_METRIC_ID));
|
||||
|
||||
applicationMetric.setApplicationId(((Number)source.get(ApplicationMetricTable.COLUMN_APPLICATION_ID)).intValue());
|
||||
applicationMetric.setSourceValue(((Number)source.get(ApplicationMetricTable.COLUMN_SOURCE_VALUE)).intValue());
|
||||
|
||||
applicationMetric.setTransactionCalls(((Number)source.get(ApplicationMetricTable.COLUMN_TRANSACTION_CALLS)).longValue());
|
||||
applicationMetric.setTransactionErrorCalls(((Number)source.get(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_CALLS)).longValue());
|
||||
applicationMetric.setTransactionDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_TRANSACTION_DURATION_SUM)).longValue());
|
||||
applicationMetric.setTransactionErrorDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM)).longValue());
|
||||
|
||||
applicationMetric.setBusinessTransactionCalls(((Number)source.get(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS)).longValue());
|
||||
applicationMetric.setBusinessTransactionErrorCalls(((Number)source.get(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS)).longValue());
|
||||
applicationMetric.setBusinessTransactionDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM)).longValue());
|
||||
applicationMetric.setBusinessTransactionErrorDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM)).longValue());
|
||||
|
||||
applicationMetric.setMqTransactionCalls(((Number)source.get(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_CALLS)).longValue());
|
||||
applicationMetric.setMqTransactionErrorCalls(((Number)source.get(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS)).longValue());
|
||||
applicationMetric.setMqTransactionDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM)).longValue());
|
||||
applicationMetric.setMqTransactionErrorDurationSum(((Number)source.get(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM)).longValue());
|
||||
|
||||
applicationMetric.setSatisfiedCount(((Number)source.get(ApplicationMetricTable.COLUMN_SATISFIED_COUNT)).longValue());
|
||||
applicationMetric.setToleratingCount(((Number)source.get(ApplicationMetricTable.COLUMN_TOLERATING_COUNT)).longValue());
|
||||
applicationMetric.setFrustratedCount(((Number)source.get(ApplicationMetricTable.COLUMN_FRUSTRATED_COUNT)).longValue());
|
||||
applicationMetric.setTimeBucket(((Number)source.get(ApplicationMetricTable.COLUMN_TIME_BUCKET)).longValue());
|
||||
|
||||
return applicationMetric;
|
||||
}
|
||||
|
||||
@Override protected final Map<String, Object> esStreamDataToEsData(ApplicationMetric streamData) {
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put(ApplicationMetricTable.COLUMN_ID, streamData.getId());
|
||||
source.put(ApplicationMetricTable.COLUMN_METRIC_ID, streamData.getMetricId());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_APPLICATION_ID, streamData.getApplicationId());
|
||||
source.put(ApplicationMetricTable.COLUMN_SOURCE_VALUE, streamData.getSourceValue());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_CALLS, streamData.getTransactionCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, streamData.getTransactionErrorCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_DURATION_SUM, streamData.getTransactionDurationSum());
|
||||
source.put(ApplicationMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, streamData.getTransactionErrorDurationSum());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_CALLS, streamData.getBusinessTransactionCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_CALLS, streamData.getBusinessTransactionErrorCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_DURATION_SUM, streamData.getBusinessTransactionDurationSum());
|
||||
source.put(ApplicationMetricTable.COLUMN_BUSINESS_TRANSACTION_ERROR_DURATION_SUM, streamData.getBusinessTransactionErrorDurationSum());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_CALLS, streamData.getMqTransactionCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_CALLS, streamData.getMqTransactionErrorCalls());
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_DURATION_SUM, streamData.getMqTransactionDurationSum());
|
||||
source.put(ApplicationMetricTable.COLUMN_MQ_TRANSACTION_ERROR_DURATION_SUM, streamData.getMqTransactionErrorDurationSum());
|
||||
|
||||
source.put(ApplicationMetricTable.COLUMN_SATISFIED_COUNT, streamData.getSatisfiedCount());
|
||||
source.put(ApplicationMetricTable.COLUMN_TOLERATING_COUNT, streamData.getToleratingCount());
|
||||
source.put(ApplicationMetricTable.COLUMN_FRUSTRATED_COUNT, streamData.getFrustratedCount());
|
||||
source.put(ApplicationMetricTable.COLUMN_TIME_BUCKET, streamData.getTimeBucket());
|
||||
|
||||
return source;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.es.dao.amp;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationDayMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.update.UpdateRequestBuilder;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationDayMetricEsPersistenceDAO extends AbstractApplicationMetricEsPersistenceDAO implements IApplicationDayMetricPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationMetric> {
|
||||
|
||||
public ApplicationDayMetricEsPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Day.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.es.dao.amp;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationHourMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.update.UpdateRequestBuilder;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationHourMetricEsPersistenceDAO extends AbstractApplicationMetricEsPersistenceDAO implements IApplicationHourMetricPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationMetric> {
|
||||
|
||||
public ApplicationHourMetricEsPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Hour.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.es.dao.amp;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.update.UpdateRequestBuilder;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationMinuteMetricEsPersistenceDAO extends AbstractApplicationMetricEsPersistenceDAO implements IApplicationMinuteMetricPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationMetric> {
|
||||
|
||||
public ApplicationMinuteMetricEsPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Minute.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.es.dao.amp;
|
||||
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.storage.TimePyramid;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMonthMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetricTable;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.update.UpdateRequestBuilder;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationMonthMetricEsPersistenceDAO extends AbstractApplicationMetricEsPersistenceDAO implements IApplicationMonthMetricPersistenceDAO<IndexRequestBuilder, UpdateRequestBuilder, ApplicationMetric> {
|
||||
|
||||
public ApplicationMonthMetricEsPersistenceDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
@Override protected String tableName() {
|
||||
return ApplicationMetricTable.TABLE + Const.ID_SPLIT + TimePyramid.Month.getName();
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentPers
|
|||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationComponentUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMappingUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmListPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationReferenceAlarmPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.armp.IApplicationReferenceMinuteMetricPersistenceDAO;
|
||||
|
|
@ -89,7 +89,7 @@ import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationH2CacheDAO;
|
|||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationH2RegisterDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMappingH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMappingH2UIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationMinuteMetricH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceAlarmH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceAlarmListH2PersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.dao.ApplicationReferenceMinuteMetricH2PersistenceDAO;
|
||||
|
|
@ -213,7 +213,7 @@ public class StorageModuleH2Provider extends ModuleProvider {
|
|||
this.registerServiceImplementation(IGlobalTracePersistenceDAO.class, new GlobalTraceH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(IApplicationComponentPersistenceDAO.class, new ApplicationComponentH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(IApplicationMappingPersistenceDAO.class, new ApplicationMappingH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(IApplicationMetricPersistenceDAO.class, new ApplicationMetricH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(IApplicationMinuteMetricPersistenceDAO.class, new ApplicationMinuteMetricH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(IApplicationReferenceMinuteMetricPersistenceDAO.class, new ApplicationReferenceMinuteMetricH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(ISegmentCostPersistenceDAO.class, new SegmentCostH2PersistenceDAO(h2Client));
|
||||
this.registerServiceImplementation(ISegmentPersistenceDAO.class, new SegmentH2PersistenceDAO(h2Client));
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.h2.H2Client;
|
||||
import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.IApplicationMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationMinuteMetricPersistenceDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
|
||||
import org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity;
|
||||
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
|
||||
|
|
@ -39,12 +39,12 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* @author peng-yongsheng, clevertension
|
||||
*/
|
||||
public class ApplicationMetricH2PersistenceDAO extends H2DAO implements IApplicationMetricPersistenceDAO<H2SqlEntity, H2SqlEntity, ApplicationMetric> {
|
||||
public class ApplicationMinuteMetricH2PersistenceDAO extends H2DAO implements IApplicationMinuteMetricPersistenceDAO<H2SqlEntity, H2SqlEntity, ApplicationMetric> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ApplicationMetricH2PersistenceDAO.class);
|
||||
private final Logger logger = LoggerFactory.getLogger(ApplicationMinuteMetricH2PersistenceDAO.class);
|
||||
private static final String GET_SQL = "select * from {0} where {1} = ?";
|
||||
|
||||
public ApplicationMetricH2PersistenceDAO(H2Client client) {
|
||||
public ApplicationMinuteMetricH2PersistenceDAO(H2Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue