parent
37acc3dc99
commit
0df76e4e38
|
|
@ -18,10 +18,11 @@ Then it could be supported by OAL script and OAP core.
|
|||
|
||||
Such as existed source, **Service**.
|
||||
```java
|
||||
@ScopeDeclaration(id = SERVICE, name = "Service")
|
||||
public class Service extends Source {
|
||||
@ScopeDeclaration(id = SERVICE_INSTANCE, name = "ServiceInstance", catalog = SERVICE_INSTANCE_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class ServiceInstance extends Source {
|
||||
@Override public int scope() {
|
||||
return DefaultScopeDefine.SERVICE;
|
||||
return DefaultScopeDefine.SERVICE_INSTANCE;
|
||||
}
|
||||
|
||||
@Override public String getEntityId() {
|
||||
|
|
@ -29,8 +30,9 @@ public class Service extends Source {
|
|||
}
|
||||
|
||||
@Getter @Setter private int id;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private String serviceInstanceName;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private String endpointName;
|
||||
@Getter @Setter private int latency;
|
||||
@Getter @Setter private boolean status;
|
||||
|
|
@ -47,13 +49,15 @@ Such as,
|
|||
in this Service scope, the id is service id, representing a particular service, like `Order` service.
|
||||
This value is used in [OAL group mechanism](../concepts-and-designs/oal.md#group).
|
||||
|
||||
5. Add scope name as keyword to oal grammar definition file, `OALLexer.g4`, which is at `antlr4` folder of `generate-tool-grammar` module.
|
||||
5. `@ScopeDefaultColumn.VirtualColumnDefinition` and `@ScopeDefaultColumn.DefinedByField` are required, all declared fields(virtual/byField)
|
||||
are going to be pushed into persistent entity, mapping to such as ElasticSearch index and Database table column.
|
||||
Such as, include entity id mostly, and service id for endpoint and service instance level scope. Take a reference to all existing scopes.
|
||||
All these fields are detected by OAL Runtime, and required in query stage.
|
||||
|
||||
6. Add scope name keyword as source in parser definition file, `OALParser.g4`, which is at same fold of `OALLexer.g4`.
|
||||
6. Add scope name as keyword to oal grammar definition file, `OALLexer.g4`, which is at `antlr4` folder of `generate-tool-grammar` module.
|
||||
|
||||
7. Add scope name keyword as source in parser definition file, `OALParser.g4`, which is at same fold of `OALLexer.g4`.
|
||||
|
||||
7. Set the default columns for new scope, at `generator-scope-meta.yml` file in `generated-analysis/src/main/resources`.
|
||||
If you want to understand why need these columns, you have to understand all existing query(s). But there is an easy way,
|
||||
follow other existing scopes. Such as, if you are adding metrics, connection number for service instance, follow existing `ServiceInstance`.
|
||||
|
||||
___
|
||||
After you done all of these, you could build a receiver, which do
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ import javassist.bytecode.annotation.IntegerMemberValue;
|
|||
import javassist.bytecode.annotation.StringMemberValue;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.skywalking.apm.util.StringUtil;
|
||||
import org.apache.skywalking.oal.rt.meta.MetaReader;
|
||||
import org.apache.skywalking.oal.rt.meta.MetaSettings;
|
||||
import org.apache.skywalking.oal.rt.output.AllDispatcherContext;
|
||||
import org.apache.skywalking.oal.rt.output.DispatcherContext;
|
||||
import org.apache.skywalking.oal.rt.parser.AnalysisResult;
|
||||
|
|
@ -58,7 +56,6 @@ import org.apache.skywalking.oal.rt.parser.MetricsHolder;
|
|||
import org.apache.skywalking.oal.rt.parser.OALScripts;
|
||||
import org.apache.skywalking.oal.rt.parser.ScriptParser;
|
||||
import org.apache.skywalking.oal.rt.parser.SourceColumn;
|
||||
import org.apache.skywalking.oal.rt.parser.SourceColumnsFactory;
|
||||
import org.apache.skywalking.oap.server.core.WorkPath;
|
||||
import org.apache.skywalking.oap.server.core.analysis.DisableRegister;
|
||||
import org.apache.skywalking.oap.server.core.analysis.DispatcherDetectorListener;
|
||||
|
|
@ -131,15 +128,6 @@ public class OALRuntime implements OALEngine {
|
|||
|
||||
this.currentClassLoader = currentClassLoader;
|
||||
Reader read;
|
||||
try {
|
||||
read = ResourceUtils.read("scope-meta.yml");
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new ModuleStartException("Can't locate scope-meta.yml", e);
|
||||
}
|
||||
|
||||
MetaReader reader = new MetaReader();
|
||||
MetaSettings metaSettings = reader.read(read);
|
||||
SourceColumnsFactory.setSettings(metaSettings);
|
||||
|
||||
try {
|
||||
MetricsHolder.init();
|
||||
|
|
|
|||
|
|
@ -1,42 +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.oal.rt.meta;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
/**
|
||||
* @author wusheng
|
||||
*/
|
||||
public class MetaReader {
|
||||
public MetaSettings read(Reader reader) {
|
||||
Yaml yaml = new Yaml();
|
||||
MetaSettings settings = yaml.loadAs(reader, MetaSettings.class);
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
public MetaSettings read(InputStream reader) {
|
||||
Yaml yaml = new Yaml();
|
||||
MetaSettings settings = yaml.loadAs(reader, MetaSettings.class);
|
||||
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +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.oal.rt.meta;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* @author wusheng
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class MetaSettings {
|
||||
private List<ScopeMeta> scopes;
|
||||
}
|
||||
|
|
@ -1,33 +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.oal.rt.meta;
|
||||
|
||||
import java.util.*;
|
||||
import lombok.*;
|
||||
import org.apache.skywalking.oal.rt.parser.SourceColumn;
|
||||
|
||||
/**
|
||||
* @author wusheng
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class ScopeMeta {
|
||||
private String name;
|
||||
private List<SourceColumn> columns = new ArrayList<>();
|
||||
}
|
||||
|
|
@ -33,9 +33,6 @@ public class SourceColumn {
|
|||
private String fieldSetter;
|
||||
private String fieldGetter;
|
||||
|
||||
public SourceColumn() {
|
||||
}
|
||||
|
||||
public SourceColumn(String fieldName, String columnName, Class<?> type, boolean isID) {
|
||||
this.fieldName = fieldName;
|
||||
this.columnName = columnName;
|
||||
|
|
|
|||
|
|
@ -18,23 +18,22 @@
|
|||
|
||||
package org.apache.skywalking.oal.rt.parser;
|
||||
|
||||
import java.util.*;
|
||||
import org.apache.skywalking.oal.rt.meta.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine;
|
||||
import org.apache.skywalking.oap.server.core.source.ScopeDefaultColumn;
|
||||
|
||||
/**
|
||||
* @author wusheng
|
||||
*/
|
||||
public class SourceColumnsFactory {
|
||||
private static Map<String, ScopeMeta> SETTINGS;
|
||||
|
||||
public static void setSettings(MetaSettings settings) {
|
||||
SourceColumnsFactory.SETTINGS = new HashMap<>();
|
||||
settings.getScopes().forEach(scope -> {
|
||||
SourceColumnsFactory.SETTINGS.put(scope.getName(), scope);
|
||||
});
|
||||
}
|
||||
|
||||
public static List<SourceColumn> getColumns(String source) {
|
||||
return SETTINGS.get(source).getColumns();
|
||||
List<SourceColumn> sourceColumns = new ArrayList<>();
|
||||
|
||||
List<ScopeDefaultColumn> columns = DefaultScopeDefine.getDefaultColumns(source);
|
||||
for (ScopeDefaultColumn defaultColumn : columns) {
|
||||
sourceColumns.add(new SourceColumn(defaultColumn.getFieldName(), defaultColumn.getColumnName(), defaultColumn.getType(), defaultColumn.isID()));
|
||||
}
|
||||
return sourceColumns;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.oal.rt.meta;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.oal.rt.parser.SourceColumn;
|
||||
import org.junit.*;
|
||||
|
||||
public class MetaReaderTest {
|
||||
@Test
|
||||
public void testFileParser() {
|
||||
MetaReader reader = new MetaReader();
|
||||
InputStream stream = MetaReaderTest.class.getResourceAsStream("/scope-meta.yml");
|
||||
MetaSettings metaSettings = reader.read(stream);
|
||||
Assert.assertNotEquals(0, metaSettings.getScopes().size());
|
||||
|
||||
metaSettings.getScopes().forEach(scopeMeta -> {
|
||||
List<SourceColumn> sourceColumns = MockSourceColumnsFactory.getColumns(scopeMeta.getName());
|
||||
for (int i = 0; i < sourceColumns.size(); i++) {
|
||||
SourceColumn column = scopeMeta.getColumns().get(i);
|
||||
SourceColumn expected = sourceColumns.get(i);
|
||||
Assert.assertEquals(expected, column);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,104 +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.oal.rt.meta;
|
||||
|
||||
import java.util.*;
|
||||
import org.apache.skywalking.oal.rt.parser.SourceColumn;
|
||||
|
||||
public class MockSourceColumnsFactory {
|
||||
public static List<SourceColumn> getColumns(String source) {
|
||||
List<SourceColumn> columnList;
|
||||
SourceColumn idColumn;
|
||||
switch (source) {
|
||||
case "All":
|
||||
return new LinkedList<>();
|
||||
case "Service":
|
||||
columnList = new LinkedList<>();
|
||||
// Service id;
|
||||
idColumn = new SourceColumn("entityId", "entity_id", String.class, true);
|
||||
columnList.add(idColumn);
|
||||
return columnList;
|
||||
case "ServiceInstance":
|
||||
columnList = new LinkedList<>();
|
||||
// Service instance id;
|
||||
idColumn = new SourceColumn("entityId", "entity_id", String.class, true);
|
||||
columnList.add(idColumn);
|
||||
SourceColumn serviceIdColumn = new SourceColumn("serviceId", "service_id", int.class, false);
|
||||
columnList.add(serviceIdColumn);
|
||||
return columnList;
|
||||
case "Endpoint":
|
||||
columnList = new LinkedList<>();
|
||||
// Endpoint id;
|
||||
idColumn = new SourceColumn("entityId", "entity_id", String.class, true);
|
||||
columnList.add(idColumn);
|
||||
serviceIdColumn = new SourceColumn("serviceId", "service_id", int.class, false);
|
||||
columnList.add(serviceIdColumn);
|
||||
SourceColumn serviceInstanceIdColumn = new SourceColumn("serviceInstanceId", "service_instance_id", int.class, false);
|
||||
columnList.add(serviceInstanceIdColumn);
|
||||
return columnList;
|
||||
case "ServiceInstanceJVMCPU":
|
||||
case "ServiceInstanceJVMMemory":
|
||||
case "ServiceInstanceJVMMemoryPool":
|
||||
case "ServiceInstanceJVMGC":
|
||||
columnList = new LinkedList<>();
|
||||
// Service instance id;
|
||||
idColumn = new SourceColumn("entityId", "entity_id", String.class, true);
|
||||
columnList.add(idColumn);
|
||||
serviceInstanceIdColumn = new SourceColumn("serviceInstanceId", "service_instance_id", int.class, false);
|
||||
columnList.add(serviceInstanceIdColumn);
|
||||
return columnList;
|
||||
case "ServiceRelation":
|
||||
columnList = new LinkedList<>();
|
||||
SourceColumn sourceService = new SourceColumn("entityId", "entity_id", String.class, true);
|
||||
columnList.add(sourceService);
|
||||
return columnList;
|
||||
case "ServiceInstanceRelation":
|
||||
columnList = new LinkedList<>();
|
||||
sourceService = new SourceColumn("entityId", "entity_id", String.class, true);
|
||||
columnList.add(sourceService);
|
||||
sourceService = new SourceColumn("sourceServiceId", "source_service_id", int.class, false);
|
||||
columnList.add(sourceService);
|
||||
SourceColumn destService = new SourceColumn("destServiceId", "dest_service_id", int.class, false);
|
||||
columnList.add(destService);
|
||||
|
||||
return columnList;
|
||||
case "EndpointRelation":
|
||||
columnList = new LinkedList<>();
|
||||
SourceColumn sourceEndpointColumn = new SourceColumn("entityId", "entity_id", String.class, true);
|
||||
columnList.add(sourceEndpointColumn);
|
||||
sourceService = new SourceColumn("serviceId", "service_id", int.class, false);
|
||||
columnList.add(sourceService);
|
||||
destService = new SourceColumn("childServiceId", "child_service_id", int.class, false);
|
||||
columnList.add(destService);
|
||||
SourceColumn sourceServiceInstance = new SourceColumn("serviceInstanceId", "service_instance_id", int.class, false);
|
||||
columnList.add(sourceServiceInstance);
|
||||
SourceColumn destServiceInstance = new SourceColumn("childServiceInstanceId", "child_service_instance_id", int.class, false);
|
||||
columnList.add(destServiceInstance);
|
||||
return columnList;
|
||||
case "DatabaseAccess":
|
||||
columnList = new LinkedList<>();
|
||||
// Service id;
|
||||
idColumn = new SourceColumn("entityId", "entity_id", String.class, true);
|
||||
columnList.add(idColumn);
|
||||
return columnList;
|
||||
default:
|
||||
throw new IllegalArgumentException("Illegal sourceScopeId :" + source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -18,21 +18,30 @@
|
|||
|
||||
package org.apache.skywalking.oal.rt.parser;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.oal.rt.meta.*;
|
||||
import org.junit.*;
|
||||
import org.apache.skywalking.oap.server.core.annotation.AnnotationScan;
|
||||
import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class DeepAnalysisTest {
|
||||
@BeforeClass
|
||||
public static void init() throws IOException {
|
||||
MetaReader reader = new MetaReader();
|
||||
InputStream stream = MetaReaderTest.class.getResourceAsStream("/scope-meta.yml");
|
||||
MetaSettings metaSettings = reader.read(stream);
|
||||
SourceColumnsFactory.setSettings(metaSettings);
|
||||
AnnotationScan scopeScan = new AnnotationScan();
|
||||
scopeScan.registerListener(new DefaultScopeDefine.Listener());
|
||||
scopeScan.scan();
|
||||
|
||||
MetricsHolder.init();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void clear() {
|
||||
DefaultScopeDefine.reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testServiceAnalysis() {
|
||||
AnalysisResult result = new AnalysisResult();
|
||||
|
|
|
|||
|
|
@ -18,20 +18,18 @@
|
|||
|
||||
package org.apache.skywalking.oal.rt.parser;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.oal.rt.meta.*;
|
||||
import org.apache.skywalking.oap.server.core.annotation.AnnotationScan;
|
||||
import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine;
|
||||
import org.junit.*;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ScriptParserTest {
|
||||
@BeforeClass
|
||||
public static void init() throws IOException {
|
||||
MetaReader reader = new MetaReader();
|
||||
InputStream stream = MetaReaderTest.class.getResourceAsStream("/scope-meta.yml");
|
||||
MetaSettings metaSettings = reader.read(stream);
|
||||
SourceColumnsFactory.setSettings(metaSettings);
|
||||
MetricsHolder.init();
|
||||
|
||||
AnnotationScan scopeScan = new AnnotationScan();
|
||||
|
|
|
|||
|
|
@ -1,136 +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.
|
||||
|
||||
scopes:
|
||||
- name: All
|
||||
- name: Service
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- name: ServiceInstance
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: Endpoint
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- fieldName: serviceInstanceId
|
||||
columnName: service_instance_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceInstanceJVMCPU
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceInstanceId
|
||||
columnName: service_instance_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceInstanceJVMMemory
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceInstanceId
|
||||
columnName: service_instance_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceInstanceJVMMemoryPool
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceInstanceId
|
||||
columnName: service_instance_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceInstanceJVMGC
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceInstanceId
|
||||
columnName: service_instance_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceRelation
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- name: ServiceInstanceRelation
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: sourceServiceId
|
||||
columnName: source_service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- fieldName: destServiceId
|
||||
columnName: dest_service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: EndpointRelation
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- fieldName: childServiceId
|
||||
columnName: child_service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- fieldName: serviceInstanceId
|
||||
columnName: service_instance_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- fieldName: childServiceInstanceId
|
||||
columnName: child_service_instance_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: DatabaseAccess
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
|
|
@ -26,6 +26,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.DA
|
|||
* @author: liuhaoyang
|
||||
*/
|
||||
@ScopeDeclaration(id = DATABASE_ACCESS, name = "DatabaseAccess")
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class DatabaseAccess extends Source {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -19,7 +19,11 @@
|
|||
package org.apache.skywalking.oap.server.core.source;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.oap.server.core.UnexpectedException;
|
||||
import org.apache.skywalking.oap.server.core.annotation.AnnotationListener;
|
||||
|
||||
|
|
@ -30,6 +34,7 @@ import org.apache.skywalking.oap.server.core.annotation.AnnotationListener;
|
|||
public class DefaultScopeDefine {
|
||||
private static final Map<String, Integer> NAME_2_ID = new HashMap<>();
|
||||
private static final Map<Integer, String> ID_2_NAME = new HashMap<>();
|
||||
private static final Map<String, List<ScopeDefaultColumn>> SCOPE_COLUMNS = new HashMap<>();
|
||||
|
||||
/**
|
||||
* All metrics IDs in [0, 10,000) are reserved in Apache SkyWalking.
|
||||
|
|
@ -94,11 +99,31 @@ public class DefaultScopeDefine {
|
|||
}
|
||||
String name = declaration.name();
|
||||
if (NAME_2_ID.containsKey(name)) {
|
||||
throw new UnexpectedException("ScopeDeclaration name=" + name + " at " + originalClass.getName() + " has conflict with another id= " + NAME_2_ID.get(name));
|
||||
throw new UnexpectedException("ScopeDeclaration fieldName=" + name + " at " + originalClass.getName() + " has conflict with another id= " + NAME_2_ID.get(name));
|
||||
}
|
||||
ID_2_NAME.put(id, name);
|
||||
NAME_2_ID.put(name, id);
|
||||
|
||||
List<ScopeDefaultColumn> scopeDefaultColumns = new ArrayList<>();
|
||||
|
||||
ScopeDefaultColumn.VirtualColumnDefinition virtualColumn = (ScopeDefaultColumn.VirtualColumnDefinition)originalClass.getAnnotation(ScopeDefaultColumn.VirtualColumnDefinition.class);
|
||||
if (virtualColumn != null) {
|
||||
scopeDefaultColumns.add(new ScopeDefaultColumn(virtualColumn.fieldName(), virtualColumn.columnName(),
|
||||
virtualColumn.type(), virtualColumn.isID()));
|
||||
}
|
||||
Field[] scopeClassField = originalClass.getDeclaredFields();
|
||||
if (scopeClassField != null) {
|
||||
for (Field field : scopeClassField) {
|
||||
ScopeDefaultColumn.DefinedByField definedByField = field.getAnnotation(ScopeDefaultColumn.DefinedByField.class);
|
||||
if (definedByField != null) {
|
||||
scopeDefaultColumns.add(new ScopeDefaultColumn(field.getName(), definedByField.columnName(),
|
||||
field.getType(), definedByField.isID()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SCOPE_COLUMNS.put(name, scopeDefaultColumns);
|
||||
|
||||
String catalogName = declaration.catalog();
|
||||
switch (catalogName) {
|
||||
case SERVICE_CATALOG_NAME:
|
||||
|
|
@ -124,7 +149,7 @@ public class DefaultScopeDefine {
|
|||
public static int valueOf(String name) {
|
||||
Integer id = NAME_2_ID.get(name);
|
||||
if (id == null) {
|
||||
throw new UnexpectedException("ScopeDefine name = " + name + " not found.");
|
||||
throw new UnexpectedException("ScopeDefine fieldName = " + name + " not found.");
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
|
@ -132,6 +157,7 @@ public class DefaultScopeDefine {
|
|||
public static void reset() {
|
||||
NAME_2_ID.clear();
|
||||
ID_2_NAME.clear();
|
||||
SCOPE_COLUMNS.clear();
|
||||
}
|
||||
|
||||
public static boolean inServiceCatalog(int scopeId) {
|
||||
|
|
@ -145,4 +171,18 @@ public class DefaultScopeDefine {
|
|||
public static boolean inEndpointCatalog(int scopeId) {
|
||||
return ENDPOINT_CATALOG.containsKey(scopeId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default columns defined in Scope. All those columns will forward to persistent entity.
|
||||
*
|
||||
* @param scopeName of the default columns
|
||||
* @return
|
||||
*/
|
||||
public static List<ScopeDefaultColumn> getDefaultColumns(String scopeName) {
|
||||
List<ScopeDefaultColumn> scopeDefaultColumns = SCOPE_COLUMNS.get(scopeName);
|
||||
if (scopeDefaultColumns == null) {
|
||||
throw new UnexpectedException("ScopeDefine name = " + scopeName + " not found.");
|
||||
}
|
||||
return scopeDefaultColumns;
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.EN
|
|||
* @author peng-yongsheng
|
||||
*/
|
||||
@ScopeDeclaration(id = ENDPOINT, name = "Endpoint", catalog = ENDPOINT_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class Endpoint extends Source {
|
||||
@Override public int scope() {
|
||||
return DefaultScopeDefine.ENDPOINT;
|
||||
|
|
@ -38,9 +39,9 @@ public class Endpoint extends Source {
|
|||
|
||||
@Getter @Setter private int id;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private int serviceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private int serviceInstanceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_instance_id") private int serviceInstanceId;
|
||||
@Getter @Setter private String serviceInstanceName;
|
||||
@Getter @Setter private int latency;
|
||||
@Getter @Setter private boolean status;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.EN
|
|||
* @author peng-yongsheng
|
||||
*/
|
||||
@ScopeDeclaration(id = ENDPOINT_RELATION, name = "EndpointRelation")
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class EndpointRelation extends Source {
|
||||
|
||||
@Override public int scope() {
|
||||
|
|
@ -39,16 +40,16 @@ public class EndpointRelation extends Source {
|
|||
|
||||
@Getter @Setter private int endpointId;
|
||||
@Getter @Setter private String endpoint;
|
||||
@Getter @Setter private int serviceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private int serviceInstanceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_instance_id") private int serviceInstanceId;
|
||||
@Getter @Setter private String serviceInstanceName;
|
||||
|
||||
@Getter @Setter private int childEndpointId;
|
||||
@Getter @Setter private String childEndpoint;
|
||||
@Getter @Setter private int childServiceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "child_service_id") private int childServiceId;
|
||||
@Getter @Setter private String childServiceName;
|
||||
@Getter @Setter private int childServiceInstanceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "child_service_instance_id") private int childServiceInstanceId;
|
||||
@Getter @Setter private String childServiceInstanceName;
|
||||
|
||||
@Getter @Setter private int componentId;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SE
|
|||
* @author wusheng
|
||||
*/
|
||||
@ScopeDeclaration(id = ENVOY_INSTANCE_METRIC, name = "EnvoyInstanceMetric", catalog = SERVICE_INSTANCE_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class EnvoyInstanceMetric extends Source {
|
||||
@Override public int scope() {
|
||||
return ENVOY_INSTANCE_METRIC;
|
||||
|
|
@ -44,7 +45,7 @@ public class EnvoyInstanceMetric extends Source {
|
|||
* Instance id
|
||||
*/
|
||||
@Getter @Setter private int id;
|
||||
@Getter @Setter private int serviceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private String metricName;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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.source;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* Define the default columns of source scope. These columns pass down into the persistent entity(OAL metrics entity)
|
||||
* automatically.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
@Setter(AccessLevel.PUBLIC)
|
||||
public class ScopeDefaultColumn {
|
||||
private String fieldName;
|
||||
private String columnName;
|
||||
private Class<?> type;
|
||||
private boolean isID;
|
||||
|
||||
public ScopeDefaultColumn(String fieldName, String columnName, Class<?> type, boolean isID) {
|
||||
this.fieldName = fieldName;
|
||||
this.columnName = columnName;
|
||||
this.type = type;
|
||||
this.isID = isID;
|
||||
}
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface DefinedByField {
|
||||
String columnName();
|
||||
|
||||
boolean isID() default false;
|
||||
}
|
||||
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface VirtualColumnDefinition {
|
||||
String fieldName();
|
||||
|
||||
String columnName();
|
||||
|
||||
Class type();
|
||||
|
||||
boolean isID() default false;
|
||||
}
|
||||
}
|
||||
|
|
@ -26,6 +26,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.*;
|
|||
* @author wusheng, peng-yongsheng
|
||||
*/
|
||||
@ScopeDeclaration(id = SERVICE, name = "Service", catalog = SERVICE_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class Service extends Source {
|
||||
@Override public int scope() {
|
||||
return DefaultScopeDefine.SERVICE;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SE
|
|||
* @author peng-yongsheng
|
||||
*/
|
||||
@ScopeDeclaration(id = SERVICE_INSTANCE, name = "ServiceInstance", catalog = SERVICE_INSTANCE_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class ServiceInstance extends Source {
|
||||
@Override public int scope() {
|
||||
return DefaultScopeDefine.SERVICE_INSTANCE;
|
||||
|
|
@ -37,7 +38,7 @@ public class ServiceInstance extends Source {
|
|||
}
|
||||
|
||||
@Getter @Setter private int id;
|
||||
@Getter @Setter private int serviceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private String endpointName;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SE
|
|||
* @author liuhaoyang
|
||||
**/
|
||||
@ScopeDeclaration(id = SERVICE_INSTANCE_CLR_CPU, name = "ServiceInstanceCLRCPU", catalog = SERVICE_INSTANCE_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class ServiceInstanceCLRCPU extends Source {
|
||||
@Override public int scope() {
|
||||
return DefaultScopeDefine.SERVICE_INSTANCE_CLR_CPU;
|
||||
|
|
@ -40,6 +41,6 @@ public class ServiceInstanceCLRCPU extends Source {
|
|||
@Getter @Setter private int id;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private int serviceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private double usePercent;
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SE
|
|||
* @author liuhaoyang
|
||||
**/
|
||||
@ScopeDeclaration(id = SERVICE_INSTANCE_CLR_GC, name = "ServiceInstanceCLRGC", catalog = SERVICE_INSTANCE_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class ServiceInstanceCLRGC extends Source {
|
||||
@Override public int scope() {
|
||||
return DefaultScopeDefine.SERVICE_INSTANCE_CLR_GC;
|
||||
|
|
@ -40,7 +41,7 @@ public class ServiceInstanceCLRGC extends Source {
|
|||
@Getter @Setter private int id;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private int serviceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private long gen0CollectCount;
|
||||
@Getter @Setter private long gen1CollectCount;
|
||||
@Getter @Setter private long gen2CollectCount;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SE
|
|||
* @author liuhaoyang
|
||||
**/
|
||||
@ScopeDeclaration(id = SERVICE_INSTANCE_CLR_THREAD, name = "ServiceInstanceCLRThread", catalog = SERVICE_INSTANCE_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class ServiceInstanceCLRThread extends Source {
|
||||
@Override public int scope() {
|
||||
return DefaultScopeDefine.SERVICE_INSTANCE_CLR_THREAD;
|
||||
|
|
@ -40,7 +41,7 @@ public class ServiceInstanceCLRThread extends Source {
|
|||
@Getter @Setter private int id;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private int serviceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private long availableCompletionPortThreads;
|
||||
@Getter @Setter private long availableWorkerThreads;
|
||||
@Getter @Setter private long maxCompletionPortThreads;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
package org.apache.skywalking.oap.server.core.source;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SERVICE_INSTANCE_CATALOG_NAME;
|
||||
import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SERVICE_INSTANCE_JVM_CPU;
|
||||
|
|
@ -27,6 +28,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SE
|
|||
* @author peng-yongsheng
|
||||
*/
|
||||
@ScopeDeclaration(id = SERVICE_INSTANCE_JVM_CPU, name = "ServiceInstanceJVMCPU", catalog = SERVICE_INSTANCE_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class ServiceInstanceJVMCPU extends Source {
|
||||
@Override public int scope() {
|
||||
return DefaultScopeDefine.SERVICE_INSTANCE_JVM_CPU;
|
||||
|
|
@ -39,6 +41,6 @@ public class ServiceInstanceJVMCPU extends Source {
|
|||
@Getter @Setter private int id;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private int serviceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private double usePercent;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SE
|
|||
* @author peng-yongsheng
|
||||
*/
|
||||
@ScopeDeclaration(id = SERVICE_INSTANCE_JVM_GC, name = "ServiceInstanceJVMGC", catalog = SERVICE_INSTANCE_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class ServiceInstanceJVMGC extends Source {
|
||||
@Override public int scope() {
|
||||
return DefaultScopeDefine.SERVICE_INSTANCE_JVM_GC;
|
||||
|
|
@ -39,7 +40,7 @@ public class ServiceInstanceJVMGC extends Source {
|
|||
@Getter @Setter private int id;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private int serviceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private GCPhrase phrase;
|
||||
@Getter @Setter private long time;
|
||||
@Getter @Setter private long count;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SE
|
|||
* @author peng-yongsheng
|
||||
*/
|
||||
@ScopeDeclaration(id = SERVICE_INSTANCE_JVM_MEMORY, name = "ServiceInstanceJVMMemory", catalog = SERVICE_INSTANCE_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class ServiceInstanceJVMMemory extends Source {
|
||||
@Override public int scope() {
|
||||
return DefaultScopeDefine.SERVICE_INSTANCE_JVM_MEMORY;
|
||||
|
|
@ -39,7 +40,7 @@ public class ServiceInstanceJVMMemory extends Source {
|
|||
@Getter @Setter private int id;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private int serviceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private boolean heapStatus;
|
||||
@Getter @Setter private long init;
|
||||
@Getter @Setter private long max;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SE
|
|||
* @author peng-yongsheng
|
||||
*/
|
||||
@ScopeDeclaration(id = SERVICE_INSTANCE_JVM_MEMORY_POOL, name = "ServiceInstanceJVMMemoryPool", catalog = SERVICE_INSTANCE_CATALOG_NAME)
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class ServiceInstanceJVMMemoryPool extends Source {
|
||||
@Override public int scope() {
|
||||
return DefaultScopeDefine.SERVICE_INSTANCE_JVM_MEMORY_POOL;
|
||||
|
|
@ -39,7 +40,7 @@ public class ServiceInstanceJVMMemoryPool extends Source {
|
|||
@Getter @Setter private int id;
|
||||
@Getter @Setter private String name;
|
||||
@Getter @Setter private String serviceName;
|
||||
@Getter @Setter private int serviceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "service_id") private int serviceId;
|
||||
@Getter @Setter private MemoryPoolType poolType;
|
||||
@Getter @Setter private long init;
|
||||
@Getter @Setter private long max;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SE
|
|||
* @author peng-yongsheng
|
||||
*/
|
||||
@ScopeDeclaration(id = SERVICE_INSTANCE_RELATION, name = "ServiceInstanceRelation")
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class ServiceInstanceRelation extends Source {
|
||||
|
||||
@Override public int scope() {
|
||||
|
|
@ -38,11 +39,11 @@ public class ServiceInstanceRelation extends Source {
|
|||
}
|
||||
|
||||
@Getter @Setter private int sourceServiceInstanceId;
|
||||
@Getter @Setter private int sourceServiceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "source_service_id") private int sourceServiceId;
|
||||
@Getter @Setter private String sourceServiceName;
|
||||
@Getter @Setter private String sourceServiceInstanceName;
|
||||
@Getter @Setter private int destServiceInstanceId;
|
||||
@Getter @Setter private int destServiceId;
|
||||
@Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "dest_service_id") private int destServiceId;
|
||||
@Getter @Setter private String destServiceName;
|
||||
@Getter @Setter private String destServiceInstanceName;
|
||||
@Getter @Setter private String endpoint;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SE
|
|||
* @author peng-yongsheng
|
||||
*/
|
||||
@ScopeDeclaration(id = SERVICE_RELATION, name = "ServiceRelation")
|
||||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class)
|
||||
public class ServiceRelation extends Source {
|
||||
|
||||
@Override public int scope() {
|
||||
|
|
|
|||
|
|
@ -240,7 +240,6 @@
|
|||
<exclude>datasource-settings.properties</exclude>
|
||||
<exclude>endpoint_naming_rules.properties</exclude>
|
||||
<exclude>official_analysis.oal</exclude>
|
||||
<exclude>scope-meta.yml</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@
|
|||
<includes>
|
||||
<include>component-libraries.yml</include>
|
||||
<include>official_analysis.oal</include>
|
||||
<include>scope-meta.yml</include>
|
||||
</includes>
|
||||
<outputDirectory>/config</outputDirectory>
|
||||
</fileSet>
|
||||
|
|
|
|||
|
|
@ -1,176 +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.
|
||||
|
||||
scopes:
|
||||
- name: All
|
||||
- name: Service
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- name: ServiceInstance
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: Endpoint
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- fieldName: serviceInstanceId
|
||||
columnName: service_instance_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceInstanceJVMCPU
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceInstanceJVMMemory
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceInstanceJVMMemoryPool
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceInstanceJVMGC
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceRelation
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- name: ServiceInstanceRelation
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: sourceServiceId
|
||||
columnName: source_service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- fieldName: destServiceId
|
||||
columnName: dest_service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: EndpointRelation
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- fieldName: childServiceId
|
||||
columnName: child_service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- fieldName: serviceInstanceId
|
||||
columnName: service_instance_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- fieldName: childServiceInstanceId
|
||||
columnName: child_service_instance_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: DatabaseAccess
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- name: ServiceInstanceCLRCPU
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceInstanceCLRGC
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: ServiceInstanceCLRThread
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
- name: EnvoyInstanceMetric
|
||||
columns:
|
||||
- fieldName: entityId
|
||||
columnName: entity_id
|
||||
typeName: java.lang.String
|
||||
ID: true
|
||||
- fieldName: serviceId
|
||||
columnName: service_id
|
||||
typeName: int
|
||||
ID: false
|
||||
|
|
@ -61,7 +61,7 @@ public class H2RegisterLockInstaller {
|
|||
|
||||
for (Class registerSource : InventoryStreamProcessor.getInstance().getAllRegisterSources()) {
|
||||
int scopeId = ((Stream)registerSource.getAnnotation(Stream.class)).scopeId();
|
||||
putIfAbsent(h2Client, connection, scopeId, DefaultScopeDefine.nameOf(1));
|
||||
putIfAbsent(h2Client, connection, scopeId, DefaultScopeDefine.nameOf(scopeId));
|
||||
}
|
||||
} catch (JDBCClientException | SQLException e) {
|
||||
throw new StorageException(e.getMessage(), e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue