## Support custom enhance Here is an optional plugin `apm-customize-enhance-plugin` ## Introduce SkyWalking has provided [Java agent plugin development guide](Java-Plugin-Development-Guide.md) to help developers to build new plugin. This plugin is not designed for replacement but for user convenience. The behaviour is very similar with [@Trace toolkit](Application-toolkit-trace.md), but without code change requirement, and more powerful, such as provide tag and log. ## How to configure Implementing enhancements to custom classes requires two steps. 1. Active the plugin, move the `optional-plugins/apm-customize-enhance-plugin.jar` to `plugin/apm-customize-enhance-plugin.jar`. 2. Set `plugin.customize.enhance_file` in agent.config, which targets to rule file, such as `/absolute/path/to/customize_enhance.xml`. 3. Set enhancement rules in `customize_enhance.xml`. ```xml arg[0] arg[1] arg[3].[0] arg[2].['k1'] arg[4].[1] arg[4].[2] arg[0] arg[0] arg[1] arg[0].id arg[0].model1.name arg[0].model1.getId() arg[0].os.[1] arg[0].getM().['k1'] returnedObj returnedObj returnedObj.model1.id returnedObj.model1.getId() arg[0] arg[1] arg[0].[0] arg[0].[0] arg[1] returnedObj.[0] returnedObj.[1] returnedObj.[0] returnedObj.[1] returnedObj.['k1'] returnedObj.['k2'] - Explanation of the configuration in the file | configuration | explanation | |:----------------- |:---------------| | class_name | The enhanced class | | method | The interceptor method of the class | | operation_name | If fill it out, will use it instead of the default operation_name. | | operation_name\_suffix | What it means adding dynamic data after the operation_name. | | static | Is this method static. | | tag | Will add a tag in local span. The value of key needs to be represented on the XML node. | | log | Will add a log in local span. The value of key needs to be represented on the XML node. | | arg[x] | What it means is to get the input arguments. such as arg[0] is means get first arguments. | | .[x] | When the parsing object is Array or List, you can use it to get the object at the specified index. | | .['key'] | When the parsing object is Map, you can get the map 'key' through it.| | returnedObj | What it means is to get the return value. |