You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@skywalking.apache.org by GitBox <gi...@apache.org> on 2018/08/19 14:46:24 UTC

[GitHub] wu-sheng closed pull request #2: Build the primary key.

wu-sheng closed pull request #2: Build the primary key.
URL: https://github.com/apache/incubator-skywalking-oal-tool/pull/2
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl b/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
index 25d56c7..5721686 100644
--- a/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
+++ b/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
@@ -20,6 +20,7 @@ package org.apache.skywalking.oap.server.core.analysis.generated.${packageName};
 
 import java.util.*;
 import lombok.*;
+import org.apache.skywalking.oap.server.core.Const;
 import org.apache.skywalking.oap.server.core.analysis.indicator.*;
 import org.apache.skywalking.oap.server.core.analysis.indicator.annotation.IndicatorType;
 import org.apache.skywalking.oap.server.core.remote.annotation.StreamData;
@@ -42,7 +43,13 @@ public class ${metricName}Indicator extends ${indicatorClassName} {
 </#list>
 
     @Override public String id() {
-        return String.valueOf(id);
+        String splitJointId = String.valueOf(getTimeBucket());
+<#list fieldsFromSource as sourceField>
+    <#if sourceField.isID()>
+        splitJointId += Const.ID_SPLIT + String.valueOf(${sourceField.fieldName});
+    </#if>
+</#list>
+        return splitJointId;
     }
 
     @Override public int hashCode() {
diff --git a/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java b/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
index 323ea61..159de30 100644
--- a/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
+++ b/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
@@ -20,6 +20,7 @@
 
 import java.util.*;
 import lombok.*;
+import org.apache.skywalking.oap.server.core.Const;
 import org.apache.skywalking.oap.server.core.analysis.indicator.*;
 import org.apache.skywalking.oap.server.core.analysis.indicator.annotation.IndicatorType;
 import org.apache.skywalking.oap.server.core.remote.annotation.StreamData;
@@ -40,7 +41,9 @@
     @Setter @Getter @Column(columnName = "id") private int id;
 
     @Override public String id() {
-        return String.valueOf(id);
+        String splitJointId = String.valueOf(getTimeBucket());
+        splitJointId += Const.ID_SPLIT + String.valueOf(id);
+        return splitJointId;
     }
 
     @Override public int hashCode() {


 

----------------------------------------------------------------
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