Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
killuaz丶x
SkyWalking
提交
e4145700
S
SkyWalking
项目概览
killuaz丶x
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
1
Star
0
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
e4145700
编写于
10月 27, 2017
作者:
P
peng-yongsheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add the implements of naming module.
上级
5828f286
变更
46
隐藏空白更改
内联
并排
Showing
46 changed file
with
1032 addition
and
28 deletion
+1032
-28
apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Handler.java
.../org/skywalking/apm/collector/core/framework/Handler.java
+1
-1
apm-collector/apm-collector-cluster/collector-cluster-define/src/main/java/org/skywalking/apm/collector/cluster/ClusterModule.java
...a/org/skywalking/apm/collector/cluster/ClusterModule.java
+2
-1
apm-collector/apm-collector-cluster/collector-cluster-define/src/main/java/org/skywalking/apm/collector/cluster/service/ModuleRegistrationGetService.java
...llector/cluster/service/ModuleRegistrationGetService.java
+29
-0
apm-collector/apm-collector-cluster/collector-cluster-redis-provider/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterModuleRedisProvider.java
...m/collector/cluster/redis/ClusterModuleRedisProvider.java
+2
-0
apm-collector/apm-collector-cluster/collector-cluster-redis-provider/src/main/java/org/skywalking/apm/collector/cluster/redis/service/RedisModuleRegistrationGetService.java
...ster/redis/service/RedisModuleRegistrationGetService.java
+32
-0
apm-collector/apm-collector-cluster/collector-cluster-standalone-provider/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterModuleStandaloneProvider.java
...r/cluster/standalone/ClusterModuleStandaloneProvider.java
+2
-0
apm-collector/apm-collector-cluster/collector-cluster-standalone-provider/src/main/java/org/skywalking/apm/collector/cluster/standalone/service/StandaloneModuleRegistrationGetService.java
...alone/service/StandaloneModuleRegistrationGetService.java
+32
-0
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterModuleZookeeperProvider.java
...tor/cluster/zookeeper/ClusterModuleZookeeperProvider.java
+5
-3
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/service/ZookeeperModuleRegisterService.java
...ter/zookeeper/service/ZookeeperModuleRegisterService.java
+1
-1
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/service/ZookeeperModuleRegistrationGetService.java
...keeper/service/ZookeeperModuleRegistrationGetService.java
+31
-0
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/resources/META-INF/services/org.skywalking.apm.collector.core.module.ModuleProvider
...s/org.skywalking.apm.collector.core.module.ModuleProvider
+1
-1
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClient.java
...m/collector/client/elasticsearch/ElasticSearchClient.java
+2
-2
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClientException.java
...or/client/elasticsearch/ElasticSearchClientException.java
+1
-1
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClient.java
.../org/skywalking/apm/collector/client/grpc/GRPCClient.java
+2
-2
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClientException.java
...alking/apm/collector/client/grpc/GRPCClientException.java
+1
-1
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/h2/H2Client.java
...java/org/skywalking/apm/collector/client/h2/H2Client.java
+1
-1
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/h2/H2ClientException.java
...skywalking/apm/collector/client/h2/H2ClientException.java
+1
-1
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/redis/RedisClient.java
...rg/skywalking/apm/collector/client/redis/RedisClient.java
+2
-2
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/redis/RedisClientException.java
...king/apm/collector/client/redis/RedisClientException.java
+1
-1
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClient.java
...lking/apm/collector/client/zookeeper/ZookeeperClient.java
+1
-1
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClientException.java
.../collector/client/zookeeper/ZookeeperClientException.java
+1
-1
apm-collector/apm-collector-component/server-component/pom.xml
...ollector/apm-collector-component/server-component/pom.xml
+21
-0
apm-collector/apm-collector-component/server-component/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServer.java
.../org/skywalking/apm/collector/server/grpc/GRPCServer.java
+4
-4
apm-collector/apm-collector-component/server-component/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServerException.java
...alking/apm/collector/server/grpc/GRPCServerException.java
+1
-1
apm-collector/apm-collector-core/pom.xml
apm-collector/apm-collector-core/pom.xml
+12
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/client/Client.java
...kywalking/apm/collector/core/component/client/Client.java
+1
-1
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/client/ClientException.java
.../apm/collector/core/component/client/ClientException.java
+1
-1
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/server/Server.java
...kywalking/apm/collector/core/component/server/Server.java
+35
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/server/ServerException.java
.../apm/collector/core/component/server/ServerException.java
+35
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/server/ServerHandler.java
...ng/apm/collector/core/component/server/ServerHandler.java
+25
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/server/ServerHolder.java
...ing/apm/collector/core/component/server/ServerHolder.java
+72
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/server/ServerModuleDefine.java
...m/collector/core/component/server/ServerModuleDefine.java
+27
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/Module.java
...java/org/skywalking/apm/collector/core/module/Module.java
+1
-1
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/BytesUtils.java
...va/org/skywalking/apm/collector/core/util/BytesUtils.java
+43
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/CollectionUtils.java
...g/skywalking/apm/collector/core/util/CollectionUtils.java
+48
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ColumnNameUtils.java
...g/skywalking/apm/collector/core/util/ColumnNameUtils.java
+44
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/Const.java
...in/java/org/skywalking/apm/collector/core/util/Const.java
+35
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/DefinitionLoader.java
.../skywalking/apm/collector/core/util/DefinitionLoader.java
+96
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ObjectUtils.java
...a/org/skywalking/apm/collector/core/util/ObjectUtils.java
+32
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ResourceUtils.java
...org/skywalking/apm/collector/core/util/ResourceUtils.java
+40
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/StringUtils.java
...a/org/skywalking/apm/collector/core/util/StringUtils.java
+35
-0
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/TimeBucketUtils.java
...g/skywalking/apm/collector/core/util/TimeBucketUtils.java
+126
-0
apm-collector/apm-collector-naming/collector-naming-jetty-provider/pom.xml
...-collector-naming/collector-naming-jetty-provider/pom.xml
+5
-0
apm-collector/apm-collector-naming/collector-naming-jetty-provider/src/main/java/org/skywalking/apm/collector/naming/jetty/handler/AgentGRPCNamingHandler.java
...ollector/naming/jetty/handler/AgentGRPCNamingHandler.java
+48
-0
apm-collector/apm-collector-naming/collector-naming-jetty-provider/src/main/java/org/skywalking/apm/collector/naming/jetty/handler/AgentJettyNamingHandler.java
...llector/naming/jetty/handler/AgentJettyNamingHandler.java
+47
-0
apm-collector/apm-collector-naming/collector-naming-jetty-provider/src/main/java/org/skywalking/apm/collector/naming/jetty/handler/UIJettyNamingHandler.java
.../collector/naming/jetty/handler/UIJettyNamingHandler.java
+47
-0
未找到文件。
apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Handler.java
浏览文件 @
e4145700
...
...
@@ -21,5 +21,5 @@ package org.skywalking.apm.collector.core.framework;
/**
* @author peng-yongsheng
*/
public
interface
Handler
{
public
interface
Server
Handler
{
}
apm-collector/apm-collector-cluster/collector-cluster-define/src/main/java/org/skywalking/apm/collector/cluster/ClusterModule.java
浏览文件 @
e4145700
...
...
@@ -19,6 +19,7 @@
package
org.skywalking.apm.collector.cluster
;
import
org.skywalking.apm.collector.cluster.service.ModuleRegisterService
;
import
org.skywalking.apm.collector.cluster.service.ModuleRegistrationGetService
;
import
org.skywalking.apm.collector.core.module.Module
;
import
org.skywalking.apm.collector.core.module.Service
;
...
...
@@ -34,6 +35,6 @@ public class ClusterModule extends Module {
}
@Override
public
Class
<?
extends
Service
>[]
services
()
{
return
new
Class
[]
{
ModuleRegisterService
.
class
};
return
new
Class
[]
{
ModuleRegisterService
.
class
,
ModuleRegistrationGetService
.
class
};
}
}
apm-collector/apm-collector-cluster/collector-cluster-define/src/main/java/org/skywalking/apm/collector/cluster/service/ModuleRegistrationGetService.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.cluster.service
;
import
java.util.Set
;
import
org.skywalking.apm.collector.core.module.Service
;
/**
* @author peng-yongsheng
*/
public
interface
ModuleRegistrationGetService
extends
Service
{
Set
<
String
>
get
(
String
path
);
}
apm-collector/apm-collector-cluster/collector-cluster-redis-provider/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterModuleRedisProvider.java
浏览文件 @
e4145700
...
...
@@ -21,6 +21,7 @@ package org.skywalking.apm.collector.cluster.redis;
import
java.util.Properties
;
import
org.skywalking.apm.collector.cluster.ClusterModule
;
import
org.skywalking.apm.collector.cluster.redis.service.RedisModuleRegisterService
;
import
org.skywalking.apm.collector.cluster.redis.service.RedisModuleRegistrationGetService
;
import
org.skywalking.apm.collector.cluster.service.ModuleRegisterService
;
import
org.skywalking.apm.collector.core.module.Module
;
import
org.skywalking.apm.collector.core.module.ModuleProvider
;
...
...
@@ -41,6 +42,7 @@ public class ClusterModuleRedisProvider extends ModuleProvider {
@Override
public
void
prepare
(
Properties
config
)
throws
ServiceNotProvidedException
{
this
.
registerServiceImplementation
(
ModuleRegisterService
.
class
,
new
RedisModuleRegisterService
());
this
.
registerServiceImplementation
(
ModuleRegisterService
.
class
,
new
RedisModuleRegistrationGetService
());
}
@Override
public
void
init
(
Properties
config
)
throws
ServiceNotProvidedException
{
...
...
apm-collector/apm-collector-cluster/collector-cluster-redis-provider/src/main/java/org/skywalking/apm/collector/cluster/redis/service/RedisModuleRegistrationGetService.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.cluster.redis.service
;
import
java.util.Set
;
import
org.skywalking.apm.collector.cluster.service.ModuleRegistrationGetService
;
/**
* @author peng-yongsheng
*/
public
class
RedisModuleRegistrationGetService
implements
ModuleRegistrationGetService
{
@Override
public
Set
<
String
>
get
(
String
path
)
{
return
null
;
}
}
apm-collector/apm-collector-cluster/collector-cluster-standalone-provider/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterModuleStandaloneProvider.java
浏览文件 @
e4145700
...
...
@@ -22,6 +22,7 @@ import java.util.Properties;
import
org.skywalking.apm.collector.cluster.ClusterModule
;
import
org.skywalking.apm.collector.cluster.service.ModuleRegisterService
;
import
org.skywalking.apm.collector.cluster.standalone.service.StandaloneModuleRegisterService
;
import
org.skywalking.apm.collector.cluster.standalone.service.StandaloneModuleRegistrationGetService
;
import
org.skywalking.apm.collector.core.module.Module
;
import
org.skywalking.apm.collector.core.module.ModuleProvider
;
import
org.skywalking.apm.collector.core.module.ServiceNotProvidedException
;
...
...
@@ -41,6 +42,7 @@ public class ClusterModuleStandaloneProvider extends ModuleProvider {
@Override
public
void
prepare
(
Properties
config
)
throws
ServiceNotProvidedException
{
this
.
registerServiceImplementation
(
ModuleRegisterService
.
class
,
new
StandaloneModuleRegisterService
());
this
.
registerServiceImplementation
(
ModuleRegisterService
.
class
,
new
StandaloneModuleRegistrationGetService
());
}
@Override
public
void
init
(
Properties
config
)
throws
ServiceNotProvidedException
{
...
...
apm-collector/apm-collector-cluster/collector-cluster-standalone-provider/src/main/java/org/skywalking/apm/collector/cluster/standalone/service/StandaloneModuleRegistrationGetService.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.cluster.standalone.service
;
import
java.util.Set
;
import
org.skywalking.apm.collector.cluster.service.ModuleRegistrationGetService
;
/**
* @author peng-yongsheng
*/
public
class
StandaloneModuleRegistrationGetService
implements
ModuleRegistrationGetService
{
@Override
public
Set
<
String
>
get
(
String
path
)
{
return
null
;
}
}
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterModuleZ
K
Provider.java
→
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterModuleZ
ookeeper
Provider.java
浏览文件 @
e4145700
...
...
@@ -21,7 +21,8 @@ package org.skywalking.apm.collector.cluster.zookeeper;
import
java.util.Properties
;
import
org.skywalking.apm.collector.cluster.ClusterModule
;
import
org.skywalking.apm.collector.cluster.service.ModuleRegisterService
;
import
org.skywalking.apm.collector.cluster.zookeeper.service.ZKModuleRegisterService
;
import
org.skywalking.apm.collector.cluster.zookeeper.service.ZookeeperModuleRegisterService
;
import
org.skywalking.apm.collector.cluster.zookeeper.service.ZookeeperModuleRegistrationGetService
;
import
org.skywalking.apm.collector.core.module.Module
;
import
org.skywalking.apm.collector.core.module.ModuleProvider
;
import
org.skywalking.apm.collector.core.module.ServiceNotProvidedException
;
...
...
@@ -29,7 +30,7 @@ import org.skywalking.apm.collector.core.module.ServiceNotProvidedException;
/**
* @author peng-yongsheng
*/
public
class
ClusterModuleZ
K
Provider
extends
ModuleProvider
{
public
class
ClusterModuleZ
ookeeper
Provider
extends
ModuleProvider
{
@Override
public
String
name
()
{
return
"zookeeper"
;
...
...
@@ -40,7 +41,8 @@ public class ClusterModuleZKProvider extends ModuleProvider {
}
@Override
public
void
prepare
(
Properties
config
)
throws
ServiceNotProvidedException
{
this
.
registerServiceImplementation
(
ModuleRegisterService
.
class
,
new
ZKModuleRegisterService
());
this
.
registerServiceImplementation
(
ModuleRegisterService
.
class
,
new
ZookeeperModuleRegisterService
());
this
.
registerServiceImplementation
(
ModuleRegisterService
.
class
,
new
ZookeeperModuleRegistrationGetService
());
}
@Override
public
void
init
(
Properties
config
)
throws
ServiceNotProvidedException
{
...
...
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/service/Z
K
ModuleRegisterService.java
→
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/service/Z
ookeeper
ModuleRegisterService.java
浏览文件 @
e4145700
...
...
@@ -23,5 +23,5 @@ import org.skywalking.apm.collector.cluster.service.ModuleRegisterService;
/**
* @author peng-yongsheng
*/
public
class
Z
K
ModuleRegisterService
implements
ModuleRegisterService
{
public
class
Z
ookeeper
ModuleRegisterService
implements
ModuleRegisterService
{
}
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/service/ZookeeperModuleRegistrationGetService.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.cluster.zookeeper.service
;
import
java.util.Set
;
import
org.skywalking.apm.collector.cluster.service.ModuleRegistrationGetService
;
/**
* @author peng-yongsheng
*/
public
class
ZookeeperModuleRegistrationGetService
implements
ModuleRegistrationGetService
{
@Override
public
Set
<
String
>
get
(
String
path
)
{
return
null
;
}
}
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/resources/META-INF/services/org.skywalking.apm.collector.core.module.ModuleProvider
浏览文件 @
e4145700
...
...
@@ -16,4 +16,4 @@
# Project repository: https://github.com/OpenSkywalking/skywalking
#
org.skywalking.apm.collector.cluster.zookeeper.ClusterModuleZKProvider
\ No newline at end of file
org.skywalking.apm.collector.cluster.zookeeper.ClusterModuleZookeeperProvider
\ No newline at end of file
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClient.java
浏览文件 @
e4145700
...
...
@@ -38,8 +38,8 @@ import org.elasticsearch.common.settings.Settings;
import
org.elasticsearch.common.transport.InetSocketTransportAddress
;
import
org.elasticsearch.common.xcontent.XContentBuilder
;
import
org.elasticsearch.transport.client.PreBuiltTransportClient
;
import
org.skywalking.apm.collector.core.client.Client
;
import
org.skywalking.apm.collector.core.client.ClientException
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.Client
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.ClientException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClientException.java
浏览文件 @
e4145700
...
...
@@ -18,7 +18,7 @@
package
org.skywalking.apm.collector.client.elasticsearch
;
import
org.skywalking.apm.collector.core.client.ClientException
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.ClientException
;
/**
* @author peng-yongsheng
...
...
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClient.java
浏览文件 @
e4145700
...
...
@@ -20,8 +20,8 @@ package org.skywalking.apm.collector.client.grpc;
import
io.grpc.ManagedChannel
;
import
io.grpc.ManagedChannelBuilder
;
import
org.skywalking.apm.collector.core.client.Client
;
import
org.skywalking.apm.collector.core.client.ClientException
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.Client
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.ClientException
;
/**
* @author peng-yongsheng
...
...
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClientException.java
浏览文件 @
e4145700
...
...
@@ -18,7 +18,7 @@
package
org.skywalking.apm.collector.client.grpc
;
import
org.skywalking.apm.collector.core.client.ClientException
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.ClientException
;
/**
* @author peng-yongsheng
...
...
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/h2/H2Client.java
浏览文件 @
e4145700
...
...
@@ -25,7 +25,7 @@ import java.sql.ResultSet;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.util.IOUtils
;
import
org.skywalking.apm.collector.core.client.Client
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.Client
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/h2/H2ClientException.java
浏览文件 @
e4145700
...
...
@@ -18,7 +18,7 @@
package
org.skywalking.apm.collector.client.h2
;
import
org.skywalking.apm.collector.core.client.ClientException
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.ClientException
;
/**
* @author peng-yongsheng
...
...
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/redis/RedisClient.java
浏览文件 @
e4145700
...
...
@@ -18,8 +18,8 @@
package
org.skywalking.apm.collector.client.redis
;
import
org.skywalking.apm.collector.core.client.Client
;
import
org.skywalking.apm.collector.core.client.ClientException
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.Client
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.ClientException
;
import
redis.clients.jedis.Jedis
;
/**
...
...
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/redis/RedisClientException.java
浏览文件 @
e4145700
...
...
@@ -18,7 +18,7 @@
package
org.skywalking.apm.collector.client.redis
;
import
org.skywalking.apm.collector.core.client.ClientException
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.ClientException
;
/**
* @author peng-yongsheng
...
...
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClient.java
浏览文件 @
e4145700
...
...
@@ -26,7 +26,7 @@ import org.apache.zookeeper.Watcher;
import
org.apache.zookeeper.ZooKeeper
;
import
org.apache.zookeeper.data.ACL
;
import
org.apache.zookeeper.data.Stat
;
import
org.skywalking.apm.collector.core.client.Client
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.Client
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
apm-collector/apm-collector-component/client-component/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClientException.java
浏览文件 @
e4145700
...
...
@@ -18,7 +18,7 @@
package
org.skywalking.apm.collector.client.zookeeper
;
import
org.skywalking.apm.collector.core.client.ClientException
;
import
org.skywalking.apm.collector.core.c
omponent.c
lient.ClientException
;
/**
* @author peng-yongsheng
...
...
apm-collector/apm-collector-component/server-component/pom.xml
浏览文件 @
e4145700
...
...
@@ -12,4 +12,25 @@
<artifactId>
server-component
</artifactId>
<packaging>
jar
</packaging>
<properties>
<jetty.version>
9.4.2.v20170220
</jetty.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-network
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.jetty
</groupId>
<artifactId>
jetty-server
</artifactId>
<version>
${jetty.version}
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.jetty
</groupId>
<artifactId>
jetty-servlet
</artifactId>
<version>
${jetty.version}
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
apm-collector/apm-collector-component/server-component/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServer.java
浏览文件 @
e4145700
...
...
@@ -21,9 +21,9 @@ package org.skywalking.apm.collector.server.grpc;
import
io.grpc.netty.NettyServerBuilder
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
import
org.skywalking.apm.collector.core.
framework.Handl
er
;
import
org.skywalking.apm.collector.core.
server.Server
;
import
org.skywalking.apm.collector.core.
server.ServerException
;
import
org.skywalking.apm.collector.core.
component.server.Serv
er
;
import
org.skywalking.apm.collector.core.
component.server.ServerException
;
import
org.skywalking.apm.collector.core.
component.server.ServerHandler
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -67,7 +67,7 @@ public class GRPCServer implements Server {
}
}
@Override
public
void
addHandler
(
Handler
handler
)
{
@Override
public
void
addHandler
(
Server
Handler
handler
)
{
nettyServerBuilder
.
addService
((
io
.
grpc
.
BindableService
)
handler
);
}
}
apm-collector/apm-collector-component/server-component/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServerException.java
浏览文件 @
e4145700
...
...
@@ -18,7 +18,7 @@
package
org.skywalking.apm.collector.server.grpc
;
import
org.skywalking.apm.collector.core.server.ServerException
;
import
org.skywalking.apm.collector.core.
component.
server.ServerException
;
/**
* @author peng-yongsheng
...
...
apm-collector/apm-collector-core/pom.xml
浏览文件 @
e4145700
...
...
@@ -12,4 +12,16 @@
<artifactId>
apm-collector-core
</artifactId>
<packaging>
jar
</packaging>
<dependencies>
<dependency>
<groupId>
org.yaml
</groupId>
<artifactId>
snakeyaml
</artifactId>
<version>
1.18
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.8.1
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/Client.java
→
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/c
omponent/c
lient/Client.java
浏览文件 @
e4145700
...
...
@@ -16,7 +16,7 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.client
;
package
org.skywalking.apm.collector.core.c
omponent.c
lient
;
/**
* @author peng-yongsheng
...
...
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/ClientException.java
→
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/c
omponent/c
lient/ClientException.java
浏览文件 @
e4145700
...
...
@@ -16,7 +16,7 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.client
;
package
org.skywalking.apm.collector.core.c
omponent.c
lient
;
import
org.skywalking.apm.collector.core.CollectorException
;
...
...
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/server/Server.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.component.server
;
/**
* @author peng-yongsheng
*/
public
interface
Server
{
String
hostPort
();
String
serverClassify
();
void
initialize
()
throws
ServerException
;
void
start
()
throws
ServerException
;
void
addHandler
(
ServerHandler
handler
);
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/server/ServerException.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.component.server
;
import
org.skywalking.apm.collector.core.CollectorException
;
/**
* @author peng-yongsheng
*/
public
abstract
class
ServerException
extends
CollectorException
{
public
ServerException
(
String
message
)
{
super
(
message
);
}
public
ServerException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/server/ServerHandler.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.component.server
;
/**
* @author peng-yongsheng
*/
public
interface
ServerHandler
{
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/server/ServerHolder.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.component.server
;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.skywalking.apm.collector.core.util.CollectionUtils
;
import
org.skywalking.apm.collector.core.util.ObjectUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
ServerHolder
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ServerHolder
.
class
);
private
List
<
Server
>
servers
;
public
ServerHolder
()
{
servers
=
new
LinkedList
<>();
}
public
void
holdServer
(
Server
newServer
,
List
<
ServerHandler
>
handlers
)
throws
ServerException
{
if
(
ObjectUtils
.
isEmpty
(
newServer
)
||
CollectionUtils
.
isEmpty
(
handlers
))
{
return
;
}
boolean
isNewServer
=
true
;
for
(
Server
server
:
servers
)
{
if
(
server
.
hostPort
().
equals
(
newServer
.
hostPort
())
&&
server
.
serverClassify
().
equals
(
newServer
.
serverClassify
()))
{
isNewServer
=
false
;
addHandler
(
handlers
,
server
);
}
}
if
(
isNewServer
)
{
newServer
.
initialize
();
servers
.
add
(
newServer
);
addHandler
(
handlers
,
newServer
);
}
}
private
void
addHandler
(
List
<
ServerHandler
>
handlers
,
Server
server
)
{
if
(
CollectionUtils
.
isNotEmpty
(
handlers
))
{
handlers
.
forEach
(
handler
->
{
server
.
addHandler
(
handler
);
logger
.
debug
(
"add handler into server: {}, handler name: {}"
,
server
.
hostPort
(),
handler
.
getClass
().
getName
());
});
}
}
public
List
<
Server
>
getServers
()
{
return
servers
;
}
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/component/server/ServerModuleDefine.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.component.server
;
import
org.skywalking.apm.collector.core.module.ModuleDefine
;
/**
* @author peng-yongsheng
*/
public
abstract
class
ServerModuleDefine
extends
ModuleDefine
{
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/Module.java
浏览文件 @
e4145700
...
...
@@ -38,7 +38,7 @@ public abstract class Module {
/**
* @return the {@link Service} provided by this module.
*/
public
abstract
Class
<?
extends
Service
>
[]
services
();
public
abstract
Class
[]
services
();
/**
* Run the prepare stage for the module, including finding all potential providers, and asking them to prepare.
...
...
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/BytesUtils.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.util
;
/**
* @author peng-yongsheng
*/
public
class
BytesUtils
{
public
static
byte
[]
long2Bytes
(
long
num
)
{
byte
[]
byteNum
=
new
byte
[
8
];
for
(
int
ix
=
0
;
ix
<
8
;
++
ix
)
{
int
offset
=
64
-
(
ix
+
1
)
*
8
;
byteNum
[
ix
]
=
(
byte
)((
num
>>
offset
)
&
0xff
);
}
return
byteNum
;
}
public
static
long
bytes2Long
(
byte
[]
byteNum
)
{
long
num
=
0
;
for
(
int
ix
=
0
;
ix
<
8
;
++
ix
)
{
num
<<=
8
;
num
|=
byteNum
[
ix
]
&
0xff
;
}
return
num
;
}
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/CollectionUtils.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.util
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author peng-yongsheng
*/
public
class
CollectionUtils
{
public
static
boolean
isEmpty
(
Map
map
)
{
return
map
==
null
||
map
.
size
()
==
0
;
}
public
static
boolean
isEmpty
(
List
list
)
{
return
list
==
null
||
list
.
size
()
==
0
;
}
public
static
boolean
isNotEmpty
(
List
list
)
{
return
!
isEmpty
(
list
);
}
public
static
boolean
isNotEmpty
(
Map
map
)
{
return
!
isEmpty
(
map
);
}
public
static
<
T
>
boolean
isNotEmpty
(
T
[]
array
)
{
return
array
!=
null
&&
array
.
length
>
0
;
}
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ColumnNameUtils.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.util
;
/**
* @author peng-yongsheng
*/
public
enum
ColumnNameUtils
{
INSTANCE
;
public
String
rename
(
String
columnName
)
{
StringBuilder
renamedColumnName
=
new
StringBuilder
();
char
[]
chars
=
columnName
.
toLowerCase
().
toCharArray
();
boolean
findUnderline
=
false
;
for
(
char
character
:
chars
)
{
if
(
character
==
'_'
)
{
findUnderline
=
true
;
}
else
if
(
findUnderline
)
{
renamedColumnName
.
append
(
String
.
valueOf
(
character
).
toUpperCase
());
findUnderline
=
false
;
}
else
{
renamedColumnName
.
append
(
character
);
}
}
return
renamedColumnName
.
toString
();
}
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/Const.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.util
;
/**
* @author peng-yongsheng
*/
public
class
Const
{
public
static
final
String
ID_SPLIT
=
"_"
;
public
static
final
int
USER_ID
=
1
;
public
static
final
int
NONE_SERVICE_ID
=
1
;
public
static
final
String
NONE_SERVICE_NAME
=
"None"
;
public
static
final
String
USER_CODE
=
"User"
;
public
static
final
String
SEGMENT_SPAN_SPLIT
=
"S"
;
public
static
final
String
UNKNOWN
=
"Unknown"
;
public
static
final
String
EXCEPTION
=
"Exception"
;
public
static
final
String
EMPTY_STRING
=
""
;
public
static
final
String
FILE_SUFFIX
=
"sw"
;
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/DefinitionLoader.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.util
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.net.URL
;
import
java.util.Enumeration
;
import
java.util.Iterator
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Properties
;
import
org.skywalking.apm.collector.core.framework.DefinitionFile
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author peng-yongsheng
*/
public
class
DefinitionLoader
<
D
>
implements
Iterable
<
D
>
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DefinitionLoader
.
class
);
private
final
Class
<
D
>
definition
;
private
final
DefinitionFile
definitionFile
;
protected
DefinitionLoader
(
Class
<
D
>
svc
,
DefinitionFile
definitionFile
)
{
this
.
definition
=
Objects
.
requireNonNull
(
svc
,
"definition interface cannot be null"
);
this
.
definitionFile
=
definitionFile
;
}
public
static
<
D
>
DefinitionLoader
<
D
>
load
(
Class
<
D
>
definition
,
DefinitionFile
definitionFile
)
{
return
new
DefinitionLoader
(
definition
,
definitionFile
);
}
@Override
public
final
Iterator
<
D
>
iterator
()
{
logger
.
info
(
"load definition file: {}"
,
definitionFile
.
get
());
List
<
String
>
definitionList
=
new
LinkedList
<>();
try
{
Enumeration
<
URL
>
urlEnumeration
=
this
.
getClass
().
getClassLoader
().
getResources
(
definitionFile
.
get
());
while
(
urlEnumeration
.
hasMoreElements
())
{
URL
definitionFileURL
=
urlEnumeration
.
nextElement
();
logger
.
info
(
"definition file url: {}"
,
definitionFileURL
.
getPath
());
BufferedReader
bufferedReader
=
new
BufferedReader
(
new
InputStreamReader
(
definitionFileURL
.
openStream
()));
Properties
properties
=
new
Properties
();
properties
.
load
(
bufferedReader
);
Enumeration
defineItem
=
properties
.
propertyNames
();
while
(
defineItem
.
hasMoreElements
())
{
String
fullNameClass
=
(
String
)
defineItem
.
nextElement
();
definitionList
.
add
(
fullNameClass
);
}
}
}
catch
(
IOException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
Iterator
<
String
>
moduleDefineIterator
=
definitionList
.
iterator
();
return
new
Iterator
<
D
>()
{
@Override
public
boolean
hasNext
()
{
return
moduleDefineIterator
.
hasNext
();
}
@Override
public
D
next
()
{
String
definitionClass
=
moduleDefineIterator
.
next
();
logger
.
info
(
"definitionClass: {}"
,
definitionClass
);
try
{
Class
c
=
Class
.
forName
(
definitionClass
);
return
(
D
)
c
.
newInstance
();
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
};
}
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ObjectUtils.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.util
;
/**
* @author peng-yongsheng
*/
public
class
ObjectUtils
{
public
static
boolean
isEmpty
(
Object
obj
)
{
return
obj
==
null
;
}
public
static
boolean
isNotEmpty
(
Object
obj
)
{
return
!
isEmpty
(
obj
);
}
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ResourceUtils.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.util
;
import
java.io.FileNotFoundException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.Reader
;
import
java.net.URL
;
/**
* @author peng-yongsheng
*/
public
class
ResourceUtils
{
public
static
Reader
read
(
String
fileName
)
throws
FileNotFoundException
{
URL
url
=
ResourceUtils
.
class
.
getClassLoader
().
getResource
(
fileName
);
if
(
url
==
null
)
{
throw
new
FileNotFoundException
(
"file not found: "
+
fileName
);
}
InputStream
inputStream
=
ResourceUtils
.
class
.
getClassLoader
().
getResourceAsStream
(
fileName
);
return
new
InputStreamReader
(
inputStream
);
}
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/StringUtils.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.util
;
/**
* @author peng-yongsheng
*/
public
class
StringUtils
{
public
static
final
String
EMPTY_STRING
=
""
;
public
static
boolean
isEmpty
(
Object
str
)
{
return
str
==
null
||
EMPTY_STRING
.
equals
(
str
);
}
public
static
boolean
isNotEmpty
(
Object
str
)
{
return
!
isEmpty
(
str
);
}
}
apm-collector/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/TimeBucketUtils.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.core.util
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.TimeZone
;
import
org.skywalking.apm.collector.core.framework.UnexpectedException
;
/**
* @author peng-yongsheng
*/
public
enum
TimeBucketUtils
{
INSTANCE
;
private
final
SimpleDateFormat
dayDateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
private
final
SimpleDateFormat
hourDateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHH"
);
private
final
SimpleDateFormat
minuteDateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmm"
);
private
final
SimpleDateFormat
secondDateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
public
long
getMinuteTimeBucket
(
long
time
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
time
);
String
timeStr
=
minuteDateFormat
.
format
(
calendar
.
getTime
());
return
Long
.
valueOf
(
timeStr
);
}
public
long
getSecondTimeBucket
(
long
time
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
time
);
String
timeStr
=
secondDateFormat
.
format
(
calendar
.
getTime
());
return
Long
.
valueOf
(
timeStr
);
}
public
long
getHourTimeBucket
(
long
time
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
time
);
String
timeStr
=
hourDateFormat
.
format
(
calendar
.
getTime
())
+
"00"
;
return
Long
.
valueOf
(
timeStr
);
}
public
long
getDayTimeBucket
(
long
time
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
time
);
String
timeStr
=
dayDateFormat
.
format
(
calendar
.
getTime
())
+
"0000"
;
return
Long
.
valueOf
(
timeStr
);
}
public
long
changeTimeBucket2TimeStamp
(
String
timeBucketType
,
long
timeBucket
)
{
if
(
TimeBucketType
.
SECOND
.
name
().
toLowerCase
().
equals
(
timeBucketType
.
toLowerCase
()))
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
Calendar
.
YEAR
,
Integer
.
valueOf
(
String
.
valueOf
(
timeBucket
).
substring
(
0
,
4
)));
calendar
.
set
(
Calendar
.
MONTH
,
Integer
.
valueOf
(
String
.
valueOf
(
timeBucket
).
substring
(
4
,
6
))
-
1
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
Integer
.
valueOf
(
String
.
valueOf
(
timeBucket
).
substring
(
6
,
8
)));
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
Integer
.
valueOf
(
String
.
valueOf
(
timeBucket
).
substring
(
8
,
10
)));
calendar
.
set
(
Calendar
.
MINUTE
,
Integer
.
valueOf
(
String
.
valueOf
(
timeBucket
).
substring
(
10
,
12
)));
calendar
.
set
(
Calendar
.
SECOND
,
Integer
.
valueOf
(
String
.
valueOf
(
timeBucket
).
substring
(
12
,
14
)));
return
calendar
.
getTimeInMillis
();
}
else
if
(
TimeBucketType
.
MINUTE
.
name
().
toLowerCase
().
equals
(
timeBucketType
.
toLowerCase
()))
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
Calendar
.
YEAR
,
Integer
.
valueOf
(
String
.
valueOf
(
timeBucket
).
substring
(
0
,
4
)));
calendar
.
set
(
Calendar
.
MONTH
,
Integer
.
valueOf
(
String
.
valueOf
(
timeBucket
).
substring
(
4
,
6
))
-
1
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
Integer
.
valueOf
(
String
.
valueOf
(
timeBucket
).
substring
(
6
,
8
)));
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
Integer
.
valueOf
(
String
.
valueOf
(
timeBucket
).
substring
(
8
,
10
)));
calendar
.
set
(
Calendar
.
MINUTE
,
Integer
.
valueOf
(
String
.
valueOf
(
timeBucket
).
substring
(
10
,
12
)));
return
calendar
.
getTimeInMillis
();
}
else
{
throw
new
UnexpectedException
(
"time bucket type must be second or minute"
);
}
}
public
long
[]
getFiveSecondTimeBuckets
(
long
secondTimeBucket
)
{
long
timeStamp
=
changeTimeBucket2TimeStamp
(
TimeBucketType
.
SECOND
.
name
(),
secondTimeBucket
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
timeStamp
);
long
[]
timeBuckets
=
new
long
[
5
];
timeBuckets
[
0
]
=
secondTimeBucket
;
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
calendar
.
add
(
Calendar
.
SECOND
,
-
1
);
timeBuckets
[
i
+
1
]
=
getSecondTimeBucket
(
calendar
.
getTimeInMillis
());
}
return
timeBuckets
;
}
public
long
changeToUTCTimeBucket
(
long
timeBucket
)
{
String
timeBucketStr
=
String
.
valueOf
(
timeBucket
);
if
(
TimeZone
.
getDefault
().
getID
().
equals
(
"GMT+08:00"
)
||
timeBucketStr
.
endsWith
(
"0000"
))
{
return
timeBucket
;
}
else
{
return
timeBucket
-
800
;
}
}
public
long
addSecondForSecondTimeBucket
(
String
timeBucketType
,
long
timeBucket
,
int
second
)
{
if
(!
TimeBucketType
.
SECOND
.
name
().
equals
(
timeBucketType
))
{
throw
new
UnexpectedException
(
"time bucket type must be second "
);
}
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
changeTimeBucket2TimeStamp
(
timeBucketType
,
timeBucket
));
calendar
.
add
(
Calendar
.
SECOND
,
second
);
return
getSecondTimeBucket
(
calendar
.
getTimeInMillis
());
}
public
enum
TimeBucketType
{
SECOND
,
MINUTE
,
HOUR
,
DAY
}
}
apm-collector/apm-collector-naming/collector-naming-jetty-provider/pom.xml
浏览文件 @
e4145700
...
...
@@ -41,5 +41,10 @@
<artifactId>
collector-cluster-define
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
server-component
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
apm-collector/apm-collector-naming/collector-naming-jetty-provider/src/main/java/org/skywalking/apm/collector/naming/jetty/handler/AgentGRPCNamingHandler.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.naming.jetty.handler
;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonElement
;
import
javax.servlet.http.HttpServletRequest
;
import
org.skywalking.apm.collector.server.jetty.ArgumentsParseException
;
import
org.skywalking.apm.collector.server.jetty.JettyHandler
;
/**
* @author peng-yongsheng
*/
public
class
AgentGRPCNamingHandler
extends
JettyHandler
{
@Override
public
String
pathSpec
()
{
return
"/agentstream/grpc"
;
}
@Override
protected
JsonElement
doGet
(
HttpServletRequest
req
)
throws
ArgumentsParseException
{
// ModuleManager
// ClusterModuleRegistrationReader reader = CollectorContextHelper.INSTANCE.getClusterModuleContext().getReader();
// Set<String> servers = reader.read(AgentStreamGRPCDataListener.PATH);
JsonArray
serverArray
=
new
JsonArray
();
// servers.forEach(serverArray::add);
return
serverArray
;
}
@Override
protected
JsonElement
doPost
(
HttpServletRequest
req
)
throws
ArgumentsParseException
{
throw
new
UnsupportedOperationException
();
}
}
apm-collector/apm-collector-naming/collector-naming-jetty-provider/src/main/java/org/skywalking/apm/collector/naming/jetty/handler/AgentJettyNamingHandler.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.naming.jetty.handler
;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonElement
;
import
javax.servlet.http.HttpServletRequest
;
import
org.skywalking.apm.collector.server.jetty.ArgumentsParseException
;
import
org.skywalking.apm.collector.server.jetty.JettyHandler
;
/**
* @author peng-yongsheng
*/
public
class
AgentJettyNamingHandler
extends
JettyHandler
{
@Override
public
String
pathSpec
()
{
return
"/agentstream/jetty"
;
}
@Override
protected
JsonElement
doGet
(
HttpServletRequest
req
)
throws
ArgumentsParseException
{
// ClusterModuleRegistrationReader reader = CollectorContextHelper.INSTANCE.getClusterModuleContext().getReader();
// Set<String> servers = reader.read(AgentStreamJettyDataListener.PATH);
JsonArray
serverArray
=
new
JsonArray
();
// servers.forEach(serverArray::add);
return
serverArray
;
}
@Override
protected
JsonElement
doPost
(
HttpServletRequest
req
)
throws
ArgumentsParseException
{
throw
new
UnsupportedOperationException
();
}
}
apm-collector/apm-collector-naming/collector-naming-jetty-provider/src/main/java/org/skywalking/apm/collector/naming/jetty/handler/UIJettyNamingHandler.java
0 → 100644
浏览文件 @
e4145700
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.collector.naming.jetty.handler
;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonElement
;
import
javax.servlet.http.HttpServletRequest
;
import
org.skywalking.apm.collector.server.jetty.ArgumentsParseException
;
import
org.skywalking.apm.collector.server.jetty.JettyHandler
;
/**
* @author peng-yongsheng
*/
public
class
UIJettyNamingHandler
extends
JettyHandler
{
@Override
public
String
pathSpec
()
{
return
"/ui/jetty"
;
}
@Override
protected
JsonElement
doGet
(
HttpServletRequest
req
)
throws
ArgumentsParseException
{
// ClusterModuleRegistrationReader reader = CollectorContextHelper.INSTANCE.getClusterModuleContext().getReader();
// Set<String> servers = reader.read(UIJettyDataListener.PATH);
JsonArray
serverArray
=
new
JsonArray
();
// servers.forEach(serverArray::add);
return
serverArray
;
}
@Override
protected
JsonElement
doPost
(
HttpServletRequest
req
)
throws
ArgumentsParseException
{
throw
new
UnsupportedOperationException
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录