Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
41f41d12
S
SkyWalking
项目概览
apache
/
SkyWalking
上一次同步 大约 1 年
通知
302
Star
21345
Fork
6091
代码
文件
提交
分支
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
41f41d12
编写于
3月 16, 2018
作者:
wu-sheng
提交者:
GitHub
3月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support zk namespace (#955)
* Support zk namespace, #935 * Revert default changes.
上级
5bf79f3a
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
110 addition
and
20 deletion
+110
-20
apm-collector/apm-collector-cluster/collector-cluster-define/src/main/java/org/apache/skywalking/apm/collector/cluster/DataMonitor.java
.../apache/skywalking/apm/collector/cluster/DataMonitor.java
+2
-2
apm-collector/apm-collector-cluster/collector-cluster-standalone-provider/src/main/java/org/apache/skywalking/apm/collector/cluster/standalone/ClusterStandaloneDataMonitor.java
...ctor/cluster/standalone/ClusterStandaloneDataMonitor.java
+7
-3
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/pom.xml
...ctor-cluster/collector-cluster-zookeeper-provider/pom.xml
+5
-0
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/apache/skywalking/apm/collector/cluster/zookeeper/ClusterModuleZookeeperProvider.java
...tor/cluster/zookeeper/ClusterModuleZookeeperProvider.java
+7
-5
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/apache/skywalking/apm/collector/cluster/zookeeper/ClusterZKDataMonitor.java
...apm/collector/cluster/zookeeper/ClusterZKDataMonitor.java
+17
-9
apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModule.java
...king/apm/collector/configuration/ConfigurationModule.java
+2
-0
apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/service/ICollectorConfig.java
...apm/collector/configuration/service/ICollectorConfig.java
+31
-0
apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModuleProvider.java
.../collector/configuration/ConfigurationModuleProvider.java
+5
-1
apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/service/CollectorConfigService.java
...llector/configuration/service/CollectorConfigService.java
+34
-0
未找到文件。
apm-collector/apm-collector-cluster/collector-cluster-define/src/main/java/org/apache/skywalking/apm/collector/cluster/DataMonitor.java
浏览文件 @
41f41d12
...
...
@@ -26,8 +26,6 @@ import org.apache.skywalking.apm.collector.client.Client;
* @author peng-yongsheng
*/
public
interface
DataMonitor
{
String
BASE_CATALOG
=
"/skywalking"
;
void
setClient
(
Client
client
);
void
addListener
(
ClusterModuleListener
listener
)
throws
ClientException
;
...
...
@@ -39,4 +37,6 @@ public interface DataMonitor {
void
createPath
(
String
path
)
throws
ClientException
;
void
setData
(
String
path
,
String
value
)
throws
ClientException
;
String
getBaseCatalog
();
}
apm-collector/apm-collector-cluster/collector-cluster-standalone-provider/src/main/java/org/apache/skywalking/apm/collector/cluster/standalone/ClusterStandaloneDataMonitor.java
浏览文件 @
41f41d12
...
...
@@ -55,18 +55,18 @@ public class ClusterStandaloneDataMonitor implements DataMonitor {
@Override
public
void
addListener
(
ClusterModuleListener
listener
)
{
String
path
=
BASE_CATALOG
+
listener
.
path
();
String
path
=
getBaseCatalog
()
+
listener
.
path
();
logger
.
info
(
"listener path: {}"
,
path
);
listeners
.
put
(
path
,
listener
);
}
@Override
public
ClusterModuleListener
getListener
(
String
path
)
{
path
=
BASE_CATALOG
+
path
;
path
=
getBaseCatalog
()
+
path
;
return
listeners
.
get
(
path
);
}
@Override
public
void
register
(
String
path
,
ModuleRegistration
registration
)
{
registrations
.
put
(
BASE_CATALOG
+
path
,
registration
);
registrations
.
put
(
getBaseCatalog
()
+
path
,
registration
);
}
@Override
public
void
createPath
(
String
path
)
throws
ClientException
{
...
...
@@ -80,6 +80,10 @@ public class ClusterStandaloneDataMonitor implements DataMonitor {
}
}
@Override
public
String
getBaseCatalog
()
{
return
"/skywalking"
;
}
public
void
start
()
throws
CollectorException
{
Iterator
<
Map
.
Entry
<
String
,
ModuleRegistration
>>
entryIterator
=
registrations
.
entrySet
().
iterator
();
while
(
entryIterator
.
hasNext
())
{
...
...
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/pom.xml
浏览文件 @
41f41d12
...
...
@@ -34,5 +34,10 @@
<artifactId>
collector-cluster-define
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
collector-configuration-define
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/apache/skywalking/apm/collector/cluster/zookeeper/ClusterModuleZookeeperProvider.java
浏览文件 @
41f41d12
...
...
@@ -16,22 +16,23 @@
*
*/
package
org.apache.skywalking.apm.collector.cluster.zookeeper
;
import
java.util.Properties
;
import
org.apache.skywalking.apm.collector.client.zookeeper.ZookeeperClient
;
import
org.apache.skywalking.apm.collector.client.zookeeper.ZookeeperClientException
;
import
org.apache.skywalking.apm.collector.cluster.ClusterModule
;
import
org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService
;
import
org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService
;
import
org.apache.skywalking.apm.collector.cluster.zookeeper.service.ZookeeperModuleListenerService
;
import
org.apache.skywalking.apm.collector.cluster.zookeeper.service.ZookeeperModuleRegisterService
;
import
org.apache.skywalking.apm.collector.configuration.ConfigurationModule
;
import
org.apache.skywalking.apm.collector.configuration.service.ICollectorConfig
;
import
org.apache.skywalking.apm.collector.core.CollectorException
;
import
org.apache.skywalking.apm.collector.core.UnexpectedException
;
import
org.apache.skywalking.apm.collector.core.module.Module
;
import
org.apache.skywalking.apm.collector.core.module.ModuleProvider
;
import
org.apache.skywalking.apm.collector.core.module.ServiceNotProvidedException
;
import
org.apache.skywalking.apm.collector.client.zookeeper.ZookeeperClient
;
import
org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService
;
import
org.apache.skywalking.apm.collector.core.module.Module
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -69,6 +70,7 @@ public class ClusterModuleZookeeperProvider extends ModuleProvider {
}
@Override
public
void
start
(
Properties
config
)
throws
ServiceNotProvidedException
{
dataMonitor
.
setNamespace
(
getManager
().
find
(
ConfigurationModule
.
NAME
).
getService
(
ICollectorConfig
.
class
).
getNamespace
());
try
{
zookeeperClient
.
initialize
();
}
catch
(
ZookeeperClientException
e
)
{
...
...
@@ -85,7 +87,7 @@ public class ClusterModuleZookeeperProvider extends ModuleProvider {
}
@Override
public
String
[]
requiredModules
()
{
return
new
String
[
0
]
;
return
new
String
[
]
{
ConfigurationModule
.
NAME
}
;
}
}
apm-collector/apm-collector-cluster/collector-cluster-zookeeper-provider/src/main/java/org/apache/skywalking/apm/collector/cluster/zookeeper/ClusterZKDataMonitor.java
浏览文件 @
41f41d12
...
...
@@ -16,7 +16,6 @@
*
*/
package
org.apache.skywalking.apm.collector.cluster.zookeeper
;
import
java.util.HashSet
;
...
...
@@ -25,11 +24,6 @@ import java.util.LinkedHashMap;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
org.apache.zookeeper.CreateMode
;
import
org.apache.zookeeper.WatchedEvent
;
import
org.apache.zookeeper.Watcher
;
import
org.apache.zookeeper.ZooDefs
;
import
org.apache.zookeeper.data.Stat
;
import
org.apache.skywalking.apm.collector.client.Client
;
import
org.apache.skywalking.apm.collector.client.ClientException
;
import
org.apache.skywalking.apm.collector.client.zookeeper.ZookeeperClient
;
...
...
@@ -40,6 +34,11 @@ import org.apache.skywalking.apm.collector.cluster.DataMonitor;
import
org.apache.skywalking.apm.collector.cluster.ModuleRegistration
;
import
org.apache.skywalking.apm.collector.core.CollectorException
;
import
org.apache.skywalking.apm.collector.core.util.CollectionUtils
;
import
org.apache.zookeeper.CreateMode
;
import
org.apache.zookeeper.WatchedEvent
;
import
org.apache.zookeeper.Watcher
;
import
org.apache.zookeeper.ZooDefs
;
import
org.apache.zookeeper.data.Stat
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -54,6 +53,7 @@ public class ClusterZKDataMonitor implements DataMonitor, Watcher {
private
Map
<
String
,
ClusterModuleListener
>
listeners
;
private
Map
<
String
,
ModuleRegistration
>
registrations
;
private
String
namespace
;
public
ClusterZKDataMonitor
()
{
listeners
=
new
LinkedHashMap
<>();
...
...
@@ -130,17 +130,17 @@ public class ClusterZKDataMonitor implements DataMonitor, Watcher {
}
@Override
public
void
addListener
(
ClusterModuleListener
listener
)
{
String
path
=
BASE_CATALOG
+
listener
.
path
();
String
path
=
getBaseCatalog
()
+
listener
.
path
();
logger
.
info
(
"listener path: {}"
,
path
);
listeners
.
put
(
path
,
listener
);
}
@Override
public
void
register
(
String
path
,
ModuleRegistration
registration
)
{
registrations
.
put
(
BASE_CATALOG
+
path
,
registration
);
registrations
.
put
(
getBaseCatalog
()
+
path
,
registration
);
}
@Override
public
ClusterModuleListener
getListener
(
String
path
)
{
path
=
BASE_CATALOG
+
path
;
path
=
getBaseCatalog
()
+
path
;
return
listeners
.
get
(
path
);
}
...
...
@@ -163,4 +163,12 @@ public class ClusterZKDataMonitor implements DataMonitor, Watcher {
client
.
setData
(
path
,
value
.
getBytes
(),
-
1
);
}
}
@Override
public
String
getBaseCatalog
()
{
return
"/"
+
namespace
+
"/skywalking"
;
}
void
setNamespace
(
String
namespace
)
{
this
.
namespace
=
namespace
;
}
}
apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModule.java
浏览文件 @
41f41d12
...
...
@@ -21,6 +21,7 @@ package org.apache.skywalking.apm.collector.configuration;
import
org.apache.skywalking.apm.collector.configuration.service.IApdexThresholdService
;
import
org.apache.skywalking.apm.collector.configuration.service.IApplicationAlarmRuleConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.IApplicationReferenceAlarmRuleConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.ICollectorConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.IInstanceAlarmRuleConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.IInstanceReferenceAlarmRuleConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.IServiceAlarmRuleConfig
;
...
...
@@ -40,6 +41,7 @@ public class ConfigurationModule extends Module {
@Override
public
Class
[]
services
()
{
return
new
Class
[]
{
ICollectorConfig
.
class
,
IApdexThresholdService
.
class
,
IServiceAlarmRuleConfig
.
class
,
IInstanceAlarmRuleConfig
.
class
,
IApplicationAlarmRuleConfig
.
class
,
IServiceReferenceAlarmRuleConfig
.
class
,
IInstanceReferenceAlarmRuleConfig
.
class
,
IApplicationReferenceAlarmRuleConfig
.
class
};
...
...
apm-collector/apm-collector-configuration/collector-configuration-define/src/main/java/org/apache/skywalking/apm/collector/configuration/service/ICollectorConfig.java
0 → 100644
浏览文件 @
41f41d12
/*
* 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.apm.collector.configuration.service
;
import
org.apache.skywalking.apm.collector.core.module.Service
;
/**
* @author wu-sheng
*/
public
interface
ICollectorConfig
extends
Service
{
/**
* @return the namespace of Collector, empty String if no custom namespace
*/
String
getNamespace
();
}
apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/ConfigurationModuleProvider.java
浏览文件 @
41f41d12
...
...
@@ -22,9 +22,11 @@ import java.util.Properties;
import
org.apache.skywalking.apm.collector.configuration.service.ApdexThresholdService
;
import
org.apache.skywalking.apm.collector.configuration.service.ApplicationAlarmRuleConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.ApplicationReferenceAlarmRuleConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.CollectorConfigService
;
import
org.apache.skywalking.apm.collector.configuration.service.IApdexThresholdService
;
import
org.apache.skywalking.apm.collector.configuration.service.IApplicationAlarmRuleConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.IApplicationReferenceAlarmRuleConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.ICollectorConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.IInstanceAlarmRuleConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.IInstanceReferenceAlarmRuleConfig
;
import
org.apache.skywalking.apm.collector.configuration.service.IServiceAlarmRuleConfig
;
...
...
@@ -41,7 +43,7 @@ import org.apache.skywalking.apm.collector.core.module.ServiceNotProvidedExcepti
* @author peng-yongsheng
*/
public
class
ConfigurationModuleProvider
extends
ModuleProvider
{
private
static
final
String
NAMESPACE
=
"namespace"
;
private
static
final
String
APPLICATION_APDEX_THRESHOLD
=
"application_apdex_threshold"
;
private
static
final
String
SERVICE_ERROR_RATE_THRESHOLD
=
"service_error_rate_threshold"
;
private
static
final
String
SERVICE_AVERAGE_RESPONSE_TIME_THRESHOLD
=
"service_average_response_time_threshold"
;
...
...
@@ -59,6 +61,7 @@ public class ConfigurationModuleProvider extends ModuleProvider {
}
@Override
public
void
prepare
(
Properties
config
)
throws
ServiceNotProvidedException
{
String
namespace
=
(
String
)
config
.
getOrDefault
(
NAMESPACE
,
""
);
Integer
applicationApdexThreshold
=
(
Integer
)
config
.
getOrDefault
(
APPLICATION_APDEX_THRESHOLD
,
2000
);
Double
serviceErrorRateThreshold
=
(
Double
)
config
.
getOrDefault
(
SERVICE_ERROR_RATE_THRESHOLD
,
10.00
);
Integer
serviceAverageResponseTimeThreshold
=
(
Integer
)
config
.
getOrDefault
(
SERVICE_AVERAGE_RESPONSE_TIME_THRESHOLD
,
2000
);
...
...
@@ -67,6 +70,7 @@ public class ConfigurationModuleProvider extends ModuleProvider {
Double
applicationErrorRateThreshold
=
(
Double
)
config
.
getOrDefault
(
APPLICATION_ERROR_RATE_THRESHOLD
,
10.00
);
Integer
applicationAverageResponseTimeThreshold
=
(
Integer
)
config
.
getOrDefault
(
APPLICATION_AVERAGE_RESPONSE_TIME_THRESHOLD
,
2000
);
this
.
registerServiceImplementation
(
ICollectorConfig
.
class
,
new
CollectorConfigService
(
namespace
));
this
.
registerServiceImplementation
(
IApdexThresholdService
.
class
,
new
ApdexThresholdService
(
applicationApdexThreshold
));
this
.
registerServiceImplementation
(
IServiceAlarmRuleConfig
.
class
,
new
ServiceAlarmRuleConfig
(
serviceErrorRateThreshold
,
serviceAverageResponseTimeThreshold
));
this
.
registerServiceImplementation
(
IInstanceAlarmRuleConfig
.
class
,
new
InstanceAlarmRuleConfig
(
instanceErrorRateThreshold
,
instanceAverageResponseTimeThreshold
));
...
...
apm-collector/apm-collector-configuration/collector-configuration-provider/src/main/java/org/apache/skywalking/apm/collector/configuration/service/CollectorConfigService.java
0 → 100644
浏览文件 @
41f41d12
/*
* 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.apm.collector.configuration.service
;
/**
* @author wu-sheng
*/
public
class
CollectorConfigService
implements
ICollectorConfig
{
private
String
namespace
;
public
CollectorConfigService
(
String
namespace
)
{
this
.
namespace
=
namespace
==
null
?
""
:
namespace
;
}
@Override
public
String
getNamespace
()
{
return
namespace
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录