Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
0df76e4e
S
SkyWalking
项目概览
山不在高_有仙则灵
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
12
Star
0
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0df76e4e
编写于
8月 07, 2019
作者:
wu-sheng
提交者:
GitHub
8月 07, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove the scope-meta file (#3226)
* Remove the meta file
上级
37acc3dc
变更
32
隐藏空白更改
内联
并排
Showing
32 changed file
with
193 addition
and
598 deletion
+193
-598
docs/en/guides/source-extension.md
docs/en/guides/source-extension.md
+13
-9
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/OALRuntime.java
...rc/main/java/org/apache/skywalking/oal/rt/OALRuntime.java
+0
-12
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/meta/MetaSettings.java
.../java/org/apache/skywalking/oal/rt/meta/MetaSettings.java
+0
-31
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/meta/ScopeMeta.java
...ain/java/org/apache/skywalking/oal/rt/meta/ScopeMeta.java
+0
-33
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/parser/SourceColumn.java
...ava/org/apache/skywalking/oal/rt/parser/SourceColumn.java
+0
-3
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/parser/SourceColumnsFactory.java
...apache/skywalking/oal/rt/parser/SourceColumnsFactory.java
+11
-12
oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/rt/meta/MetaReaderTest.java
...ava/org/apache/skywalking/oal/rt/meta/MetaReaderTest.java
+0
-43
oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/rt/meta/MockSourceColumnsFactory.java
...ache/skywalking/oal/rt/meta/MockSourceColumnsFactory.java
+0
-104
oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/rt/parser/DeepAnalysisTest.java
...org/apache/skywalking/oal/rt/parser/DeepAnalysisTest.java
+16
-7
oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/rt/parser/ScriptParserTest.java
...org/apache/skywalking/oal/rt/parser/ScriptParserTest.java
+5
-7
oap-server/oal-rt/src/test/resources/scope-meta.yml
oap-server/oal-rt/src/test/resources/scope-meta.yml
+0
-136
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DatabaseAccess.java
...che/skywalking/oap/server/core/source/DatabaseAccess.java
+1
-0
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java
...skywalking/oap/server/core/source/DefaultScopeDefine.java
+44
-4
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Endpoint.java
...rg/apache/skywalking/oap/server/core/source/Endpoint.java
+3
-2
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/EndpointRelation.java
...e/skywalking/oap/server/core/source/EndpointRelation.java
+5
-4
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/EnvoyInstanceMetric.java
...kywalking/oap/server/core/source/EnvoyInstanceMetric.java
+2
-1
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDefaultColumn.java
...skywalking/oap/server/core/source/ScopeDefaultColumn.java
+69
-0
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Service.java
...org/apache/skywalking/oap/server/core/source/Service.java
+1
-0
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstance.java
...he/skywalking/oap/server/core/source/ServiceInstance.java
+2
-1
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceCLRCPU.java
...walking/oap/server/core/source/ServiceInstanceCLRCPU.java
+2
-1
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceCLRGC.java
...ywalking/oap/server/core/source/ServiceInstanceCLRGC.java
+2
-1
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceCLRThread.java
...king/oap/server/core/source/ServiceInstanceCLRThread.java
+2
-1
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceJVMCPU.java
...walking/oap/server/core/source/ServiceInstanceJVMCPU.java
+4
-2
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceJVMGC.java
...ywalking/oap/server/core/source/ServiceInstanceJVMGC.java
+2
-1
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceJVMMemory.java
...king/oap/server/core/source/ServiceInstanceJVMMemory.java
+2
-1
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceJVMMemoryPool.java
.../oap/server/core/source/ServiceInstanceJVMMemoryPool.java
+2
-1
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceRelation.java
...lking/oap/server/core/source/ServiceInstanceRelation.java
+3
-2
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceRelation.java
...he/skywalking/oap/server/core/source/ServiceRelation.java
+1
-0
oap-server/server-starter/pom.xml
oap-server/server-starter/pom.xml
+0
-1
oap-server/server-starter/src/main/assembly/assembly.xml
oap-server/server-starter/src/main/assembly/assembly.xml
+0
-1
oap-server/server-starter/src/main/resources/scope-meta.yml
oap-server/server-starter/src/main/resources/scope-meta.yml
+0
-176
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2RegisterLockInstaller.java
...r/storage/plugin/jdbc/h2/dao/H2RegisterLockInstaller.java
+1
-1
未找到文件。
docs/en/guides/source-extension.md
浏览文件 @
0df76e4e
...
...
@@ -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
service
Instance
Name
;
@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
...
...
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/OALRuntime.java
浏览文件 @
0df76e4e
...
...
@@ -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
();
...
...
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/meta/MetaSettings.java
已删除
100644 → 0
浏览文件 @
37acc3dc
/*
* 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
;
}
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/meta/ScopeMeta.java
已删除
100644 → 0
浏览文件 @
37acc3dc
/*
* 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
<>();
}
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/parser/SourceColumn.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/parser/SourceColumnsFactory.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
}
}
oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/rt/meta/MetaReaderTest.java
已删除
100644 → 0
浏览文件 @
37acc3dc
/*
* 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
);
}
});
}
}
oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/rt/meta/MockSourceColumnsFactory.java
已删除
100644 → 0
浏览文件 @
37acc3dc
/*
* 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
);
}
}
}
oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/rt/parser/DeepAnalysisTest.java
浏览文件 @
0df76e4e
...
...
@@ -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
();
...
...
oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/rt/parser/ScriptParserTest.java
浏览文件 @
0df76e4e
...
...
@@ -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
();
...
...
oap-server/oal-rt/src/test/resources/scope-meta.yml
已删除
100644 → 0
浏览文件 @
37acc3dc
# 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
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DatabaseAccess.java
浏览文件 @
0df76e4e
...
...
@@ -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
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java
浏览文件 @
0df76e4e
...
...
@@ -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
n
ame="
+
name
+
" at "
+
originalClass
.
getName
()
+
" has conflict with another id= "
+
NAME_2_ID
.
get
(
name
));
throw
new
UnexpectedException
(
"ScopeDeclaration
fieldN
ame="
+
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
n
ame = "
+
name
+
" not found."
);
throw
new
UnexpectedException
(
"ScopeDefine
fieldN
ame = "
+
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
;
}
}
\ No newline at end of file
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Endpoint.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/EndpointRelation.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/EnvoyInstanceMetric.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/
oal-rt/src/main/java/org/apache/skywalking/oal/rt/meta/MetaReader
.java
→
oap-server/
server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDefaultColumn
.java
浏览文件 @
0df76e4e
...
...
@@ -16,27 +16,54 @@
*
*/
package
org.apache.skywalking.oa
l.rt.meta
;
package
org.apache.skywalking.oa
p.server.core.source
;
import
java.io.InputStream
;
import
java.io.Reader
;
import
org.yaml.snakeyaml.Yaml
;
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
*/
public
class
MetaReader
{
public
MetaSettings
read
(
Reader
reader
)
{
Yaml
yaml
=
new
Yaml
();
MetaSettings
settings
=
yaml
.
loadAs
(
reader
,
MetaSettings
.
class
);
@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
;
}
return
settings
;
@Target
({
ElementType
.
FIELD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
DefinedByField
{
String
columnName
();
boolean
isID
()
default
false
;
}
public
MetaSettings
read
(
InputStream
reader
)
{
Yaml
yaml
=
new
Yaml
();
MetaSettings
settings
=
yaml
.
loadAs
(
reader
,
MetaSettings
.
class
);
@Target
({
ElementType
.
TYPE
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
VirtualColumnDefinition
{
String
fieldName
();
String
columnName
();
Class
type
();
return
settings
;
boolean
isID
()
default
false
;
}
}
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Service.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstance.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceCLRCPU.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
}
\ No newline at end of file
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceCLRGC.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceCLRThread.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceJVMCPU.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
}
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceJVMGC.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceJVMMemory.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceJVMMemoryPool.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceRelation.java
浏览文件 @
0df76e4e
...
...
@@ -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
;
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceRelation.java
浏览文件 @
0df76e4e
...
...
@@ -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
()
{
...
...
oap-server/server-starter/pom.xml
浏览文件 @
0df76e4e
...
...
@@ -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>
...
...
oap-server/server-starter/src/main/assembly/assembly.xml
浏览文件 @
0df76e4e
...
...
@@ -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>
...
...
oap-server/server-starter/src/main/resources/scope-meta.yml
已删除
100644 → 0
浏览文件 @
37acc3dc
# 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
\ No newline at end of file
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2RegisterLockInstaller.java
浏览文件 @
0df76e4e
...
...
@@ -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
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录