Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public class CoreModuleConfig extends ModuleConfig {
@Setter private int maxConcurrentCallsPerConnection;
@Setter private int maxMessageSize;
private final List<String> downsampling;
/**
* The period of doing data persistence.
* Unit is second.
*/
@Setter private long persistentPeriod = 3;
@Setter private boolean enableDataKeeperExecutor = true;
@Setter private int recordDataTTL;
@Setter private int minuteMetricsDataTTL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public CoreModuleProvider() {
this.getManager().find(ClusterModule.NAME).provider().getService(ClusterRegister.class).registerRemote(gRPCServerInstance);
}

PersistenceTimer.INSTANCE.start(getManager());
PersistenceTimer.INSTANCE.start(getManager(), moduleConfig);

if (moduleConfig.isEnableDataKeeperExecutor()) {
DataTTLKeeperTimer.INSTANCE.start(getManager());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.*;
import java.util.concurrent.*;
import org.apache.skywalking.apm.util.RunnableWithExceptionProtection;
import org.apache.skywalking.oap.server.core.CoreModuleConfig;
import org.apache.skywalking.oap.server.core.analysis.worker.*;
import org.apache.skywalking.oap.server.library.module.ModuleManager;
import org.apache.skywalking.oap.server.telemetry.TelemetryModule;
Expand All @@ -45,11 +46,8 @@ public enum PersistenceTimer {
this.debug = System.getProperty("debug") != null;
}

public void start(ModuleManager moduleManager) {
public void start(ModuleManager moduleManager, CoreModuleConfig moduleConfig) {
logger.info("persistence timer start");
//TODO timer value config
// final long timeInterval = EsConfig.Es.Persistence.Timer.VALUE * 1000;
final long timeInterval = 3;
IBatchDAO batchDAO = moduleManager.find(StorageModule.NAME).provider().getService(IBatchDAO.class);

MetricsCreator metricsCreator = moduleManager.find(TelemetryModule.NAME).provider().getService(MetricsCreator.class);
Expand All @@ -63,7 +61,7 @@ public void start(ModuleManager moduleManager) {
if (!isStarted) {
Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(
new RunnableWithExceptionProtection(() -> extractDataAndSave(batchDAO),
t -> logger.error("Extract data and save failure.", t)), 1, timeInterval, TimeUnit.SECONDS);
t -> logger.error("Extract data and save failure.", t)), 1, moduleConfig.getPersistentPeriod(), TimeUnit.SECONDS);

this.isStarted = true;
}
Expand Down