Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
killuaz丶x
SkyWalking
提交
31f42343
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,发现更多精彩内容 >>
未验证
提交
31f42343
编写于
6月 27, 2020
作者:
C
caoyixiong
提交者:
GitHub
6月 27, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add brpc-java plugin (#4958)
上级
fb7912c6
变更
23
展开全部
隐藏空白更改
内联
并排
Showing
23 changed file
with
1931 addition
and
0 deletion
+1931
-0
.github/workflows/plugins-test.3.yaml
.github/workflows/plugins-test.3.yaml
+1
-0
apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
...walking/apm/network/trace/component/ComponentsDefine.java
+2
-0
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/pom.xml
+46
-0
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/src/main/java/org/apache/skywalking/apm/plugin/baidu/brpc/ClientInterceptor.java
...e/skywalking/apm/plugin/baidu/brpc/ClientInterceptor.java
+86
-0
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/src/main/java/org/apache/skywalking/apm/plugin/baidu/brpc/ServerInterceptor.java
...e/skywalking/apm/plugin/baidu/brpc/ServerInterceptor.java
+83
-0
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/src/main/java/org/apache/skywalking/apm/plugin/baidu/brpc/define/ClientInstrumentation.java
...g/apm/plugin/baidu/brpc/define/ClientInstrumentation.java
+68
-0
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/src/main/java/org/apache/skywalking/apm/plugin/baidu/brpc/define/ServerInstrumentation.java
...g/apm/plugin/baidu/brpc/define/ServerInstrumentation.java
+68
-0
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/src/main/resources/skywalking-plugin.def
...aidu-brpc-plugin/src/main/resources/skywalking-plugin.def
+18
-0
apm-sniffer/apm-sdk-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/pom.xml
+1
-0
docs/en/setup/service-agent/java-agent/Supported-list.md
docs/en/setup/service-agent/java-agent/Supported-list.md
+1
-0
oap-server/server-bootstrap/src/main/resources/component-libraries.yml
...rver-bootstrap/src/main/resources/component-libraries.yml
+3
-0
test/plugin/scenarios/baidu-brpc-scenario/bin/startup.sh
test/plugin/scenarios/baidu-brpc-scenario/bin/startup.sh
+21
-0
test/plugin/scenarios/baidu-brpc-scenario/config/expectedData.yaml
...in/scenarios/baidu-brpc-scenario/config/expectedData.yaml
+66
-0
test/plugin/scenarios/baidu-brpc-scenario/configuration.yml
test/plugin/scenarios/baidu-brpc-scenario/configuration.yml
+20
-0
test/plugin/scenarios/baidu-brpc-scenario/pom.xml
test/plugin/scenarios/baidu-brpc-scenario/pom.xml
+119
-0
test/plugin/scenarios/baidu-brpc-scenario/src/main/assembly/assembly.xml
...narios/baidu-brpc-scenario/src/main/assembly/assembly.xml
+41
-0
test/plugin/scenarios/baidu-brpc-scenario/src/main/java/org/apache/skywalking/apm/testcase/baidu.brpc/BaiduBrpcApplication.java
...walking/apm/testcase/baidu.brpc/BaiduBrpcApplication.java
+46
-0
test/plugin/scenarios/baidu-brpc-scenario/src/main/java/org/apache/skywalking/apm/testcase/baidu.brpc/controller/CaseController.java
...ng/apm/testcase/baidu.brpc/controller/CaseController.java
+75
-0
test/plugin/scenarios/baidu-brpc-scenario/src/main/java/org/apache/skywalking/apm/testcase/baidu.brpc/interfaces/Echo.java
...e/skywalking/apm/testcase/baidu.brpc/interfaces/Echo.java
+1040
-0
test/plugin/scenarios/baidu-brpc-scenario/src/main/java/org/apache/skywalking/apm/testcase/baidu.brpc/interfaces/EchoService.java
...lking/apm/testcase/baidu.brpc/interfaces/EchoService.java
+30
-0
test/plugin/scenarios/baidu-brpc-scenario/src/main/java/org/apache/skywalking/apm/testcase/baidu.brpc/service/EchoServiceImpl.java
...king/apm/testcase/baidu.brpc/service/EchoServiceImpl.java
+47
-0
test/plugin/scenarios/baidu-brpc-scenario/src/main/resources/application.yml
...os/baidu-brpc-scenario/src/main/resources/application.yml
+20
-0
test/plugin/scenarios/baidu-brpc-scenario/support-version.list
...plugin/scenarios/baidu-brpc-scenario/support-version.list
+29
-0
未找到文件。
.github/workflows/plugins-test.3.yaml
浏览文件 @
31f42343
...
...
@@ -46,6 +46,7 @@ jobs:
-
{
name
:
'
vertx-web-3.6plus-scenario'
,
title
:
'
Vert.x
Web
3.6.0-3.9.1
(14)'
}
-
{
name
:
'
mariadb-scenario'
,
title
:
'
Mariadb
2.x
(8)'
}
-
{
name
:
'
quasar-scenario'
,
title
:
'
quasar
0.7.x
(5)'
}
-
{
name
:
'
baidu-brpc-scenario'
,
title
:
'
baidu-brpc
2.3.7-2.5.3
(12)'
}
steps
:
-
uses
:
actions/checkout@v2
with
:
...
...
apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
浏览文件 @
31f42343
...
...
@@ -162,4 +162,6 @@ public class ComponentsDefine {
public
static
final
OfficialComponent
QUASAR
=
new
OfficialComponent
(
88
,
"quasar"
);
public
static
final
OfficialComponent
INFLUXDB_JAVA
=
new
OfficialComponent
(
90
,
"influxdb-java"
);
public
static
final
OfficialComponent
BRPC_JAVA
=
new
OfficialComponent
(
91
,
"brpc-java"
);
}
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/pom.xml
0 → 100644
浏览文件 @
31f42343
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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>
apm-sdk-plugin
</artifactId>
<groupId>
org.apache.skywalking
</groupId>
<version>
8.1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
<artifactId>
baidu-brpc-plugin
</artifactId>
<name>
baidu-brpc-plugin
</name>
<properties>
<brpc-java.version>
2.5.3
</brpc-java.version>
</properties>
<dependencies>
<dependency>
<groupId>
com.baidu
</groupId>
<artifactId>
brpc-java
</artifactId>
<version>
${brpc-java.version}
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/src/main/java/org/apache/skywalking/apm/plugin/baidu/brpc/ClientInterceptor.java
0 → 100644
浏览文件 @
31f42343
/*
* 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.baidu.brpc
;
import
com.baidu.brpc.protocol.Request
;
import
com.baidu.brpc.protocol.Response
;
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.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
java.lang.reflect.Method
;
import
java.net.InetAddress
;
import
java.net.InetSocketAddress
;
import
java.util.HashMap
;
public
class
ClientInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
Request
request
=
(
Request
)
allArguments
[
0
];
InetSocketAddress
remoteAddress
=
(
InetSocketAddress
)
request
.
getChannel
().
remoteAddress
();
InetAddress
address
=
remoteAddress
.
getAddress
();
final
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
generateOperationName
(
request
),
contextCarrier
,
address
.
getHostAddress
()
+
":"
+
remoteAddress
.
getPort
());
CarrierItem
next
=
contextCarrier
.
items
();
while
(
next
.
hasNext
())
{
next
=
next
.
next
();
if
(
request
.
getKvAttachment
()
==
null
)
{
request
.
setKvAttachment
(
new
HashMap
<>());
}
request
.
getKvAttachment
().
put
(
next
.
getHeadKey
(),
next
.
getHeadValue
());
}
span
.
setComponent
(
ComponentsDefine
.
BRPC_JAVA
);
SpanLayer
.
asRPCFramework
(
span
);
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
Response
response
=
(
Response
)
allArguments
[
1
];
if
(
response
!=
null
&&
response
.
getException
()
!=
null
)
{
dealException
(
response
.
getException
());
}
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
dealException
(
t
);
}
private
void
dealException
(
Throwable
throwable
)
{
AbstractSpan
span
=
ContextManager
.
activeSpan
();
span
.
errorOccurred
();
span
.
log
(
throwable
);
}
private
String
generateOperationName
(
Request
request
)
{
StringBuilder
operationName
=
new
StringBuilder
();
operationName
.
append
(
request
.
getServiceName
()
+
"."
+
request
.
getMethodName
());
return
operationName
.
toString
();
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/src/main/java/org/apache/skywalking/apm/plugin/baidu/brpc/ServerInterceptor.java
0 → 100644
浏览文件 @
31f42343
/*
* 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.baidu.brpc
;
import
com.baidu.brpc.protocol.Request
;
import
com.baidu.brpc.protocol.Response
;
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.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
java.lang.reflect.Method
;
import
java.util.HashMap
;
public
class
ServerInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
Request
request
=
(
Request
)
allArguments
[
0
];
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
CarrierItem
next
=
contextCarrier
.
items
();
if
(
request
.
getKvAttachment
()
==
null
)
{
request
.
setKvAttachment
(
new
HashMap
<>());
}
while
(
next
.
hasNext
())
{
next
=
next
.
next
();
next
.
setHeadValue
((
String
)
request
.
getKvAttachment
().
get
(
next
.
getHeadKey
()));
}
AbstractSpan
span
=
ContextManager
.
createEntrySpan
(
generateOperationName
(
request
),
contextCarrier
);
SpanLayer
.
asRPCFramework
(
span
);
span
.
setComponent
(
ComponentsDefine
.
BRPC_JAVA
);
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
Response
response
=
(
Response
)
allArguments
[
1
];
if
(
response
!=
null
&&
response
.
getException
()
!=
null
)
{
AbstractSpan
span
=
ContextManager
.
activeSpan
();
span
.
log
(
response
.
getException
());
span
.
errorOccurred
();
}
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
AbstractSpan
activeSpan
=
ContextManager
.
activeSpan
();
activeSpan
.
errorOccurred
();
activeSpan
.
log
(
t
);
}
private
static
String
generateOperationName
(
Request
request
)
{
StringBuilder
operationName
=
new
StringBuilder
(
request
.
getServiceName
());
operationName
.
append
(
"."
).
append
(
request
.
getMethodName
());
return
operationName
.
toString
();
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/src/main/java/org/apache/skywalking/apm/plugin/baidu/brpc/define/ClientInstrumentation.java
0 → 100644
浏览文件 @
31f42343
/*
* 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.baidu.brpc.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
;
public
class
ClientInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
INTERCEPTOR_CLASS
=
"org.apache.skywalking.apm.plugin.baidu.brpc.ClientInterceptor"
;
public
static
final
String
ENHANCE_CLASS
=
"com.baidu.brpc.interceptor.LoadBalanceInterceptor"
;
public
static
final
String
ENHANCE_METHOD
=
"rpcCore"
;
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPTOR_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/src/main/java/org/apache/skywalking/apm/plugin/baidu/brpc/define/ServerInstrumentation.java
0 → 100644
浏览文件 @
31f42343
/*
* 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.baidu.brpc.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
;
public
class
ServerInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
INTERCEPTOR_CLASS
=
"org.apache.skywalking.apm.plugin.baidu.brpc.ServerInterceptor"
;
public
static
final
String
ENHANCE_CLASS
=
"com.baidu.brpc.interceptor.ServerInvokeInterceptor"
;
public
static
final
String
ENHANCE_METHOD
=
"aroundProcess"
;
@Override
protected
ClassMatch
enhanceClass
()
{
return
NameMatch
.
byName
(
ENHANCE_CLASS
);
}
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPTOR_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/baidu-brpc-plugin/src/main/resources/skywalking-plugin.def
0 → 100644
浏览文件 @
31f42343
# 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.
brpc-java=org.apache.skywalking.apm.plugin.baidu.brpc.define.ClientInstrumentation
brpc-java=org.apache.skywalking.apm.plugin.baidu.brpc.define.ServerInstrumentation
apm-sniffer/apm-sdk-plugin/pom.xml
浏览文件 @
31f42343
...
...
@@ -93,6 +93,7 @@
<module>
quasar-plugin
</module>
<module>
mariadb-2.x-plugin
</module>
<module>
influxdb-2.x-plugin
</module>
<module>
baidu-brpc-plugin
</module>
</modules>
<packaging>
pom
</packaging>
...
...
docs/en/setup/service-agent/java-agent/Supported-list.md
浏览文件 @
31f42343
...
...
@@ -45,6 +45,7 @@
*
[
Armeria
](
https://github.com/line/armeria
)
0.63.0 -> 0.98.0
*
[
Apache Avro
](
http://avro.apache.org
)
1.7.0 - 1.8.x
*
[
Finagle
](
https://github.com/twitter/finagle
)
6.25.0 -> 20.1.0
*
[
Brpc-Java
](
https://github.com/baidu/brpc-java
)
2.3.7 -> 2.5.3
*
MQ
*
[
RocketMQ
](
https://github.com/apache/rocketmq
)
4.x
*
[
Kafka
](
http://kafka.apache.org
)
0.11.0.0 -> 1.0
...
...
oap-server/server-bootstrap/src/main/resources/component-libraries.yml
浏览文件 @
31f42343
...
...
@@ -302,6 +302,9 @@ InfluxDB:
influxdb-java
:
id
:
90
languages
:
Java
brpc-java
:
id
:
91
languages
:
Java
# .NET/.NET Core components
# [3000, 4000) for C#/.NET only
...
...
test/plugin/scenarios/baidu-brpc-scenario/bin/startup.sh
0 → 100644
浏览文件 @
31f42343
#!/bin/bash
#
# 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.
home
=
"
$(
cd
"
$(
dirname
$0
)
"
;
pwd
)
"
java
-jar
${
agent_opts
}
${
home
}
/../libs/baidu-brpc-scenario.jar &
\ No newline at end of file
test/plugin/scenarios/baidu-brpc-scenario/config/expectedData.yaml
0 → 100644
浏览文件 @
31f42343
# 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.
segmentItems
:
-
serviceName
:
baidu-brpc-scenario
segmentSize
:
gt
2
segments
:
-
segmentId
:
not
null
spans
:
-
operationName
:
example.EchoService.Echo
operationId
:
0
parentSpanId
:
-1
spanId
:
0
spanLayer
:
RPCFramework
startTime
:
nq
0
endTime
:
nq
0
componentId
:
91
isError
:
false
spanType
:
Entry
peer
:
'
'
refs
:
-
{
parentEndpoint
:
/baidu-brpc-scenario/case/brpc
,
networkAddress
:
'
127.0.0.1:1118'
,
refType
:
CrossProcess
,
parentSpanId
:
1
,
parentTraceSegmentId
:
not null
,
parentServiceInstance
:
not
null
,
parentService
:
baidu-brpc-scenario
,
traceId
:
not null
}
skipAnalysis
:
'
false'
-
segmentId
:
not
null
spans
:
-
operationName
:
example.EchoService.Echo
operationId
:
0
parentSpanId
:
0
spanId
:
1
spanLayer
:
RPCFramework
startTime
:
nq
0
endTime
:
nq
0
componentId
:
91
isError
:
false
spanType
:
Exit
peer
:
127.0.0.1:1118
skipAnalysis
:
'
false'
-
operationName
:
/baidu-brpc-scenario/case/brpc
operationId
:
0
parentSpanId
:
-1
spanId
:
0
spanLayer
:
Http
startTime
:
nq
0
endTime
:
nq
0
componentId
:
1
isError
:
false
spanType
:
Entry
peer
:
'
'
tags
:
-
{
key
:
url
,
value
:
'
http://localhost:8080/baidu-brpc-scenario/case/brpc'
}
-
{
key
:
http.method
,
value
:
GET
}
skipAnalysis
:
'
false'
test/plugin/scenarios/baidu-brpc-scenario/configuration.yml
0 → 100644
浏览文件 @
31f42343
# 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.
type
:
jvm
entryService
:
http://localhost:8080/baidu-brpc-scenario/case/brpc
healthCheck
:
http://localhost:8080/baidu-brpc-scenario/case/healthCheck
startScript
:
./bin/startup.sh
test/plugin/scenarios/baidu-brpc-scenario/pom.xml
0 → 100644
浏览文件 @
31f42343
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
baidu-brpc-scenario
</artifactId>
<packaging>
jar
</packaging>
<version>
5.0.0
</version>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<compiler.version>
1.8
</compiler.version>
<test.framework.version>
2.5.3
</test.framework.version>
<spring.boot.version>
2.1.6.RELEASE
</spring.boot.version>
<test.framework>
baidu-brpc
</test.framework>
</properties>
<name>
skywalking-baidu-brpc-scenario
</name>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-dependencies
</artifactId>
<version>
${spring.boot.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>
com.baidu
</groupId>
<artifactId>
brpc-java
</artifactId>
<version>
${test.framework.version}
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependencies>
<build>
<finalName>
baidu-brpc-scenario
</finalName>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
${compiler.version}
</source>
<target>
${compiler.version}
</target>
<encoding>
${project.build.sourceEncoding}
</encoding>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-assembly-plugin
</artifactId>
<executions>
<execution>
<id>
assemble
</id>
<phase>
package
</phase>
<goals>
<goal>
single
</goal>
</goals>
<configuration>
<descriptors>
<descriptor>
src/main/assembly/assembly.xml
</descriptor>
</descriptors>
<outputDirectory>
./target/
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>
spring-snapshots
</id>
<url>
http://repo.spring.io/snapshot
</url>
</pluginRepository>
<pluginRepository>
<id>
spring-milestones
</id>
<url>
http://repo.spring.io/milestone
</url>
</pluginRepository>
</pluginRepositories>
</project>
\ No newline at end of file
test/plugin/scenarios/baidu-brpc-scenario/src/main/assembly/assembly.xml
0 → 100644
浏览文件 @
31f42343
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<assembly
xmlns=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<formats>
<format>
zip
</format>
</formats>
<fileSets>
<fileSet>
<directory>
./bin
</directory>
<fileMode>
0775
</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>
${project.build.directory}/baidu-brpc-scenario.jar
</source>
<outputDirectory>
./libs
</outputDirectory>
<fileMode>
0775
</fileMode>
</file>
</files>
</assembly>
test/plugin/scenarios/baidu-brpc-scenario/src/main/java/org/apache/skywalking/apm/testcase/baidu.brpc/BaiduBrpcApplication.java
0 → 100644
浏览文件 @
31f42343
/*
* 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.testcase.baidu.brpc
;
import
com.baidu.brpc.server.RpcServer
;
import
com.baidu.brpc.server.RpcServerOptions
;
import
org.apache.skywalking.apm.testcase.baidu.brpc.service.EchoServiceImpl
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
BaiduBrpcApplication
implements
InitializingBean
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
BaiduBrpcApplication
.
class
,
args
);
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
int
port
=
1118
;
RpcServerOptions
options
=
new
RpcServerOptions
();
options
.
setReceiveBufferSize
(
64
*
1024
*
1024
);
options
.
setSendBufferSize
(
64
*
1024
*
1024
);
options
.
setKeepAliveTime
(
20
);
final
RpcServer
rpcServer
=
new
RpcServer
(
port
,
options
);
rpcServer
.
registerService
(
new
EchoServiceImpl
());
rpcServer
.
start
();
}
}
test/plugin/scenarios/baidu-brpc-scenario/src/main/java/org/apache/skywalking/apm/testcase/baidu.brpc/controller/CaseController.java
0 → 100644
浏览文件 @
31f42343
/*
* 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.testcase.baidu.brpc.controller
;
import
com.baidu.brpc.RpcContext
;
import
com.baidu.brpc.client.BrpcProxy
;
import
com.baidu.brpc.client.RpcClient
;
import
com.baidu.brpc.client.RpcClientOptions
;
import
com.baidu.brpc.client.loadbalance.LoadBalanceStrategy
;
import
com.baidu.brpc.exceptions.RpcException
;
import
com.baidu.brpc.protocol.Options
;
import
org.apache.skywalking.apm.testcase.baidu.brpc.interfaces.Echo
;
import
org.apache.skywalking.apm.testcase.baidu.brpc.interfaces.Echo.EchoResponse
;
import
org.apache.skywalking.apm.testcase.baidu.brpc.interfaces.EchoService
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/case"
)
public
class
CaseController
{
private
static
final
String
SUCCESS
=
"Success"
;
@RequestMapping
(
"/healthCheck"
)
@ResponseBody
public
String
healthCheck
()
{
return
SUCCESS
;
}
@RequestMapping
(
"/brpc"
)
@ResponseBody
public
String
brpc
()
{
RpcClientOptions
clientOption
=
new
RpcClientOptions
();
clientOption
.
setProtocolType
(
Options
.
ProtocolType
.
PROTOCOL_BAIDU_STD_VALUE
);
clientOption
.
setWriteTimeoutMillis
(
1000
);
clientOption
.
setReadTimeoutMillis
(
5000
);
clientOption
.
setMaxTotalConnections
(
1000
);
clientOption
.
setMinIdleConnections
(
10
);
clientOption
.
setLoadBalanceType
(
LoadBalanceStrategy
.
LOAD_BALANCE_FAIR
);
clientOption
.
setCompressType
(
Options
.
CompressType
.
COMPRESS_TYPE_NONE
);
String
serviceUrl
=
"list://127.0.0.1:1118"
;
Echo
.
EchoRequest
request
=
Echo
.
EchoRequest
.
newBuilder
()
.
setMessage
(
"helloooooooooooo"
)
.
build
();
RpcClient
rpcClient
=
new
RpcClient
(
serviceUrl
,
clientOption
);
EchoService
echoService
=
BrpcProxy
.
getProxy
(
rpcClient
,
EchoService
.
class
);
try
{
EchoResponse
response
=
echoService
.
echo
(
request
);
System
.
out
.
println
(
response
.
getMessage
());
}
catch
(
RpcException
ex
)
{
}
rpcClient
.
stop
();
return
SUCCESS
;
}
}
test/plugin/scenarios/baidu-brpc-scenario/src/main/java/org/apache/skywalking/apm/testcase/baidu.brpc/interfaces/Echo.java
0 → 100644
浏览文件 @
31f42343
此差异已折叠。
点击以展开。
test/plugin/scenarios/baidu-brpc-scenario/src/main/java/org/apache/skywalking/apm/testcase/baidu.brpc/interfaces/EchoService.java
0 → 100755
浏览文件 @
31f42343
/*
* 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.testcase.baidu.brpc.interfaces
;
import
com.baidu.brpc.protocol.BrpcMeta
;
/**
* Copy from brpc-java-example
*/
public
interface
EchoService
{
@BrpcMeta
(
serviceName
=
"example.EchoService"
,
methodName
=
"Echo"
)
Echo
.
EchoResponse
echo
(
Echo
.
EchoRequest
request
);
}
test/plugin/scenarios/baidu-brpc-scenario/src/main/java/org/apache/skywalking/apm/testcase/baidu.brpc/service/EchoServiceImpl.java
0 → 100755
浏览文件 @
31f42343
/*
* 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.testcase.baidu.brpc.service
;
import
com.baidu.brpc.RpcContext
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.Unpooled
;
import
org.apache.skywalking.apm.testcase.baidu.brpc.interfaces.Echo
;
import
org.apache.skywalking.apm.testcase.baidu.brpc.interfaces.EchoService
;
/**
* Copy from brpc-java-example
*/
public
class
EchoServiceImpl
implements
EchoService
{
@Override
public
Echo
.
EchoResponse
echo
(
Echo
.
EchoRequest
request
)
{
if
(
RpcContext
.
isSet
())
{
RpcContext
rpcContext
=
RpcContext
.
getContext
();
ByteBuf
attachment
=
rpcContext
.
getRequestBinaryAttachment
();
if
(
attachment
!=
null
)
{
rpcContext
.
setResponseBinaryAttachment
(
Unpooled
.
copiedBuffer
(
attachment
));
}
}
String
message
=
request
.
getMessage
();
Echo
.
EchoResponse
response
=
Echo
.
EchoResponse
.
newBuilder
()
.
setMessage
(
message
).
build
();
return
response
;
}
}
test/plugin/scenarios/baidu-brpc-scenario/src/main/resources/application.yml
0 → 100644
浏览文件 @
31f42343
# 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.
server
:
port
:
8080
servlet
:
context-path
:
/baidu-brpc-scenario
\ No newline at end of file
test/plugin/scenarios/baidu-brpc-scenario/support-version.list
0 → 100644
浏览文件 @
31f42343
# 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
# "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.
2.3.7
2.4.0
2.4.1
2.4.2
2.4.3
2.4.4
2.4.5
2.4.6
2.5.0
2.5.1
2.5.2
2.5.3
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录