CC @peng-yongsheng Adjust the codes generator to match new stream process module.
diff --git a/oal-parser/src/main/java/org/apache/skywalking/oal/tool/output/FileGenerator.java b/oal-parser/src/main/java/org/apache/skywalking/oal/tool/output/FileGenerator.java
index dcf25b3..2baed7a 100644
--- a/oal-parser/src/main/java/org/apache/skywalking/oal/tool/output/FileGenerator.java
+++ b/oal-parser/src/main/java/org/apache/skywalking/oal/tool/output/FileGenerator.java
@@ -46,10 +46,7 @@
public void generate() throws IOException, TemplateException {
for (AnalysisResult result : results) {
- generate(result, "AggregateWorker.java", (writer) -> generateAggregateWorker(result, writer));
generate(result, "Indicator.java", (writer) -> generateIndicatorImplementor(result, writer));
- generate(result, "PersistentWorker.java", (writer) -> generatePersistentWorker(result, writer));
- generate(result, "RemoteWorker.java", (writer) -> generateRemoteWorker(result, writer));
}
File file = new File(outputPath, "generated/service/ServiceDispatcher.java");
@@ -90,18 +87,6 @@
+ result.getMetricName() + suffix;
}
- void generateAggregateWorker(AnalysisResult result, Writer output) throws IOException, TemplateException {
- configuration.getTemplate("AggregateWorkerTemplate.ftl").process(result, output);
- }
-
- void generateRemoteWorker(AnalysisResult result, Writer output) throws IOException, TemplateException {
- configuration.getTemplate("RemoteWorkerTemplate.ftl").process(result, output);
- }
-
- void generatePersistentWorker(AnalysisResult result, Writer output) throws IOException, TemplateException {
- configuration.getTemplate("PersistentWorkerTemplate.ftl").process(result, output);
- }
-
void generateIndicatorImplementor(AnalysisResult result, Writer output) throws IOException, TemplateException {
configuration.getTemplate("IndicatorImplementor.ftl").process(result, output);
}
diff --git a/oal-parser/src/main/resources/code-templates/AggregateWorkerTemplate.ftl b/oal-parser/src/main/resources/code-templates/AggregateWorkerTemplate.ftl
deleted file mode 100644
index b46405e..0000000
--- a/oal-parser/src/main/resources/code-templates/AggregateWorkerTemplate.ftl
+++ /dev/null
@@ -1,38 +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.oap.server.core.analysis.generated.${packageName};
-
-import org.apache.skywalking.oap.server.core.analysis.worker.AbstractAggregatorWorker;
-import org.apache.skywalking.oap.server.library.module.ModuleManager;
-
-/**
- * This class is auto generated. Please don't change this class manually.
- *
- * @author Observability Analysis Language code generator
- */
-public class ${metricName}AggregateWorker extends AbstractAggregatorWorker<${metricName}Indicator> {
-
- public ${metricName}AggregateWorker(ModuleManager moduleManager) {
- super(moduleManager);
- }
-
- @Override public Class nextWorkerClass() {
- return ${metricName}RemoteWorker.class;
- }
-}
diff --git a/oal-parser/src/main/resources/code-templates/EndpointDispatcherTemplate.ftl b/oal-parser/src/main/resources/code-templates/EndpointDispatcherTemplate.ftl
index 26bd867..03c9aae 100644
--- a/oal-parser/src/main/resources/code-templates/EndpointDispatcherTemplate.ftl
+++ b/oal-parser/src/main/resources/code-templates/EndpointDispatcherTemplate.ftl
@@ -18,11 +18,9 @@
package org.apache.skywalking.oap.server.core.analysis.generated;
-import org.apache.skywalking.oap.server.core.CoreModule;
import org.apache.skywalking.oap.server.core.analysis.SourceDispatcher;
-import org.apache.skywalking.oap.server.core.analysis.worker.define.WorkerMapper;
+import org.apache.skywalking.oap.server.core.analysis.worker.IndicatorProcess;
import org.apache.skywalking.oap.server.core.source.Endpoint;
-import org.apache.skywalking.oap.server.library.module.ModuleManager;
/**
* This class is auto generated. Please don't change this class manually.
@@ -31,14 +29,6 @@
*/
public class EndpointDispatcher implements SourceDispatcher<Endpoint> {
- private final ModuleManager moduleManager;
-<#list endpointIndicators as indicator>
- private ${indicator.metricName}AggregateWorker ${indicator.metricName};
-</#list>
-
- public ServiceDispatcher(ModuleManager moduleManager) {
- this.moduleManager = moduleManager;
- }
@Override public void dispatch(Service source) {
<#list endpointIndicators as indicator>
@@ -48,12 +38,7 @@
<#list endpointIndicators as indicator>
private void do${indicator.metricName}(Service source) {
- if (avgAggregator == null) {
- WorkerMapper workerMapper = moduleManager.find(CoreModule.NAME).getService(WorkerMapper.class);
- avgAggregator = (${indicator.metricName}AggregateWorker)workerMapper.findInstanceByClass(${indicator.metricName}AggregateWorker.class);
- }
-
- ${indicator.metricName}Indicator indicator = new ${indicator.metricName}Indicator();
+ ${indicator.metricName}Indicator indicator = new ${indicator.metricName}Indicator();
indicator.setTimeBucket(source.getTimeBucket());
<#list indicator.fieldsFromSource as field>
@@ -61,7 +46,7 @@
</#list>
indicator.${indicator.entryMethod.methodName}(
<#list indicator.entryMethod.argsExpressions as arg>${arg}<#if arg_has_next>, </#if></#list>);
- avgAggregator.in(indicator);
+ IndicatorProcess.INSTANCE.in(indicator);
}
</#list>
}
diff --git a/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl b/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
index b4a8453..e38d7c4 100644
--- a/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
+++ b/oal-parser/src/main/resources/code-templates/IndicatorImplementor.ftl
@@ -21,6 +21,7 @@
import java.util.*;
import lombok.*;
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;
import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData;
import org.apache.skywalking.oap.server.core.storage.annotation.*;
@@ -30,8 +31,9 @@
*
* @author Observability Analysis Language code generator
*/
+@IndicatorType
@StreamData
-@StorageEntity(name = "${tableName}")
+@StorageEntity(name = "${tableName}", builder = ${metricName}Indicator.Builder.class)
public class ${metricName}Indicator extends ${indicatorClassName} {
<#list fieldsFromSource as sourceField>
@@ -119,25 +121,28 @@
</#list>
}
- @Override public Map<String, Object> toMap() {
- Map<String, Object> map = new HashMap<>();
-<#list fieldsFromSource as field>
- map.put("${field.columnName}", ${field.fieldGetter}());
-</#list>
-<#list persistentFields as field>
- map.put("${field.columnName}", ${field.fieldGetter}());
-</#list>
- return map;
- }
+ static class Builder implements StorageBuilder<${metricName}Indicator> {
- @Override public Indicator newOne(Map<String, Object> dbMap) {
- ${metricName}Indicator indicator = new ${metricName}Indicator();
-<#list fieldsFromSource as field>
- indicator.${field.fieldSetter}((${field.typeName})dbMap.get("${field.columnName}"));
-</#list>
-<#list persistentFields as field>
- indicator.${field.fieldSetter}((${field.typeName})dbMap.get("${field.columnName}"));
-</#list>
- return indicator;
+ @Override public Map<String, Object> data2Map(${metricName}Indicator storageData) {
+ Map<String, Object> map = new HashMap<>();
+ <#list fieldsFromSource as field>
+ map.put("${field.columnName}", storageData.${field.fieldGetter}());
+ </#list>
+ <#list persistentFields as field>
+ map.put("${field.columnName}", storageData.${field.fieldGetter}());
+ </#list>
+ return map;
+ }
+
+ @Override public ${metricName}Indicator map2Data(Map<String, Object> dbMap) {
+ ${metricName}Indicator indicator = new ${metricName}Indicator();
+ <#list fieldsFromSource as field>
+ indicator.${field.fieldSetter}((${field.typeName})dbMap.get("${field.columnName}"));
+ </#list>
+ <#list persistentFields as field>
+ indicator.${field.fieldSetter}((${field.typeName})dbMap.get("${field.columnName}"));
+ </#list>
+ return indicator;
+ }
}
}
diff --git a/oal-parser/src/main/resources/code-templates/PersistentWorkerTemplate.ftl b/oal-parser/src/main/resources/code-templates/PersistentWorkerTemplate.ftl
deleted file mode 100644
index 4c7848d..0000000
--- a/oal-parser/src/main/resources/code-templates/PersistentWorkerTemplate.ftl
+++ /dev/null
@@ -1,38 +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.oap.server.core.analysis.generated.${packageName};
-
-import org.apache.skywalking.oap.server.core.analysis.worker.AbstractPersistentWorker;
-import org.apache.skywalking.oap.server.library.module.ModuleManager;
-
-/**
- * This class is auto generated. Please don't change this class manually.
- *
- * @author Observability Analysis Language code generator
- */
-public class ${metricName}PersistentWorker extends AbstractPersistentWorker<${metricName}Indicator> {
-
- public ${metricName}PersistentWorker(ModuleManager moduleManager) {
- super(moduleManager);
- }
-
- @Override protected boolean needMergeDBData() {
- return ${needMerge?then('true', 'false')};
- }
-}
diff --git a/oal-parser/src/main/resources/code-templates/RemoteWorkerTemplate.ftl b/oal-parser/src/main/resources/code-templates/RemoteWorkerTemplate.ftl
deleted file mode 100644
index 2156548..0000000
--- a/oal-parser/src/main/resources/code-templates/RemoteWorkerTemplate.ftl
+++ /dev/null
@@ -1,43 +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.oap.server.core.analysis.generated.${packageName};
-
-import org.apache.skywalking.oap.server.core.analysis.worker.AbstractRemoteWorker;
-import org.apache.skywalking.oap.server.core.remote.selector.Selector;
-import org.apache.skywalking.oap.server.library.module.ModuleManager;
-
-/**
- * This class is auto generated. Please don't change this class manually.
- *
- * @author Observability Analysis Language code generator
- */
-public class ${metricName}RemoteWorker extends AbstractRemoteWorker<${metricName}Indicator> {
-
- public ${metricName}RemoteWorker(ModuleManager moduleManager) {
- super(moduleManager);
- }
-
- @Override public Selector selector() {
- return Selector.${remoteSelector};
- }
-
- @Override public Class nextWorkerClass() {
- return ${metricName}PersistentWorker.class;
- }
-}
diff --git a/oal-parser/src/main/resources/code-templates/ServiceDispatcherTemplate.ftl b/oal-parser/src/main/resources/code-templates/ServiceDispatcherTemplate.ftl
index a1d6705..04b38ef 100644
--- a/oal-parser/src/main/resources/code-templates/ServiceDispatcherTemplate.ftl
+++ b/oal-parser/src/main/resources/code-templates/ServiceDispatcherTemplate.ftl
@@ -18,11 +18,9 @@
package org.apache.skywalking.oap.server.core.analysis.generated;
-import org.apache.skywalking.oap.server.core.CoreModule;
import org.apache.skywalking.oap.server.core.analysis.SourceDispatcher;
-import org.apache.skywalking.oap.server.core.analysis.worker.define.WorkerMapper;
+import org.apache.skywalking.oap.server.core.analysis.worker.IndicatorProcess;
import org.apache.skywalking.oap.server.core.source.Service;
-import org.apache.skywalking.oap.server.library.module.ModuleManager;
/**
* This class is auto generated. Please don't change this class manually.
@@ -30,16 +28,6 @@
* @author Observability Analysis Language code generator
*/
public class ServiceDispatcher implements SourceDispatcher<Service> {
-
- private final ModuleManager moduleManager;
-<#list serviceIndicators as indicator>
- private ${indicator.metricName}AggregateWorker ${indicator.metricName};
-</#list>
-
- public ServiceDispatcher(ModuleManager moduleManager) {
- this.moduleManager = moduleManager;
- }
-
@Override public void dispatch(Service source) {
<#list serviceIndicators as indicator>
do${indicator.metricName}(source);
@@ -48,11 +36,6 @@
<#list serviceIndicators as indicator>
private void do${indicator.metricName}(Service source) {
- if (avgAggregator == null) {
- WorkerMapper workerMapper = moduleManager.find(CoreModule.NAME).getService(WorkerMapper.class);
- avgAggregator = (${indicator.metricName}AggregateWorker)workerMapper.findInstanceByClass(${indicator.metricName}AggregateWorker.class);
- }
-
${indicator.metricName}Indicator indicator = new ${indicator.metricName}Indicator();
indicator.setTimeBucket(source.getTimeBucket());
diff --git a/oal-parser/src/test/java/org/apache/skywalking/oal/tool/output/FileGeneratorTest.java b/oal-parser/src/test/java/org/apache/skywalking/oal/tool/output/FileGeneratorTest.java
index b8d04d9..1320e3e 100644
--- a/oal-parser/src/test/java/org/apache/skywalking/oal/tool/output/FileGeneratorTest.java
+++ b/oal-parser/src/test/java/org/apache/skywalking/oal/tool/output/FileGeneratorTest.java
@@ -60,52 +60,6 @@
}
@Test
- public void testGenerateAggregateWorker() throws IOException, TemplateException {
- AnalysisResult result = buildResult();
- List<AnalysisResult> results = new LinkedList<>();
- results.add(result);
-
- FileGenerator fileGenerator = new FileGenerator(results, ".");
-
- StringWriter writer = new StringWriter();
- fileGenerator.generateAggregateWorker(result, writer);
-
- Assert.assertEquals(readExpectedFile("AggregateWorkerExpected.java"), writer.toString());
- }
-
- @Test
- public void testGenerateRemoteWorker() throws IOException, TemplateException {
- AnalysisResult result = buildResult();
-
- List<AnalysisResult> results = new LinkedList<>();
- results.add(result);
-
- FileGenerator fileGenerator = new FileGenerator(results, ".");
- StringWriter writer = new StringWriter();
- fileGenerator.generateRemoteWorker(result, writer);
-
- Assert.assertEquals(readExpectedFile("RemoteWorkerExpected.java"), writer.toString());
-
- //fileGenerator.generateRemoteWorker(result, new OutputStreamWriter(System.out));
- }
-
- @Test
- public void testGeneratePersistentWorker() throws IOException, TemplateException {
- AnalysisResult result = buildResult();
-
- List<AnalysisResult> results = new LinkedList<>();
- results.add(result);
-
- FileGenerator fileGenerator = new FileGenerator(results, ".");
- StringWriter writer = new StringWriter();
- fileGenerator.generatePersistentWorker(result, writer);
-
- Assert.assertEquals(readExpectedFile("PersistentWorkerExpected.java"), writer.toString());
-
- //fileGenerator.generatePersistentWorker(result, new OutputStreamWriter(System.out));
- }
-
- @Test
public void testGenerateIndicatorImplementor() throws IOException, TemplateException {
AnalysisResult result = buildResult();
diff --git a/oal-parser/src/test/resources/expectedFiles/AggregateWorkerExpected.java b/oal-parser/src/test/resources/expectedFiles/AggregateWorkerExpected.java
deleted file mode 100644
index 320ce9c..0000000
--- a/oal-parser/src/test/resources/expectedFiles/AggregateWorkerExpected.java
+++ /dev/null
@@ -1,38 +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.oap.server.core.analysis.generated.service.serviceavg;
-
-import org.apache.skywalking.oap.server.core.analysis.worker.AbstractAggregatorWorker;
-import org.apache.skywalking.oap.server.library.module.ModuleManager;
-
-/**
- * This class is auto generated. Please don't change this class manually.
- *
- * @author Observability Analysis Language code generator
- */
-public class ServiceAvgAggregateWorker extends AbstractAggregatorWorker<ServiceAvgIndicator> {
-
- public ServiceAvgAggregateWorker(ModuleManager moduleManager) {
- super(moduleManager);
- }
-
- @Override public Class nextWorkerClass() {
- return ServiceAvgRemoteWorker.class;
- }
-}
\ No newline at end of file
diff --git a/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java b/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
index 8b6c2c6..a6feedc 100644
--- a/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
+++ b/oal-parser/src/test/resources/expectedFiles/IndicatorImplementorExpected.java
@@ -21,6 +21,7 @@
import java.util.*;
import lombok.*;
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;
import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData;
import org.apache.skywalking.oap.server.core.storage.annotation.*;
@@ -30,8 +31,9 @@
*
* @author Observability Analysis Language code generator
*/
+@IndicatorType
@StreamData
-@StorageEntity(name = "service_avg")
+@StorageEntity(name = "service_avg", builder = ServiceAvgIndicator.Builder.class)
public class ServiceAvgIndicator extends AvgIndicator {
@Setter @Getter @Column(columnName = "id") private int id;
@@ -95,21 +97,24 @@
setCount(remoteData.getDataIntegers(1));
}
- @Override public Map<String, Object> toMap() {
- Map<String, Object> map = new HashMap<>();
- map.put("id", getId());
- map.put("summation", getSummation());
- map.put("count", getCount());
- map.put("value", getValue());
- return map;
- }
+ static class Builder implements StorageBuilder<ServiceAvgIndicator> {
- @Override public Indicator newOne(Map<String, Object> dbMap) {
- ServiceAvgIndicator indicator = new ServiceAvgIndicator();
- indicator.setId((int)dbMap.get("id"));
- indicator.setSummation((long)dbMap.get("summation"));
- indicator.setCount((int)dbMap.get("count"));
- indicator.setValue((long)dbMap.get("value"));
- return indicator;
+ @Override public Map<String, Object> data2Map(ServiceAvgIndicator storageData) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("id", storageData.getId());
+ map.put("summation", storageData.getSummation());
+ map.put("count", storageData.getCount());
+ map.put("value", storageData.getValue());
+ return map;
+ }
+
+ @Override public ServiceAvgIndicator map2Data(Map<String, Object> dbMap) {
+ ServiceAvgIndicator indicator = new ServiceAvgIndicator();
+ indicator.setId((int)dbMap.get("id"));
+ indicator.setSummation((long)dbMap.get("summation"));
+ indicator.setCount((int)dbMap.get("count"));
+ indicator.setValue((long)dbMap.get("value"));
+ return indicator;
+ }
}
-}
\ No newline at end of file
+}
diff --git a/oal-parser/src/test/resources/expectedFiles/PersistentWorkerExpected.java b/oal-parser/src/test/resources/expectedFiles/PersistentWorkerExpected.java
deleted file mode 100644
index 81950a5..0000000
--- a/oal-parser/src/test/resources/expectedFiles/PersistentWorkerExpected.java
+++ /dev/null
@@ -1,38 +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.oap.server.core.analysis.generated.service.serviceavg;
-
-import org.apache.skywalking.oap.server.core.analysis.worker.AbstractPersistentWorker;
-import org.apache.skywalking.oap.server.library.module.ModuleManager;
-
-/**
- * This class is auto generated. Please don't change this class manually.
- *
- * @author Observability Analysis Language code generator
- */
-public class ServiceAvgPersistentWorker extends AbstractPersistentWorker<ServiceAvgIndicator> {
-
- public ServiceAvgPersistentWorker(ModuleManager moduleManager) {
- super(moduleManager);
- }
-
- @Override protected boolean needMergeDBData() {
- return true;
- }
-}
\ No newline at end of file
diff --git a/oal-parser/src/test/resources/expectedFiles/RemoteWorkerExpected.java b/oal-parser/src/test/resources/expectedFiles/RemoteWorkerExpected.java
deleted file mode 100644
index 3fef183..0000000
--- a/oal-parser/src/test/resources/expectedFiles/RemoteWorkerExpected.java
+++ /dev/null
@@ -1,43 +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.oap.server.core.analysis.generated.service.serviceavg;
-
-import org.apache.skywalking.oap.server.core.analysis.worker.AbstractRemoteWorker;
-import org.apache.skywalking.oap.server.core.remote.selector.Selector;
-import org.apache.skywalking.oap.server.library.module.ModuleManager;
-
-/**
- * This class is auto generated. Please don't change this class manually.
- *
- * @author Observability Analysis Language code generator
- */
-public class ServiceAvgRemoteWorker extends AbstractRemoteWorker<ServiceAvgIndicator> {
-
- public ServiceAvgRemoteWorker(ModuleManager moduleManager) {
- super(moduleManager);
- }
-
- @Override public Selector selector() {
- return Selector.HashCode;
- }
-
- @Override public Class nextWorkerClass() {
- return ServiceAvgPersistentWorker.class;
- }
-}
\ No newline at end of file
diff --git a/oal-parser/src/test/resources/expectedFiles/ServiceDispatcherExpected.java b/oal-parser/src/test/resources/expectedFiles/ServiceDispatcherExpected.java
index f581152..a01492e 100644
--- a/oal-parser/src/test/resources/expectedFiles/ServiceDispatcherExpected.java
+++ b/oal-parser/src/test/resources/expectedFiles/ServiceDispatcherExpected.java
@@ -18,11 +18,9 @@
package org.apache.skywalking.oap.server.core.analysis.generated;
-import org.apache.skywalking.oap.server.core.CoreModule;
import org.apache.skywalking.oap.server.core.analysis.SourceDispatcher;
-import org.apache.skywalking.oap.server.core.analysis.worker.define.WorkerMapper;
+import org.apache.skywalking.oap.server.core.analysis.worker.IndicatorProcess;
import org.apache.skywalking.oap.server.core.source.Service;
-import org.apache.skywalking.oap.server.library.module.ModuleManager;
/**
* This class is auto generated. Please don't change this class manually.
@@ -30,24 +28,11 @@
* @author Observability Analysis Language code generator
*/
public class ServiceDispatcher implements SourceDispatcher<Service> {
-
- private final ModuleManager moduleManager;
- private ServiceAvgAggregateWorker ServiceAvg;
-
- public ServiceDispatcher(ModuleManager moduleManager) {
- this.moduleManager = moduleManager;
- }
-
@Override public void dispatch(Service source) {
doServiceAvg(source);
}
private void doServiceAvg(Service source) {
- if (avgAggregator == null) {
- WorkerMapper workerMapper = moduleManager.find(CoreModule.NAME).getService(WorkerMapper.class);
- avgAggregator = (ServiceAvgAggregateWorker)workerMapper.findInstanceByClass(ServiceAvgAggregateWorker.class);
- }
-
ServiceAvgIndicator indicator = new ServiceAvgIndicator();
indicator.setTimeBucket(source.getTimeBucket());
@@ -56,4 +41,4 @@
source.getLatency(), 1);
avgAggregator.in(indicator);
}
-}
\ No newline at end of file
+}