Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
b9432655
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,发现更多精彩内容 >>
未验证
提交
b9432655
编写于
12月 06, 2018
作者:
J
Jared Tan
提交者:
GitHub
12月 06, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into len
上级
5bc3ccde
f2b15886
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
125 addition
and
49 deletion
+125
-49
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java
...apache/skywalking/oap/server/core/CoreModuleProvider.java
+51
-14
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/DispatcherManager.java
...kywalking/oap/server/core/analysis/DispatcherManager.java
+69
-35
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/SourceReceiverImpl.java
...skywalking/oap/server/core/source/SourceReceiverImpl.java
+5
-0
未找到文件。
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java
浏览文件 @
b9432655
...
...
@@ -22,27 +22,60 @@ import java.io.IOException;
import
org.apache.skywalking.oap.server.core.analysis.indicator.annotation.IndicatorTypeListener
;
import
org.apache.skywalking.oap.server.core.analysis.record.annotation.RecordTypeListener
;
import
org.apache.skywalking.oap.server.core.annotation.AnnotationScan
;
import
org.apache.skywalking.oap.server.core.cache.*
;
import
org.apache.skywalking.oap.server.core.cluster.*
;
import
org.apache.skywalking.oap.server.core.config.*
;
import
org.apache.skywalking.oap.server.core.query.*
;
import
org.apache.skywalking.oap.server.core.cache.CacheUpdateTimer
;
import
org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache
;
import
org.apache.skywalking.oap.server.core.cache.NetworkAddressInventoryCache
;
import
org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache
;
import
org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache
;
import
org.apache.skywalking.oap.server.core.cluster.ClusterModule
;
import
org.apache.skywalking.oap.server.core.cluster.ClusterRegister
;
import
org.apache.skywalking.oap.server.core.cluster.RemoteInstance
;
import
org.apache.skywalking.oap.server.core.config.ComponentLibraryCatalogService
;
import
org.apache.skywalking.oap.server.core.config.DownsamplingConfigService
;
import
org.apache.skywalking.oap.server.core.config.IComponentLibraryCatalogService
;
import
org.apache.skywalking.oap.server.core.query.AggregationQueryService
;
import
org.apache.skywalking.oap.server.core.query.AlarmQueryService
;
import
org.apache.skywalking.oap.server.core.query.MetadataQueryService
;
import
org.apache.skywalking.oap.server.core.query.MetricQueryService
;
import
org.apache.skywalking.oap.server.core.query.TopologyQueryService
;
import
org.apache.skywalking.oap.server.core.query.TraceQueryService
;
import
org.apache.skywalking.oap.server.core.register.annotation.InventoryTypeListener
;
import
org.apache.skywalking.oap.server.core.register.service.*
;
import
org.apache.skywalking.oap.server.core.remote.*
;
import
org.apache.skywalking.oap.server.core.remote.annotation.*
;
import
org.apache.skywalking.oap.server.core.remote.client.*
;
import
org.apache.skywalking.oap.server.core.server.*
;
import
org.apache.skywalking.oap.server.core.source.*
;
import
org.apache.skywalking.oap.server.core.register.service.EndpointInventoryRegister
;
import
org.apache.skywalking.oap.server.core.register.service.IEndpointInventoryRegister
;
import
org.apache.skywalking.oap.server.core.register.service.INetworkAddressInventoryRegister
;
import
org.apache.skywalking.oap.server.core.register.service.IServiceInstanceInventoryRegister
;
import
org.apache.skywalking.oap.server.core.register.service.IServiceInventoryRegister
;
import
org.apache.skywalking.oap.server.core.register.service.NetworkAddressInventoryRegister
;
import
org.apache.skywalking.oap.server.core.register.service.ServiceInstanceInventoryRegister
;
import
org.apache.skywalking.oap.server.core.register.service.ServiceInventoryRegister
;
import
org.apache.skywalking.oap.server.core.remote.RemoteSenderService
;
import
org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler
;
import
org.apache.skywalking.oap.server.core.remote.annotation.StreamAnnotationListener
;
import
org.apache.skywalking.oap.server.core.remote.annotation.StreamDataAnnotationContainer
;
import
org.apache.skywalking.oap.server.core.remote.annotation.StreamDataClassGetter
;
import
org.apache.skywalking.oap.server.core.remote.client.Address
;
import
org.apache.skywalking.oap.server.core.remote.client.RemoteClientManager
;
import
org.apache.skywalking.oap.server.core.server.GRPCHandlerRegister
;
import
org.apache.skywalking.oap.server.core.server.GRPCHandlerRegisterImpl
;
import
org.apache.skywalking.oap.server.core.server.JettyHandlerRegister
;
import
org.apache.skywalking.oap.server.core.server.JettyHandlerRegisterImpl
;
import
org.apache.skywalking.oap.server.core.source.SourceReceiver
;
import
org.apache.skywalking.oap.server.core.source.SourceReceiverImpl
;
import
org.apache.skywalking.oap.server.core.storage.PersistenceTimer
;
import
org.apache.skywalking.oap.server.core.storage.annotation.StorageAnnotationListener
;
import
org.apache.skywalking.oap.server.core.storage.model.IModelGetter
;
import
org.apache.skywalking.oap.server.core.storage.model.IModelOverride
;
import
org.apache.skywalking.oap.server.core.storage.ttl.DataTTLKeeperTimer
;
import
org.apache.skywalking.oap.server.library.module.*
;
import
org.apache.skywalking.oap.server.library.module.ModuleConfig
;
import
org.apache.skywalking.oap.server.library.module.ModuleDefine
;
import
org.apache.skywalking.oap.server.library.module.ModuleProvider
;
import
org.apache.skywalking.oap.server.library.module.ModuleStartException
;
import
org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException
;
import
org.apache.skywalking.oap.server.library.server.ServerException
;
import
org.apache.skywalking.oap.server.library.server.grpc.GRPCServer
;
import
org.apache.skywalking.oap.server.library.server.jetty.JettyServer
;
import
org.slf4j.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
...
...
@@ -59,6 +92,7 @@ public class CoreModuleProvider extends ModuleProvider {
private
final
StorageAnnotationListener
storageAnnotationListener
;
private
final
StreamAnnotationListener
streamAnnotationListener
;
private
final
StreamDataAnnotationContainer
streamDataAnnotationContainer
;
private
final
SourceReceiverImpl
receiver
;
public
CoreModuleProvider
()
{
super
();
...
...
@@ -67,6 +101,7 @@ public class CoreModuleProvider extends ModuleProvider {
this
.
storageAnnotationListener
=
new
StorageAnnotationListener
();
this
.
streamAnnotationListener
=
new
StreamAnnotationListener
();
this
.
streamDataAnnotationContainer
=
new
StreamDataAnnotationContainer
();
receiver
=
new
SourceReceiverImpl
();
}
@Override
public
String
name
()
{
...
...
@@ -101,7 +136,7 @@ public class CoreModuleProvider extends ModuleProvider {
this
.
registerServiceImplementation
(
IComponentLibraryCatalogService
.
class
,
new
ComponentLibraryCatalogService
());
this
.
registerServiceImplementation
(
SourceReceiver
.
class
,
new
SourceReceiverImpl
()
);
this
.
registerServiceImplementation
(
SourceReceiver
.
class
,
receiver
);
this
.
registerServiceImplementation
(
StreamDataClassGetter
.
class
,
streamDataAnnotationContainer
);
...
...
@@ -143,10 +178,12 @@ public class CoreModuleProvider extends ModuleProvider {
remoteClientManager
.
start
();
try
{
receiver
.
scan
();
annotationScan
.
scan
(()
->
{
streamDataAnnotationContainer
.
generate
(
streamAnnotationListener
.
getStreamClasses
());
});
}
catch
(
IOException
e
)
{
}
catch
(
IOException
|
IllegalAccessException
|
InstantiationException
e
)
{
throw
new
ModuleStartException
(
e
.
getMessage
(),
e
);
}
}
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/DispatcherManager.java
浏览文件 @
b9432655
...
...
@@ -18,57 +18,91 @@
package
org.apache.skywalking.oap.server.core.analysis
;
import
java.util.*
;
import
org.apache.skywalking.oap.server.core.analysis.generated.all.AllDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.generated.endpoint.EndpointDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.generated.endpointrelation.EndpointRelationDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.generated.service.ServiceDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.generated.serviceinstance.ServiceInstanceDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.generated.serviceinstancejvmcpu.ServiceInstanceJVMCPUDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.generated.serviceinstancejvmgc.ServiceInstanceJVMGCDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.generated.serviceinstancejvmmemory.ServiceInstanceJVMMemoryDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.generated.serviceinstancejvmmemorypool.ServiceInstanceJVMMemoryPoolDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.generated.serviceinstancerelation.ServiceInstanceRelationDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.generated.servicerelation.ServiceRelationDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.manual.endpointrelation.EndpointCallRelationDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentDispatcher
;
import
org.apache.skywalking.oap.server.core.analysis.manual.servicerelation.ServiceCallRelationDispatcher
;
import
org.apache.skywalking.oap.server.core.source.*
;
import
org.slf4j.*
;
import
com.google.common.collect.ImmutableSet
;
import
com.google.common.reflect.ClassPath
;
import
java.io.IOException
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
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.source.Scope
;
import
org.apache.skywalking.oap.server.core.source.Source
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
* @author peng-yongsheng
, wusheng
*/
public
class
DispatcherManager
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DispatcherManager
.
class
);
private
Map
<
Scope
,
SourceDispatcher
[]
>
dispatcherMap
;
private
Map
<
Scope
,
List
<
SourceDispatcher
>
>
dispatcherMap
;
public
DispatcherManager
()
{
this
.
dispatcherMap
=
new
HashMap
<>();
}
this
.
dispatcherMap
.
put
(
Scope
.
All
,
new
SourceDispatcher
[]
{
new
AllDispatcher
()});
public
void
forward
(
Source
source
)
{
for
(
SourceDispatcher
dispatcher
:
dispatcherMap
.
get
(
source
.
scope
()))
{
dispatcher
.
dispatch
(
source
);
}
}
this
.
dispatcherMap
.
put
(
Scope
.
Segment
,
new
SourceDispatcher
[]
{
new
SegmentDispatcher
()});
/**
* Scan all classes under `org.apache.skywalking` package,
*
* If it implement {@link org.apache.skywalking.oap.server.core.analysis.SourceDispatcher}, then, it will be added
* into this DispatcherManager based on the Source definition.
*
* @throws IOException
* @throws IllegalAccessException
* @throws InstantiationException
*/
public
void
scan
()
throws
IOException
,
IllegalAccessException
,
InstantiationException
{
ClassPath
classpath
=
ClassPath
.
from
(
this
.
getClass
().
getClassLoader
());
ImmutableSet
<
ClassPath
.
ClassInfo
>
classes
=
classpath
.
getTopLevelClassesRecursive
(
"org.apache.skywalking"
);
for
(
ClassPath
.
ClassInfo
classInfo
:
classes
)
{
Class
<?>
aClass
=
classInfo
.
load
();
this
.
dispatcherMap
.
put
(
Scope
.
Service
,
new
SourceDispatcher
[]
{
new
ServiceDispatcher
()});
this
.
dispatcherMap
.
put
(
Scope
.
ServiceInstance
,
new
SourceDispatcher
[]
{
new
ServiceInstanceDispatcher
()});
this
.
dispatcherMap
.
put
(
Scope
.
Endpoint
,
new
SourceDispatcher
[]
{
new
EndpointDispatcher
()});
if
(!
aClass
.
isInterface
()
&&
SourceDispatcher
.
class
.
isAssignableFrom
(
aClass
))
{
Type
[]
genericInterfaces
=
aClass
.
getGenericInterfaces
();
for
(
Type
genericInterface
:
genericInterfaces
)
{
ParameterizedType
anInterface
=
(
ParameterizedType
)
genericInterface
;
if
(
anInterface
.
getRawType
().
getTypeName
().
equals
(
SourceDispatcher
.
class
.
getName
()))
{
Type
[]
arguments
=
anInterface
.
getActualTypeArguments
();
this
.
dispatcherMap
.
put
(
Scope
.
ServiceRelation
,
new
SourceDispatcher
[]
{
new
ServiceRelationDispatcher
(),
new
ServiceCallRelationDispatcher
()});
this
.
dispatcherMap
.
put
(
Scope
.
ServiceInstanceRelation
,
new
SourceDispatcher
[]
{
new
ServiceInstanceRelationDispatcher
()});
this
.
dispatcherMap
.
put
(
Scope
.
EndpointRelation
,
new
SourceDispatcher
[]
{
new
EndpointRelationDispatcher
(),
new
EndpointCallRelationDispatcher
()});
if
(
arguments
.
length
!=
1
)
{
throw
new
UnexpectedException
(
"unexpected type argument number, class "
+
aClass
.
getName
());
}
Type
argument
=
arguments
[
0
];
this
.
dispatcherMap
.
put
(
Scope
.
ServiceInstanceJVMCPU
,
new
SourceDispatcher
[]
{
new
ServiceInstanceJVMCPUDispatcher
()});
this
.
dispatcherMap
.
put
(
Scope
.
ServiceInstanceJVMGC
,
new
SourceDispatcher
[]
{
new
ServiceInstanceJVMGCDispatcher
()});
this
.
dispatcherMap
.
put
(
Scope
.
ServiceInstanceJVMMemory
,
new
SourceDispatcher
[]
{
new
ServiceInstanceJVMMemoryDispatcher
()});
this
.
dispatcherMap
.
put
(
Scope
.
ServiceInstanceJVMMemoryPool
,
new
SourceDispatcher
[]
{
new
ServiceInstanceJVMMemoryPoolDispatcher
()});
}
Object
source
=
((
Class
)
argument
).
newInstance
();
public
void
forward
(
Source
source
)
{
for
(
SourceDispatcher
dispatcher
:
dispatcherMap
.
get
(
source
.
scope
()))
{
dispatcher
.
dispatch
(
source
);
if
(!
Source
.
class
.
isAssignableFrom
(
source
.
getClass
()))
{
throw
new
UnexpectedException
(
"unexpected type argument of class "
+
aClass
.
getName
()
+
", should be `org.apache.skywalking.oap.server.core.source.Source`. "
);
}
Source
dispatcherSource
=
(
Source
)
source
;
SourceDispatcher
dispatcher
=
(
SourceDispatcher
)
aClass
.
newInstance
();
Scope
scope
=
dispatcherSource
.
scope
();
List
<
SourceDispatcher
>
dispatchers
=
this
.
dispatcherMap
.
get
(
scope
);
if
(
dispatchers
==
null
)
{
dispatchers
=
new
ArrayList
<>();
this
.
dispatcherMap
.
put
(
scope
,
dispatchers
);
}
dispatchers
.
add
(
dispatcher
);
logger
.
info
(
"Dispatcher {} is added into Scope {}."
,
dispatcher
.
getClass
().
getName
(),
scope
);
}
}
}
}
}
}
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/SourceReceiverImpl.java
浏览文件 @
b9432655
...
...
@@ -18,6 +18,7 @@
package
org.apache.skywalking.oap.server.core.source
;
import
java.io.IOException
;
import
org.apache.skywalking.oap.server.core.analysis.DispatcherManager
;
/**
...
...
@@ -34,4 +35,8 @@ public class SourceReceiverImpl implements SourceReceiver {
@Override
public
void
receive
(
Source
source
)
{
dispatcherManager
.
forward
(
source
);
}
public
void
scan
()
throws
IOException
,
InstantiationException
,
IllegalAccessException
{
dispatcherManager
.
scan
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录