ApplicationDayMetricPersistenceWorker.java 2.7 KB
Newer Older
P
peng-yongsheng 已提交
1
/*
wu-sheng's avatar
wu-sheng 已提交
2 3 4 5 6 7
 * 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
P
peng-yongsheng 已提交
8 9 10 11 12 13 14 15 16 17 18
 *
 *     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.
 *
 */

19
package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.application.metric;
20

P
peng-yongsheng 已提交
21
import org.apache.skywalking.apm.collector.analysis.metric.define.graph.MetricWorkerIdDefine;
P
peng-yongsheng 已提交
22
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorker;
P
peng-yongsheng 已提交
23
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.PersistenceWorkerProvider;
24
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
P
peng-yongsheng 已提交
25
import org.apache.skywalking.apm.collector.storage.StorageModule;
26
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
27
import org.apache.skywalking.apm.collector.storage.dao.amp.IApplicationDayMetricPersistenceDAO;
28
import org.apache.skywalking.apm.collector.storage.table.application.ApplicationMetric;
P
peng-yongsheng 已提交
29 30 31 32

/**
 * @author peng-yongsheng
 */
33
public class ApplicationDayMetricPersistenceWorker extends PersistenceWorker<ApplicationMetric> {
P
peng-yongsheng 已提交
34

35
    public ApplicationDayMetricPersistenceWorker(ModuleManager moduleManager) {
P
peng-yongsheng 已提交
36
        super(moduleManager);
P
peng-yongsheng 已提交
37 38 39
    }

    @Override public int id() {
40
        return MetricWorkerIdDefine.APPLICATION_DAY_METRIC_PERSISTENCE_WORKER_ID;
P
peng-yongsheng 已提交
41 42
    }

P
peng-yongsheng 已提交
43 44
    @SuppressWarnings("unchecked")
    @Override protected IPersistenceDAO<?, ?, ApplicationMetric> persistenceDAO() {
45
        return getModuleManager().find(StorageModule.NAME).getService(IApplicationDayMetricPersistenceDAO.class);
P
peng-yongsheng 已提交
46 47
    }

P
peng-yongsheng 已提交
48 49
    @Override protected boolean needMergeDBData() {
        return true;
P
peng-yongsheng 已提交
50 51
    }

52
    public static class Factory extends PersistenceWorkerProvider<ApplicationMetric, ApplicationDayMetricPersistenceWorker> {
P
peng-yongsheng 已提交
53

P
peng-yongsheng 已提交
54 55
        public Factory(ModuleManager moduleManager) {
            super(moduleManager);
P
peng-yongsheng 已提交
56 57
        }

58 59
        @Override public ApplicationDayMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
            return new ApplicationDayMetricPersistenceWorker(moduleManager);
P
peng-yongsheng 已提交
60 61 62 63 64 65 66 67
        }

        @Override
        public int queueSize() {
            return 1024;
        }
    }
}