Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
430a85df
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 搜索 >>
未验证
提交
430a85df
编写于
2月 20, 2021
作者:
Z
zifeihan
提交者:
GitHub
2月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix KafkaContextManagerExtendService boot error of kafka plugin. (#6410)
上级
3d2fba3c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
51 addition
and
21 deletion
+51
-21
CHANGES.md
CHANGES.md
+1
-0
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextManagerExtendService.java
...g/apm/agent/core/context/ContextManagerExtendService.java
+7
-7
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/sampling/SamplingService.java
...e/skywalking/apm/agent/core/sampling/SamplingService.java
+1
-1
apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/context/IgnoreSuffixPatternsWatcherTest.java
...m/agent/core/context/IgnoreSuffixPatternsWatcherTest.java
+15
-8
apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/sampling/SamplingRateWatcherTest.java
...king/apm/agent/core/sampling/SamplingRateWatcherTest.java
+15
-2
apm-sniffer/optional-plugins/trace-ignore-plugin/src/main/java/org/apache/skywalking/apm/plugin/trace/ignore/TraceIgnoreExtendService.java
...ing/apm/plugin/trace/ignore/TraceIgnoreExtendService.java
+1
-1
apm-sniffer/optional-plugins/trace-ignore-plugin/src/test/java/org/apache/skywalking/apm/plugin/trace/ignore/TraceIgnorePatternWatcherTest.java
...pm/plugin/trace/ignore/TraceIgnorePatternWatcherTest.java
+11
-2
未找到文件。
CHANGES.md
浏览文件 @
430a85df
...
...
@@ -12,6 +12,7 @@ Release Notes.
*
Remove invalid mysql configuration in agent.config.
*
Add net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener to show detail message when redefine errors occur.
*
Fix ClassCastException of log4j gRPC reporter.
*
Fix NPE when Kafka reporter activated.
#### OAP-Backend
*
Allow user-defined
`JAVA_OPTS`
in the startup script.
...
...
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextManagerExtendService.java
浏览文件 @
430a85df
...
...
@@ -18,6 +18,7 @@
package
org.apache.skywalking.apm.agent.core.context
;
import
java.util.Arrays
;
import
org.apache.skywalking.apm.agent.core.boot.BootService
;
import
org.apache.skywalking.apm.agent.core.boot.DefaultImplementor
;
import
org.apache.skywalking.apm.agent.core.boot.ServiceManager
;
...
...
@@ -29,13 +30,11 @@ import org.apache.skywalking.apm.agent.core.remote.GRPCChannelStatus;
import
org.apache.skywalking.apm.agent.core.sampling.SamplingService
;
import
org.apache.skywalking.apm.util.StringUtil
;
import
java.util.Arrays
;
@DefaultImplementor
public
class
ContextManagerExtendService
implements
BootService
,
GRPCChannelListener
{
private
volatile
String
[]
ignoreSuffixArray
=
new
String
[
0
];
private
volatile
GRPCChannelStatus
status
=
GRPCChannelStatus
.
DISCONNECT
;
private
IgnoreSuffixPatternsWatcher
ignoreSuffixPatternsWatcher
;
...
...
@@ -43,14 +42,14 @@ public class ContextManagerExtendService implements BootService, GRPCChannelList
@Override
public
void
prepare
()
{
ServiceManager
.
INSTANCE
.
findService
(
GRPCChannelManager
.
class
).
addChannelListener
(
this
);
ignoreSuffixPatternsWatcher
=
new
IgnoreSuffixPatternsWatcher
(
"agent.ignore_suffix"
,
this
);
}
@Override
public
void
boot
()
{
ignoreSuffixArray
=
Config
.
Agent
.
IGNORE_SUFFIX
.
split
(
","
);
ignoreSuffixPatternsWatcher
=
new
IgnoreSuffixPatternsWatcher
(
"agent.ignore_suffix"
,
this
);
ServiceManager
.
INSTANCE
.
findService
(
ConfigurationDiscoveryService
.
class
)
.
registerAgentConfigChangeWatcher
(
ignoreSuffixPatternsWatcher
);
.
registerAgentConfigChangeWatcher
(
ignoreSuffixPatternsWatcher
);
handleIgnoreSuffixPatternsChanged
();
}
...
...
@@ -74,7 +73,8 @@ public class ContextManagerExtendService implements BootService, GRPCChannelList
}
int
suffixIdx
=
operationName
.
lastIndexOf
(
"."
);
if
(
suffixIdx
>
-
1
&&
Arrays
.
stream
(
ignoreSuffixArray
).
anyMatch
(
a
->
a
.
equals
(
operationName
.
substring
(
suffixIdx
))))
{
if
(
suffixIdx
>
-
1
&&
Arrays
.
stream
(
ignoreSuffixArray
)
.
anyMatch
(
a
->
a
.
equals
(
operationName
.
substring
(
suffixIdx
))))
{
context
=
new
IgnoredTracerContext
();
}
else
{
SamplingService
samplingService
=
ServiceManager
.
INSTANCE
.
findService
(
SamplingService
.
class
);
...
...
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/sampling/SamplingService.java
浏览文件 @
430a85df
...
...
@@ -53,11 +53,11 @@ public class SamplingService implements BootService {
@Override
public
void
prepare
()
{
samplingRateWatcher
=
new
SamplingRateWatcher
(
"agent.sample_n_per_3_secs"
,
this
);
}
@Override
public
void
boot
()
{
samplingRateWatcher
=
new
SamplingRateWatcher
(
"agent.sample_n_per_3_secs"
,
this
);
ServiceManager
.
INSTANCE
.
findService
(
ConfigurationDiscoveryService
.
class
)
.
registerAgentConfigChangeWatcher
(
samplingRateWatcher
);
...
...
apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/context/IgnoreSuffixPatternsWatcherTest.java
浏览文件 @
430a85df
...
...
@@ -18,8 +18,10 @@
package
org.apache.skywalking.apm.agent.core.context
;
import
org.apache.skywalking.apm.agent.core.boot.ServiceManager
;
import
org.apache.skywalking.apm.agent.core.conf.dynamic.AgentConfigChangeWatcher
;
import
org.apache.skywalking.apm.agent.core.test.tools.AgentServiceRule
;
import
org.junit.AfterClass
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Rule
;
...
...
@@ -31,20 +33,25 @@ public class IgnoreSuffixPatternsWatcherTest {
@Rule
public
AgentServiceRule
agentServiceRule
=
new
AgentServiceRule
();
private
ContextManagerExtendService
contextManagerExtendService
=
new
ContextManagerExtendService
()
;
private
ContextManagerExtendService
contextManagerExtendService
;
@Before
public
void
setUp
()
{
contextManagerExtendService
.
prepare
();
contextManagerExtendService
=
ServiceManager
.
INSTANCE
.
findService
(
ContextManagerExtendService
.
class
);
}
@AfterClass
public
static
void
afterClass
()
{
ServiceManager
.
INSTANCE
.
shutdown
();
}
@Test
public
void
testConfigModifyEvent
()
{
IgnoreSuffixPatternsWatcher
ignoreSuffixPatternsWatcher
=
Whitebox
.
getInternalState
(
contextManagerExtendService
,
"ignoreSuffixPatternsWatcher"
);
,
"ignoreSuffixPatternsWatcher"
);
ignoreSuffixPatternsWatcher
.
notify
(
new
AgentConfigChangeWatcher
.
ConfigChangeEvent
(
".txt,.log"
,
AgentConfigChangeWatcher
.
EventType
.
MODIFY
".txt,.log"
,
AgentConfigChangeWatcher
.
EventType
.
MODIFY
));
Assert
.
assertEquals
(
".txt,.log"
,
ignoreSuffixPatternsWatcher
.
getIgnoreSuffixPatterns
());
Assert
.
assertEquals
(
"agent.ignore_suffix"
,
ignoreSuffixPatternsWatcher
.
getPropertyKey
());
...
...
@@ -53,10 +60,10 @@ public class IgnoreSuffixPatternsWatcherTest {
@Test
public
void
testConfigDeleteEvent
()
{
IgnoreSuffixPatternsWatcher
ignoreSuffixPatternsWatcher
=
Whitebox
.
getInternalState
(
contextManagerExtendService
,
"ignoreSuffixPatternsWatcher"
);
,
"ignoreSuffixPatternsWatcher"
);
ignoreSuffixPatternsWatcher
.
notify
(
new
AgentConfigChangeWatcher
.
ConfigChangeEvent
(
null
,
AgentConfigChangeWatcher
.
EventType
.
DELETE
null
,
AgentConfigChangeWatcher
.
EventType
.
DELETE
));
Assert
.
assertEquals
(
"agent.ignore_suffix"
,
ignoreSuffixPatternsWatcher
.
getPropertyKey
());
}
...
...
apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/sampling/SamplingRateWatcherTest.java
浏览文件 @
430a85df
...
...
@@ -18,18 +18,31 @@
package
org.apache.skywalking.apm.agent.core.sampling
;
import
org.apache.skywalking.apm.agent.core.boot.ServiceManager
;
import
org.apache.skywalking.apm.agent.core.conf.dynamic.AgentConfigChangeWatcher
;
import
org.apache.skywalking.apm.agent.core.test.tools.AgentServiceRule
;
import
org.junit.AfterClass
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.powermock.reflect.Whitebox
;
public
class
SamplingRateWatcherTest
{
private
SamplingService
samplingService
=
new
SamplingService
();
@Rule
public
AgentServiceRule
agentServiceRule
=
new
AgentServiceRule
();
private
SamplingService
samplingService
;
@Before
public
void
setUp
()
{
samplingService
.
prepare
();
samplingService
=
ServiceManager
.
INSTANCE
.
findService
(
SamplingService
.
class
);
}
@AfterClass
public
static
void
afterClass
()
{
ServiceManager
.
INSTANCE
.
shutdown
();
}
@Test
...
...
apm-sniffer/optional-plugins/trace-ignore-plugin/src/main/java/org/apache/skywalking/apm/plugin/trace/ignore/TraceIgnoreExtendService.java
浏览文件 @
430a85df
...
...
@@ -41,7 +41,6 @@ public class TraceIgnoreExtendService extends SamplingService {
@Override
public
void
prepare
()
{
super
.
prepare
();
traceIgnorePatternWatcher
=
new
TraceIgnorePatternWatcher
(
"agent.trace.ignore_path"
,
this
);
}
@Override
...
...
@@ -53,6 +52,7 @@ public class TraceIgnoreExtendService extends SamplingService {
patterns
=
IgnoreConfig
.
Trace
.
IGNORE_PATH
.
split
(
PATTERN_SEPARATOR
);
}
traceIgnorePatternWatcher
=
new
TraceIgnorePatternWatcher
(
"agent.trace.ignore_path"
,
this
);
ServiceManager
.
INSTANCE
.
findService
(
ConfigurationDiscoveryService
.
class
)
.
registerAgentConfigChangeWatcher
(
traceIgnorePatternWatcher
);
...
...
apm-sniffer/optional-plugins/trace-ignore-plugin/src/test/java/org/apache/skywalking/apm/plugin/trace/ignore/TraceIgnorePatternWatcherTest.java
浏览文件 @
430a85df
...
...
@@ -18,18 +18,27 @@
package
org.apache.skywalking.apm.plugin.trace.ignore
;
import
org.apache.skywalking.apm.agent.core.boot.ServiceManager
;
import
org.apache.skywalking.apm.agent.core.conf.dynamic.AgentConfigChangeWatcher
;
import
org.apache.skywalking.apm.agent.core.sampling.SamplingService
;
import
org.apache.skywalking.apm.agent.test.tools.AgentServiceRule
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.powermock.reflect.Whitebox
;
public
class
TraceIgnorePatternWatcherTest
{
private
TraceIgnoreExtendService
traceIgnoreExtendService
=
new
TraceIgnoreExtendService
();
@Rule
public
AgentServiceRule
agentServiceRule
=
new
AgentServiceRule
();
private
TraceIgnoreExtendService
traceIgnoreExtendService
;
@Before
public
void
setUp
()
{
traceIgnoreExtendService
.
prepare
();
traceIgnoreExtendService
=
(
TraceIgnoreExtendService
)
ServiceManager
.
INSTANCE
.
findService
(
SamplingService
.
class
);
}
@Test
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录