Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿信在这里
SkyWalking
提交
bfcb3726
S
SkyWalking
项目概览
阿信在这里
/
SkyWalking
与 Fork 源项目一致
Fork自
山不在高_有仙则灵 / 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,发现更多精彩内容 >>
提交
bfcb3726
编写于
1月 05, 2018
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Agent] fix jetty client doesn't work in after version 9.1
上级
48717e44
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
365 addition
and
19 deletion
+365
-19
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/pom.xml
...m-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/pom.xml
+42
-0
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v90/client/SyncHttpRequestSendInterceptor.java
...ugin/jetty/v90/client/SyncHttpRequestSendInterceptor.java
+85
-0
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v90/client/define/HttpRequestInstrumentation.java
...n/jetty/v90/client/define/HttpRequestInstrumentation.java
+76
-0
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/src/main/resources/skywalking-plugin.def
...lient-9.0-plugin/src/main/resources/skywalking-plugin.def
+1
-0
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/src/test/java/org/apache/skywalking/apm/plugin/jetty/v90/client/SyncHttpRequestSendInterceptorTest.java
.../jetty/v90/client/SyncHttpRequestSendInterceptorTest.java
+141
-0
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/pom.xml
...m-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/pom.xml
+1
-1
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/client/SyncHttpRequestSendInterceptor.java
...lugin/jetty/v9/client/SyncHttpRequestSendInterceptor.java
+11
-13
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/client/define/HttpRequestInstrumentation.java
...in/jetty/v9/client/define/HttpRequestInstrumentation.java
+4
-0
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/jetty/v9/client/SyncHttpRequestSendInterceptorTest.java
...n/jetty/v9/client/SyncHttpRequestSendInterceptorTest.java
+3
-5
apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
+1
-0
未找到文件。
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/pom.xml
0 → 100644
浏览文件 @
bfcb3726
<!--
~ 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.
~
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
jetty-plugins
</artifactId>
<groupId>
org.apache.skywalking
</groupId>
<version>
5.0.0-alpha
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apm-jetty-client-9.0-plugin
</artifactId>
<packaging>
jar
</packaging>
<name>
jetty-client-9.0-plugin
</name>
<url>
http://maven.apache.org
</url>
<dependencies>
<dependency>
<groupId>
org.eclipse.jetty
</groupId>
<artifactId>
jetty-client
</artifactId>
<version>
9.0.0.v20130308
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v90/client/SyncHttpRequestSendInterceptor.java
0 → 100644
浏览文件 @
bfcb3726
/*
* 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.plugin.jetty.v90.client
;
import
java.lang.reflect.Method
;
import
org.apache.skywalking.apm.agent.core.context.CarrierItem
;
import
org.apache.skywalking.apm.agent.core.context.ContextCarrier
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.tag.Tags
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.eclipse.jetty.client.HttpRequest
;
import
org.eclipse.jetty.http.HttpFields
;
import
org.eclipse.jetty.http.HttpMethod
;
public
class
SyncHttpRequestSendInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
HttpRequest
request
=
(
HttpRequest
)
objInst
;
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
request
.
getURI
().
getPath
(),
contextCarrier
,
request
.
getHost
()
+
":"
+
request
.
getPort
());
span
.
setComponent
(
ComponentsDefine
.
JETTY_CLIENT
);
Tags
.
HTTP
.
METHOD
.
set
(
span
,
getHttpMethod
(
request
));
Tags
.
URL
.
set
(
span
,
request
.
getURI
().
toString
());
SpanLayer
.
asHttp
(
span
);
CarrierItem
next
=
contextCarrier
.
items
();
HttpFields
field
=
request
.
getHeaders
();
while
(
next
.
hasNext
())
{
next
=
next
.
next
();
field
.
add
(
next
.
getHeadKey
(),
next
.
getHeadValue
());
}
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
public
String
getHttpMethod
(
HttpRequest
request
)
{
HttpMethod
httpMethod
=
HttpMethod
.
GET
;
/**
* The method is null if the client using GET method.
*
* @see org.eclipse.jetty.client.HttpRequest#GET(String uri)
* @see org.eclipse.jetty.client.HttpRequest( org.eclipse.jetty.client.HttpClient client, long conversation, java.net.URI uri)
*/
if
(
request
.
getMethod
()
!=
null
)
{
httpMethod
=
request
.
getMethod
();
}
return
httpMethod
.
name
();
}
}
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v90/client/define/HttpRequestInstrumentation.java
0 → 100644
浏览文件 @
bfcb3726
/*
* 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.plugin.jetty.v90.client.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArguments
;
/**
* {@link HttpRequestInstrumentation} enhance the <code>send</code> method without argument in
* <code>org.eclipse.jetty.client.HttpRequest</code> by <code>org.apache.skywalking.apm.plugin.jetty.client.SyncHttpRequestSendInterceptor</code>
* and enhance the <code>send</code> with <code>org.eclipse.jetty.client.api.Response$CompleteListener</code> parameter
* by <code>org.apache.skywalking.apm.plugin.jetty.client.AsyncHttpRequestSendInterceptor</code>
*
* @author zhangxin
*/
public
class
HttpRequestInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"org.eclipse.jetty.client.HttpRequest"
;
private
static
final
String
ENHANCE_CLASS_NAME
=
"send"
;
public
static
final
String
SYNC_SEND_INTERCEPTOR
=
"org.apache.skywalking.apm.plugin.jetty.v90.client.SyncHttpRequestSendV90Interceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
//sync call interceptor point
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_CLASS_NAME
).
and
(
takesArguments
(
0
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
SYNC_SEND_INTERCEPTOR
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
@Override
protected
String
[]
witnessClasses
()
{
return
new
String
[]
{
"org.eclipse.jetty.client.api.ProxyConfiguration"
};
}
}
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/src/main/resources/skywalking-plugin.def
0 → 100644
浏览文件 @
bfcb3726
jetty-client-9.0=org.apache.skywalking.apm.plugin.jetty.v90.client.define.HttpRequestInstrumentation
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.0-plugin/src/test/java/org/apache/skywalking/apm/plugin/jetty/v90/client/SyncHttpRequestSendInterceptorTest.java
0 → 100644
浏览文件 @
bfcb3726
/*
* 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.plugin.jetty.v90.client
;
import
java.net.URI
;
import
java.util.List
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.TraceSegment
;
import
org.apache.skywalking.apm.agent.core.context.util.KeyValuePair
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.test.helper.SegmentHelper
;
import
org.apache.skywalking.apm.agent.test.helper.SpanHelper
;
import
org.apache.skywalking.apm.agent.test.tools.AgentServiceRule
;
import
org.apache.skywalking.apm.agent.test.tools.SegmentStorage
;
import
org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint
;
import
org.apache.skywalking.apm.agent.test.tools.SpanAssert
;
import
org.eclipse.jetty.client.HttpClient
;
import
org.eclipse.jetty.client.HttpRequest
;
import
org.eclipse.jetty.http.HttpMethod
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
org.powermock.modules.junit4.PowerMockRunnerDelegate
;
import
org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
@RunWith
(
PowerMockRunner
.
class
)
@PowerMockRunnerDelegate
(
TracingSegmentRunner
.
class
)
public
class
SyncHttpRequestSendInterceptorTest
{
@SegmentStoragePoint
private
SegmentStorage
segmentStorage
;
@Rule
public
AgentServiceRule
serviceRule
=
new
AgentServiceRule
();
@Mock
private
HttpClient
httpClient
;
@Mock
private
EnhancedInstance
callBackEnhanceInstance
;
private
Object
[]
allArguments
;
private
Class
[]
argumentTypes
;
private
MockHttpRequest
enhancedInstance
;
private
SyncHttpRequestSendInterceptor
interceptor
;
private
URI
uri
=
URI
.
create
(
"http://localhost:8080/test"
);
@Before
public
void
setUp
()
throws
Exception
{
enhancedInstance
=
new
MockHttpRequest
(
httpClient
,
uri
);
allArguments
=
new
Object
[]
{
"OperationKey"
,
"OperationValue"
};
argumentTypes
=
new
Class
[]
{
String
.
class
,
String
.
class
};
interceptor
=
new
SyncHttpRequestSendInterceptor
();
allArguments
=
new
Object
[]
{
callBackEnhanceInstance
};
}
@Test
public
void
testMethodsAround
()
throws
Throwable
{
interceptor
.
beforeMethod
(
enhancedInstance
,
null
,
allArguments
,
argumentTypes
,
null
);
interceptor
.
afterMethod
(
enhancedInstance
,
null
,
allArguments
,
argumentTypes
,
null
);
assertThat
(
segmentStorage
.
getTraceSegments
().
size
(),
is
(
1
));
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
Assert
.
assertEquals
(
1
,
SegmentHelper
.
getSpans
(
traceSegment
).
size
());
AbstractTracingSpan
finishedSpan
=
SegmentHelper
.
getSpans
(
traceSegment
).
get
(
0
);
List
<
KeyValuePair
>
tags
=
SpanHelper
.
getTags
(
finishedSpan
);
assertThat
(
tags
.
size
(),
is
(
2
));
assertThat
(
tags
.
get
(
0
).
getValue
(),
is
(
"GET"
));
assertThat
(
tags
.
get
(
1
).
getValue
(),
is
(
uri
.
toString
()));
Assert
.
assertEquals
(
false
,
SpanHelper
.
getErrorOccurred
(
finishedSpan
));
}
@Test
public
void
testMethodsAroundError
()
throws
Throwable
{
interceptor
.
beforeMethod
(
enhancedInstance
,
null
,
allArguments
,
argumentTypes
,
null
);
interceptor
.
handleMethodException
(
enhancedInstance
,
null
,
allArguments
,
argumentTypes
,
new
RuntimeException
());
interceptor
.
afterMethod
(
enhancedInstance
,
null
,
allArguments
,
argumentTypes
,
null
);
assertThat
(
segmentStorage
.
getTraceSegments
().
size
(),
is
(
1
));
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
Assert
.
assertEquals
(
1
,
SegmentHelper
.
getSpans
(
traceSegment
).
size
());
AbstractTracingSpan
finishedSpan
=
SegmentHelper
.
getSpans
(
traceSegment
).
get
(
0
);
List
<
KeyValuePair
>
tags
=
SpanHelper
.
getTags
(
finishedSpan
);
assertThat
(
tags
.
size
(),
is
(
2
));
assertThat
(
tags
.
get
(
0
).
getValue
(),
is
(
"GET"
));
assertThat
(
tags
.
get
(
1
).
getValue
(),
is
(
uri
.
toString
()));
Assert
.
assertEquals
(
true
,
SpanHelper
.
getErrorOccurred
(
finishedSpan
));
SpanAssert
.
assertException
(
SpanHelper
.
getLogs
(
finishedSpan
).
get
(
0
),
RuntimeException
.
class
);
}
private
class
MockHttpRequest
extends
HttpRequest
implements
EnhancedInstance
{
public
MockHttpRequest
(
HttpClient
httpClient
,
URI
uri
)
{
super
(
httpClient
,
uri
);
}
@Override
public
Object
getSkyWalkingDynamicField
()
{
return
null
;
}
@Override
public
void
setSkyWalkingDynamicField
(
Object
value
)
{
}
@Override
public
HttpMethod
getMethod
()
{
return
HttpMethod
.
GET
;
}
@Override
public
URI
getURI
()
{
return
uri
;
}
}
}
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/pom.xml
浏览文件 @
bfcb3726
...
...
@@ -35,7 +35,7 @@
<dependency>
<groupId>
org.eclipse.jetty
</groupId>
<artifactId>
jetty-client
</artifactId>
<version>
9.
0.0.v20130308
</version>
<version>
9.
1.0.v20131115
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
...
...
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/client/SyncHttpRequestSendInterceptor.java
浏览文件 @
bfcb3726
...
...
@@ -31,7 +31,6 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInt
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.eclipse.jetty.client.HttpRequest
;
import
org.eclipse.jetty.http.HttpFields
;
import
org.eclipse.jetty.http.HttpMethod
;
public
class
SyncHttpRequestSendInterceptor
implements
InstanceMethodsAroundInterceptor
{
...
...
@@ -42,19 +41,8 @@ public class SyncHttpRequestSendInterceptor implements InstanceMethodsAroundInte
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
request
.
getURI
().
getPath
(),
contextCarrier
,
request
.
getHost
()
+
":"
+
request
.
getPort
());
span
.
setComponent
(
ComponentsDefine
.
JETTY_CLIENT
);
HttpMethod
httpMethod
=
HttpMethod
.
GET
;
/**
* The method is null if the client using GET method.
*
* @see org.eclipse.jetty.client.HttpRequest#GET(String uri)
* @see org.eclipse.jetty.client.HttpRequest( org.eclipse.jetty.client.HttpClient client, long conversation, java.net.URI uri)
*/
if
(
request
.
getMethod
()
!=
null
)
{
httpMethod
=
request
.
getMethod
();
}
Tags
.
HTTP
.
METHOD
.
set
(
span
,
httpMethod
.
asString
());
Tags
.
HTTP
.
METHOD
.
set
(
span
,
getHttpMethod
(
request
));
Tags
.
URL
.
set
(
span
,
request
.
getURI
().
toString
());
SpanLayer
.
asHttp
(
span
);
...
...
@@ -77,4 +65,14 @@ public class SyncHttpRequestSendInterceptor implements InstanceMethodsAroundInte
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
public
String
getHttpMethod
(
HttpRequest
request
)
{
String
method
=
request
.
getMethod
();
if
(
method
==
null
||
method
.
length
()
==
0
)
{
method
=
"GET"
;
}
return
method
;
}
}
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jetty/v9/client/define/HttpRequestInstrumentation.java
浏览文件 @
bfcb3726
...
...
@@ -70,4 +70,8 @@ public class HttpRequestInstrumentation extends ClassInstanceMethodsEnhancePlugi
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
@Override
protected
String
[]
witnessClasses
()
{
return
new
String
[]
{
"org.eclipse.jetty.client.AbstractHttpClientTransport"
};
}
}
apm-sniffer/apm-sdk-plugin/jetty-plugin/jetty-client-9.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/jetty/v9/client/SyncHttpRequestSendInterceptorTest.java
浏览文件 @
bfcb3726
...
...
@@ -16,7 +16,6 @@
*
*/
package
org.apache.skywalking.apm.plugin.jetty.v9.client
;
import
java.net.URI
;
...
...
@@ -31,9 +30,9 @@ import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
import
org.apache.skywalking.apm.agent.test.tools.SegmentStorage
;
import
org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint
;
import
org.apache.skywalking.apm.agent.test.tools.SpanAssert
;
import
org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner
;
import
org.eclipse.jetty.client.HttpClient
;
import
org.eclipse.jetty.client.HttpRequest
;
import
org.eclipse.jetty.http.HttpMethod
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Rule
;
...
...
@@ -42,7 +41,6 @@ import org.junit.runner.RunWith;
import
org.mockito.Mock
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
org.powermock.modules.junit4.PowerMockRunnerDelegate
;
import
org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
...
...
@@ -130,8 +128,8 @@ public class SyncHttpRequestSendInterceptorTest {
}
@Override
public
HttpMethod
getMethod
()
{
return
HttpMethod
.
GET
;
@Override
public
String
getMethod
()
{
return
"GET"
;
}
@Override
public
URI
getURI
()
{
...
...
apm-sniffer/apm-sdk-plugin/jetty-plugin/pom.xml
浏览文件 @
bfcb3726
...
...
@@ -31,6 +31,7 @@
<modules>
<module>
jetty-client-9.x-plugin
</module>
<module>
jetty-server-9.x-plugin
</module>
<module>
jetty-client-9.0-plugin
</module>
</modules>
<packaging>
pom
</packaging>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录