Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
润土的好友猹
SkyWalking
提交
6910ff3d
S
SkyWalking
项目概览
润土的好友猹
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
9
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,发现更多精彩内容 >>
未验证
提交
6910ff3d
编写于
8月 06, 2020
作者:
wu-sheng
提交者:
GitHub
8月 06, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add Customization Config section for plugin development. (#5249)
上级
dd6f439d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
1 deletion
+49
-1
apm-protocol/apm-network/src/main/proto
apm-protocol/apm-network/src/main/proto
+1
-1
docs/en/guides/Java-Plugin-Development-Guide.md
docs/en/guides/Java-Plugin-Development-Guide.md
+48
-0
未找到文件。
proto
@
89381e14
比较
87ed1f4e
...
89381e14
Subproject commit 8
7ed1f4e31b0517a7efff27d46a47829c7f533f9
Subproject commit 8
9381e14f9c29c4ee240c5e55c66ab44381924ca
docs/en/guides/Java-Plugin-Development-Guide.md
浏览文件 @
6910ff3d
...
...
@@ -375,6 +375,54 @@ public class URLInstrumentation extends ClassEnhancePluginDefine {
**NOTICE**
, doing bootstrap instrumentation should only happen in necessary, but mostly it effect the JRE core(rt.jar),
and could make very unexpected result or side effect.
### Provide Customization Config for the Plugin
The config could provide different behaviours based on the configurations. SkyWalking plugin mechanism provides the configuration
injection and initialization system in the agent core.
Every plugin could declare one or more classes to represent the config by using
`@PluginConfig`
annotation. The agent core
could initialize this class' static field though System environments, System properties, and
`agent.config`
static file.
The
`#root()`
method in the
`@PluginConfig`
annotation requires to declare the root class for the initialization process.
Typically, SkyWalking prefers to use nested inner static classes for the hierarchy of the configuration.
Recommend using
`Plugin`
/
`plugin-name`
/
`config-key`
as the nested classes structure of the Config class.
NOTE, because of the Java ClassLoader mechanism, the
`@PluginConfig`
annotation should be added on the real class used in the interceptor codes.
Such as, in the following example,
`@PluginConfig(root = SpringMVCPluginConfig.class)`
represents the initialization should
start with using
`SpringMVCPluginConfig`
as the root. Then the config key of the attribute
`USE_QUALIFIED_NAME_AS_ENDPOINT_NAME`
,
should be
`plugin.springmvc.use_qualified_name_as_endpoint_name`
.
```
java
public
class
SpringMVCPluginConfig
{
public
static
class
Plugin
{
// NOTE, if move this annotation on the `Plugin` or `SpringMVCPluginConfig` class, it no longer has any effect.
@PluginConfig
(
root
=
SpringMVCPluginConfig
.
class
)
public
static
class
SpringMVC
{
/**
* If true, the fully qualified method name will be used as the endpoint name instead of the request URL,
* default is false.
*/
public
static
boolean
USE_QUALIFIED_NAME_AS_ENDPOINT_NAME
=
false
;
/**
* This config item controls that whether the SpringMVC plugin should collect the parameters of the
* request.
*/
public
static
boolean
COLLECT_HTTP_PARAMS
=
false
;
}
@PluginConfig
(
root
=
SpringMVCPluginConfig
.
class
)
public
static
class
Http
{
/**
* When either {@link Plugin.SpringMVC#COLLECT_HTTP_PARAMS} is enabled, how many characters to keep and send
* to the OAP backend, use negative values to keep and send the complete parameters, NB. this config item is
* added for the sake of performance
*/
public
static
int
HTTP_PARAMS_LENGTH_THRESHOLD
=
1024
;
}
}
}
```
### Plugin Test Tool
[
Apache SkyWalking Agent Test Tool Suite
](
https://github.com/apache/skywalking-agent-test-tool
)
a tremendously useful test tools suite in a wide variety of languages of Agent. Includes mock collector and validator.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录