Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
killuaz丶x
SkyWalking
提交
cd029df3
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,发现更多精彩内容 >>
未验证
提交
cd029df3
编写于
7月 17, 2021
作者:
L
Lu Jiajing
提交者:
GitHub
7月 17, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Chore: polish methods naming for Spring Kafka (#7320)
上级
a6afcac8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
20 addition
and
9 deletion
+20
-9
CHANGES.md
CHANGES.md
+1
-0
apm-sniffer/apm-sdk-plugin/kafka-commons/src/main/java/org/apache/skywalking/apm/plugin/kafka/define/InterceptorMethod.java
...skywalking/apm/plugin/kafka/define/InterceptorMethod.java
+2
-2
apm-sniffer/apm-sdk-plugin/spring-plugins/spring-kafka-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/kafka/PostRunMethodInterceptor.java
...ing/apm/plugin/spring/kafka/PostRunMethodInterceptor.java
+1
-1
apm-sniffer/apm-sdk-plugin/spring-plugins/spring-kafka-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/kafka/ProcessSeeksMethodInterceptor.java
...pm/plugin/spring/kafka/ProcessSeeksMethodInterceptor.java
+12
-2
apm-sniffer/apm-sdk-plugin/spring-plugins/spring-kafka-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/kafka/PollAndInvokeMethodInterceptor.java
...m/plugin/spring/kafka/PollAndInvokeMethodInterceptor.java
+2
-2
apm-sniffer/apm-toolkit-activation/apm-toolkit-kafka-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/kafka/KafkaOnMessageAnnotationMethodInterceptor.java
...tion/kafka/KafkaOnMessageAnnotationMethodInterceptor.java
+2
-2
未找到文件。
CHANGES.md
浏览文件 @
cd029df3
...
@@ -32,6 +32,7 @@ Release Notes.
...
@@ -32,6 +32,7 @@ Release Notes.
*
Support
`guava-cache`
plugin.
*
Support
`guava-cache`
plugin.
*
Enhance the compatibility of
`mysql-8.x-plugin`
plugin.
*
Enhance the compatibility of
`mysql-8.x-plugin`
plugin.
*
Support Kafka SASL login module.
*
Support Kafka SASL login module.
*
Chore: polish methods naming for
`Spring-Kafka`
plugins.
#### OAP-Backend
#### OAP-Backend
...
...
apm-sniffer/apm-sdk-plugin/kafka-commons/src/main/java/org/apache/skywalking/apm/plugin/kafka/define/InterceptorMethod.java
浏览文件 @
cd029df3
...
@@ -22,11 +22,11 @@ import org.apache.skywalking.apm.agent.core.context.ContextManager;
...
@@ -22,11 +22,11 @@ import org.apache.skywalking.apm.agent.core.context.ContextManager;
public
class
InterceptorMethod
{
public
class
InterceptorMethod
{
public
static
void
be
foreMethod
(
String
operationName
)
{
public
static
void
be
ginKafkaPollAndInvokeIteration
(
String
operationName
)
{
ContextManager
.
getRuntimeContext
().
put
(
Constants
.
KAFKA_FLAG
,
new
KafkaContext
(
operationName
));
ContextManager
.
getRuntimeContext
().
put
(
Constants
.
KAFKA_FLAG
,
new
KafkaContext
(
operationName
));
}
}
public
static
Object
afterMethod
(
Object
ret
)
{
public
static
Object
endKafkaPollAndInvokeIteration
(
Object
ret
)
{
KafkaContext
context
=
(
KafkaContext
)
ContextManager
.
getRuntimeContext
().
get
(
Constants
.
KAFKA_FLAG
);
KafkaContext
context
=
(
KafkaContext
)
ContextManager
.
getRuntimeContext
().
get
(
Constants
.
KAFKA_FLAG
);
if
(
context
==
null
)
{
if
(
context
==
null
)
{
return
ret
;
return
ret
;
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/spring-kafka-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/kafka/PostRunMethodInterceptor.java
浏览文件 @
cd029df3
...
@@ -33,7 +33,7 @@ public class PostRunMethodInterceptor implements InstanceMethodsAroundIntercepto
...
@@ -33,7 +33,7 @@ public class PostRunMethodInterceptor implements InstanceMethodsAroundIntercepto
@Override
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
return
InterceptorMethod
.
afterMethod
(
ret
);
return
InterceptorMethod
.
endKafkaPollAndInvokeIteration
(
ret
);
}
}
@Override
@Override
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/spring-kafka-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/kafka/ProcessSeeksMethodInterceptor.java
浏览文件 @
cd029df3
...
@@ -26,20 +26,30 @@ import org.apache.skywalking.apm.plugin.kafka.define.InterceptorMethod;
...
@@ -26,20 +26,30 @@ import org.apache.skywalking.apm.plugin.kafka.define.InterceptorMethod;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
/**
* The interceptor intends to be imposed on the method `processSeeks` in the ListenerConsumer class
* defined in {@link org.springframework.kafka.listener.KafkaMessageListenerContainer}
*/
public
class
ProcessSeeksMethodInterceptor
implements
InstanceMethodsAroundInterceptor
{
public
class
ProcessSeeksMethodInterceptor
implements
InstanceMethodsAroundInterceptor
{
private
static
final
String
OPERATION_NAME
=
"/spring-kafka"
+
Constants
.
KAFKA_POLL_AND_INVOKE_OPERATION_NAME
;
private
static
final
String
OPERATION_NAME
=
"/spring-kafka"
+
Constants
.
KAFKA_POLL_AND_INVOKE_OPERATION_NAME
;
/**
* The `beforeMethod` is called before `processSeeks`, which can be used to mark the end of the last iteration.
*/
@Override
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
MethodInterceptResult
result
)
throws
Throwable
{
InterceptorMethod
.
afterMethod
(
null
);
InterceptorMethod
.
endKafkaPollAndInvokeIteration
(
null
);
}
}
/**
* The `afterMethod` is called after `processSeeks`, where the new PollAndInvoke iteration starts
*/
@Override
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
Object
ret
)
throws
Throwable
{
InterceptorMethod
.
be
foreMethod
(
OPERATION_NAME
);
InterceptorMethod
.
be
ginKafkaPollAndInvokeIteration
(
OPERATION_NAME
);
return
ret
;
return
ret
;
}
}
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/spring-kafka-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/kafka/PollAndInvokeMethodInterceptor.java
浏览文件 @
cd029df3
...
@@ -33,13 +33,13 @@ public class PollAndInvokeMethodInterceptor implements InstanceMethodsAroundInte
...
@@ -33,13 +33,13 @@ public class PollAndInvokeMethodInterceptor implements InstanceMethodsAroundInte
@Override
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
MethodInterceptResult
result
)
throws
Throwable
{
InterceptorMethod
.
be
foreMethod
(
OPERATION_NAME
);
InterceptorMethod
.
be
ginKafkaPollAndInvokeIteration
(
OPERATION_NAME
);
}
}
@Override
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
Object
ret
)
throws
Throwable
{
return
InterceptorMethod
.
afterMethod
(
ret
);
return
InterceptorMethod
.
endKafkaPollAndInvokeIteration
(
ret
);
}
}
@Override
@Override
...
...
apm-sniffer/apm-toolkit-activation/apm-toolkit-kafka-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/kafka/KafkaOnMessageAnnotationMethodInterceptor.java
浏览文件 @
cd029df3
...
@@ -33,13 +33,13 @@ public class KafkaOnMessageAnnotationMethodInterceptor implements InstanceMethod
...
@@ -33,13 +33,13 @@ public class KafkaOnMessageAnnotationMethodInterceptor implements InstanceMethod
@Override
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
MethodInterceptResult
result
)
throws
Throwable
{
InterceptorMethod
.
be
foreMethod
(
OPERATION_NAME
);
InterceptorMethod
.
be
ginKafkaPollAndInvokeIteration
(
OPERATION_NAME
);
}
}
@Override
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
Object
ret
)
throws
Throwable
{
return
InterceptorMethod
.
afterMethod
(
ret
);
return
InterceptorMethod
.
endKafkaPollAndInvokeIteration
(
ret
);
}
}
@Override
@Override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录