Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
7ae2b74a
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 搜索 >>
未验证
提交
7ae2b74a
编写于
5月 26, 2021
作者:
L
Lu Jiajing
提交者:
GitHub
5月 26, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize Class.getDeclaredField in Feign plugin (#7017)
上级
f6a0efde
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
12 deletion
+24
-12
CHANGES.md
CHANGES.md
+1
-0
apm-sniffer/apm-sdk-plugin/feign-default-http-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/feign/http/v9/DefaultHttpClientInterceptor.java
...pm/plugin/feign/http/v9/DefaultHttpClientInterceptor.java
+23
-12
未找到文件。
CHANGES.md
浏览文件 @
7ae2b74a
...
...
@@ -32,6 +32,7 @@ Release Notes.
*
Introduce method interceptor API v2
*
Fix ClassCast issue for RequestHolder/ResponseHolder.
*
fixed
`jdk-threading-plugin`
memory leak.
*
Optimize multiple field reflection opeartion in Fiegn plugin.
#### OAP-Backend
*
BugFix: filter invalid Envoy access logs whose socket address is empty.
...
...
apm-sniffer/apm-sdk-plugin/feign-default-http-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/feign/http/v9/DefaultHttpClientInterceptor.java
浏览文件 @
7ae2b74a
...
...
@@ -50,6 +50,17 @@ import static feign.Util.valuesOrEmpty;
public
class
DefaultHttpClientInterceptor
implements
InstanceMethodsAroundInterceptor
{
private
static
final
String
CONTENT_TYPE_HEADER
=
"Content-Type"
;
private
static
Field
FIELD_HEADERS_OF_REQUEST
;
static
{
try
{
final
Field
field
=
Request
.
class
.
getDeclaredField
(
"headers"
);
field
.
setAccessible
(
true
);
FIELD_HEADERS_OF_REQUEST
=
field
;
}
catch
(
Exception
ignore
)
{
FIELD_HEADERS_OF_REQUEST
=
null
;
}
}
/**
* Get the {@link feign.Request} from {@link EnhancedInstance}, then create {@link AbstractSpan} and set host, port,
...
...
@@ -101,19 +112,19 @@ public class DefaultHttpClientInterceptor implements InstanceMethodsAroundInterc
}
}
Field
headersField
=
Request
.
class
.
getDeclaredField
(
"headers"
);
headersField
.
setAccessible
(
true
);
Map
<
String
,
Collection
<
String
>>
headers
=
new
LinkedHashMap
<
String
,
Collection
<
String
>>();
CarrierItem
next
=
contextCarrier
.
items
();
while
(
next
.
hasNext
())
{
next
=
next
.
next
();
List
<
String
>
contextCollection
=
new
ArrayList
<
String
>(
1
);
contextCollection
.
add
(
next
.
getHeadValue
());
headers
.
put
(
next
.
getHeadKey
(),
contextCollection
);
}
headers
.
putAll
(
request
.
headers
());
if
(
FIELD_HEADERS_OF_REQUEST
!=
null
)
{
Map
<
String
,
Collection
<
String
>>
headers
=
new
LinkedHashMap
<
String
,
Collection
<
String
>>();
CarrierItem
next
=
contextCarrier
.
items
();
while
(
next
.
hasNext
())
{
next
=
next
.
next
();
List
<
String
>
contextCollection
=
new
ArrayList
<
String
>(
1
);
contextCollection
.
add
(
next
.
getHeadValue
());
headers
.
put
(
next
.
getHeadKey
(),
contextCollection
);
}
headers
.
putAll
(
request
.
headers
());
headersField
.
set
(
request
,
Collections
.
unmodifiableMap
(
headers
));
FIELD_HEADERS_OF_REQUEST
.
set
(
request
,
Collections
.
unmodifiableMap
(
headers
));
}
}
private
void
collectHttpBody
(
final
Request
request
,
final
AbstractSpan
span
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录