You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2018/11/29 00:54:11 UTC

[GitHub] liliang8858 commented on a change in pull request #1268: Separated TTL from minute to minute, hour, day, month.

liliang8858 commented on a change in pull request #1268: Separated TTL from minute to minute, hour, day, month.
URL: https://github.com/apache/incubator-skywalking/pull/1268#discussion_r237319112
 
 

 ##########
 File path: apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/DataTTLKeeperTimer.java
 ##########
 @@ -51,190 +50,181 @@
     private final ModuleManager moduleManager;
     private final StorageModuleEsNamingListener namingListener;
     private final String selfAddress;
-    private final int daysBefore;
+    private int minuteMetricDataTTL = 45;
+    private int hourMetricDataTTL = 36;
+    private int dayMetricDataTTL = 45;
+    private int monthMetricDataTTL = 18;
 
     DataTTLKeeperTimer(ModuleManager moduleManager,
-        StorageModuleEsNamingListener namingListener, String selfAddress, int daysBefore) {
+        StorageModuleEsNamingListener namingListener, String selfAddress) {
         this.moduleManager = moduleManager;
         this.namingListener = namingListener;
         this.selfAddress = selfAddress;
-        this.daysBefore = daysBefore;
     }
 
     void start() {
         Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(
             new RunnableWithExceptionProtection(this::delete,
-                t -> logger.error("Remove data in background failure.", t)), 1, 8, TimeUnit.HOURS);
+                t -> logger.error("Remove data in background failure.", t)), 1, 5, TimeUnit.MINUTES);
     }
 
     private void delete() {
-        if (!namingListener.getAddresses().iterator().next().equals(selfAddress)) {
+        String firstAddressInCluster = namingListener.getAddresses().iterator().next();
+        if (!firstAddressInCluster.equals(selfAddress)) {
+            logger.info("Self address is {}, first address in cluster is {}, not same, skip.", selfAddress, firstAddressInCluster);
             return;
         }
 
-        TimeBuckets timeBuckets = convertTimeBucket();
+        TimeBuckets timeBuckets = convertTimeBucket(new DateTime());
+        logger.info("Beginning automatically removed metric data from the storage which they were expires");
 
 Review comment:
   for always
   ` Beginning to remove expired metrics from the storage.
    Metrics in minute dimension before 201811290715, are going to be removed.
   Metrics in hour dimension before 2018112720, are going to be removed.
   Metrics in day dimension before 20181015, are going to be removed.
    Metrics in month dimension before 201705, are going to be removed.`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services