Commit Graph

138 Commits

Author SHA1 Message Date
Gong Dewei db54c65d09
Optimize bytebuddy type description performance (#637)
### Improve the performance of type description of byte-buddy
The goal is to get the original class description at re-transform, so as to generate consistent results when the Skywalking agent is enhanced again (including implementing the EnhancedInstance interface, auxiliary fields and methods, etc.)

The previous type description used the `AgentBuilder.DescriptionStrategy.Default.POOL_FIRST` policy to get origin type description, which slows down the application startup, due to heavy I/O operations and parsing bytecode. 

New way is to remove dynamic fields, methods and interfaces generated by SkyWalking Agent from `TypeDescription`, and **make it as origin type descripton**.

**Key feature** :  
* No need to cache `TypeDescription` objects, less memory used.
* It only applies to the re-transform class processing flow and does not affect the startup process.

**Process flow:**
1. Find `TypeDescription` from commonly used type cache, such as primitive class.
2. Delegate to `AgentBuilder.DescriptionStrategy.Default.HYBRID`
3. Wrap `TypeDescription` by `SWTypeDescriptionWrapper` , remove fields, methods, interface generated by SkyWalking. 

**Relative Issue:**  https://github.com/apache/skywalking/issues/11460
2023-11-03 09:45:28 +08:00
吴晟 Wu Sheng 6e47084501
Release 9.0.0 and set 9.1.0-SNAPSHOT for next iteration (#600)
* [maven-release-plugin] prepare release v9.0.0

* [maven-release-plugin] prepare for next development iteration

* Create changes-9.0.0.md

* Update CHANGES.md

---------

Co-authored-by: Wu Sheng <“wu.sheng@foxmail.com”>
2023-08-29 11:57:56 +08:00
吴晟 Wu Sheng b9dd0f24b7
Update version to 9.0.0 with new change logs. (#563) 2023-06-25 09:18:28 +08:00
Gong Dewei 267aba8fad
Improve bytebuddy class enhance for retransform classes (#561)
* SWAuxiliaryTypeNamingStrategy
Auxiliary type name pattern: <origin_class_name>$<name_trait>$auxiliary$<auxiliary_type_instance_hash>

* DelegateNamingResolver
Interceptor delegate field name pattern: <name_trait>$delegate$<class_name_hash>$<plugin_define_hash>$<intercept_point_hash>

* SWMethodNameTransformer
Renamed origin method pattern: <name_trait>$original$<method_name>$<method_description_hash>

* SWImplementationContextFactory
Method cache value field pattern: cachedValue$<name_trait>$<origin_class_name_hash>$<field_value_hash>
Accessor method name pattern:  <renamed_origin_method>$accessor$<name_trait>$<origin_class_name_hash>

Here is an example of manipulated enhanced class with new naming policies of auxiliary classes, fields, and methods

```java
 import sample.mybatis.controller.HotelController$sw$auxiliary$19cja42;
 import sample.mybatis.controller.HotelController$sw$auxiliary$p257su0;
 import sample.mybatis.domain.Hotel;
 import sample.mybatis.service.HotelService;

 @RequestMapping(value={"/hotel"})
 @RestController
 public class HotelController
 implements EnhancedInstance {
     @Autowired
     @Lazy
     private HotelService hotelService;
     private volatile Object _$EnhancedClassField_ws;

     // Interceptor delegate fields
     public static volatile /* synthetic */ InstMethodsInter sw$delegate$td03673$ain2do0$8im5jm1;
     public static volatile /* synthetic */ InstMethodsInter sw$delegate$td03673$ain2do0$edkmf61;
     public static volatile /* synthetic */ ConstructorInter sw$delegate$td03673$ain2do0$qs9unv1;
     public static volatile /* synthetic */ InstMethodsInter sw$delegate$td03673$fl4lnk1$m3ia3a2;
     public static volatile /* synthetic */ InstMethodsInter sw$delegate$td03673$fl4lnk1$sufrvp1;
     public static volatile /* synthetic */ ConstructorInter sw$delegate$td03673$fl4lnk1$cteu7s1;

     // Origin method cache value field
     private static final /* synthetic */ Method cachedValue$sw$td03673$g5sobj1;

     public HotelController() {
         this(null);
         sw$delegate$td03673$ain2do0$qs9unv1.intercept(this, new Object[0]);
     }

     private /* synthetic */ HotelController(sw.auxiliary.p257su0 p257su02) {
     }

     @GetMapping(value={"city/{cityId}"})
     public Hotel selectByCityId(@PathVariable(value="cityId") int n) {
         // call interceptor with auxiliary type and parameters and origin method object
         return (Hotel)sw$delegate$td03673$ain2do0$8im5jm1.intercept(this, new Object[]{n}, new HotelController$sw$auxiliary$19cja42(this, n), cachedValue$sw$td03673$g5sobj1);
     }

     // Renamed origin method
     private /* synthetic */ Hotel sw$origin$selectByCityId$a8458p3(int cityId) {
/*22*/         return this.hotelService.selectByCityId(cityId);
     }

     // Accessor of renamed origin method, calling from auxiliary type
     final /* synthetic */ Hotel sw$origin$selectByCityId$a8458p3$accessor$sw$td03673(int n) {
         // Calling renamed origin method
         return this.sw$origin$selectByCityId$a8458p3(n);
     }

     @Override
     public Object getSkyWalkingDynamicField() {
         return this._$EnhancedClassField_ws;
     }

     @Override
     public void setSkyWalkingDynamicField(Object object) {
         this._$EnhancedClassField_ws = object;
     }

     static {
         ClassLoader.getSystemClassLoader().loadClass("org.apache.skywalking.apm.dependencies.net.bytebuddy.dynamic.Nexus").getMethod("initialize", Class.class, Integer.TYPE).invoke(null, HotelController.class, -1072476370);
         // Method object
         cachedValue$sw$td03673$g5sobj1 = HotelController.class.getMethod("selectByCityId", Integer.TYPE);
     }
 }
```

Auxiliary type of Constructor : 
```java
class HotelController$sw$auxiliary$p257su0 {
}
```

Auxiliary type of  `selectByCityId` method: 
```java
class HotelController$sw$auxiliary$19cja42
implements Runnable,
Callable {
    private HotelController argument0;
    private int argument1;

    public Object call() throws Exception {
        return this.argument0.sw$origin$selectByCityId$a8458p3$accessor$sw$td03673(this.argument1);
    }

    @Override
    public void run() {
        this.argument0.sw$origin$selectByCityId$a8458p3$accessor$sw$td03673(this.argument1);
    }

    HotelController$sw$auxiliary$19cja42(HotelController hotelController, int n) {
        this.argument0 = hotelController;
        this.argument1 = n;
    }
}
```
2023-06-24 20:50:10 +08:00
吴晟 Wu Sheng d074a0a063
Release 8.16.0 and set 8.17.0-SNAPSHOT for next iteration (#543) 2023-05-31 22:46:05 +08:00
Jiajing LU 04603b2027
Chore: fix exclusion rules in maven-shade-plugin (#525)
* exclude checkerframework j2objc, and protos
2023-05-08 12:12:02 +08:00
吴晟 Wu Sheng 7a6334d2b5
Begin 8.16.0 iteration (#501)
* [maven-release-plugin] prepare release v8.15.0

* [maven-release-plugin] prepare for next development iteration

* Create changes-8.15.0.md

* Set changes.md for 8.16.0
2023-04-04 09:15:21 +08:00
吴晟 Wu Sheng 8c989b74e9
Release 8.14.0, begin for 8.15.0 iteration (#440) 2023-01-12 11:00:25 +08:00
吴晟 Wu Sheng 5cffa078e1
Add a config `agent.enable`(default: true) to support disabling agent (#439) 2023-01-11 17:14:23 +08:00
吴晟 Wu Sheng 70b3e88b0f
Release 8.13.0, begin 8.14.0 iteration (#378) 2022-11-06 21:46:51 +08:00
吴晟 Wu Sheng b8f99e95e5
Begin 8.13.0 iteration, 8.12.0 release is on vote (#301)
* [maven-release-plugin] prepare release v8.12.0

* [maven-release-plugin] prepare for next development iteration

* Create changes-8.12.0.md

* Update CHANGES.md
2022-09-01 16:51:48 +08:00
吴晟 Wu Sheng 7b256a61c1
* Upgrade byte-buddy to 1.12.13, and adopt byte-buddy APIs changes. (#287) 2022-08-02 09:14:31 +08:00
吴晟 Wu Sheng 8de87f5556
Begin 8.12.0 iteration (#214)
* [maven-release-plugin] prepare release v8.11.0

* [maven-release-plugin] prepare for next development iteration

* Create changes-8.11.0.md

* Update CHANGES.md
2022-06-18 12:05:56 +08:00
吴晟 Wu Sheng 0ac754730c
Begin 8.11.0 iteration (#155) 2022-04-13 08:51:17 +08:00
Cool-Coding a5ccbca693
[Feature] Add JDK ThreadPoolExecutor plugin(#8743) (#146) 2022-04-12 20:12:54 +08:00
吴晟 Wu Sheng 395ce4f86a
Release 8.9.0 and set next version to 8.10.0 (#101)
* [maven-release-plugin] prepare release v8.9.0

* [maven-release-plugin] prepare for next development iteration
2022-01-28 21:23:43 +08:00
wankai123 ec1b7a19a4
Initialize 8.9.0 iteration (#59) 2021-10-27 22:57:09 +08:00
吴晟 Wu Sheng 5b7cf51f43
Set up release process and make release doc ready. (#11)
* Set up release process and make release doc ready.

* Fix missing license files.

* Fix link check skip rules.

* Add a new pattern.
2021-08-27 18:11:57 +08:00
kezhenxu94 a6b174a09d
Set up CI and clean up (#3) 2021-08-27 07:50:30 +08:00
吴晟 Wu Sheng 1c5e22a7be
Begin 8.8.0 iteration (#7395)
* [maven-release-plugin] prepare release v8.7.0

* [maven-release-plugin] prepare for next development iteration
2021-07-30 23:01:09 +08:00
Ax1an 402902f75c
Agent supports the collection of JVM arguments and jar dependencies information. (#7069) 2021-06-17 15:30:44 +08:00
吴晟 Wu Sheng 5eb1021639
Initialize 8.7.0 iteration (#7078) 2021-06-08 07:41:09 +08:00
吴晟 Wu Sheng 17e820f156
Begin 8.6.0 iteration (#6721) 2021-04-09 23:01:00 +08:00
Zhenxu Ke 665a07cb0f
Clean up some warnings in maven build (#6426) 2021-02-24 07:05:56 +08:00
libinglong d12d3f201a
add redefine listener (#6309) 2021-02-03 16:27:06 +08:00
吴晟 Wu Sheng cdfe6ab358
Begin the 8.5.0 iteration (#6302)
* [maven-release-plugin] prepare release v8.4.0

* [maven-release-plugin] prepare for next development iteration
2021-02-02 08:01:49 +08:00
吴晟 Wu Sheng af19c72a7e
8.3.0 tagged, open for 8.3.0 iteration. (#5920)
* [maven-release-plugin] prepare release v8.3.0

* [maven-release-plugin] prepare for next development iteration
2020-11-29 11:01:20 +08:00
kezhenxu94 f92a7bf897
Start next iteration 8.3.0 (#5719)
* [maven-release-plugin] prepare release v8.2.0

* [maven-release-plugin] prepare for next development iteration
2020-10-24 19:30:29 +08:00
zifeihan 06bec02869
Fix application start duration log "Failed to load class org.slf4j.impl.StaticLoggerBinder." (#5678)
* Fix application start duration log "Failed to load class "org.slf4j.impl.StaticLoggerBinder"." when use kafka reporter. because kafka reporter use slf4j-api, but no implementor for slf4j.

* Polishing.

* Adapter slf4j Logger of agent used to skywalking agent Logger.

* Make the comments more accurate.

Co-authored-by: 吴晟 Wu Sheng <wu.sheng@foxmail.com>
2020-10-17 09:44:42 +08:00
Lu Jiajing 9442a51c11
JsonLogger implementation (#5356) (#5357) 2020-08-29 23:17:29 +08:00
Lu Jiajing 5bfac1b50f
Remove style-check exception for logger (#5363) 2020-08-21 18:26:25 +08:00
吴晟 Wu Sheng 2f2840cbf5
Begin 8.2.0 iteration. (#5211)
* [maven-release-plugin] prepare release v8.1.0

* [maven-release-plugin] prepare for next development iteration
2020-07-31 20:15:27 +08:00
吴晟 Wu Sheng 20b1b51798
Separate config initialization in the plugin out of core level Config. (#5136) 2020-07-21 20:51:56 +08:00
gongdewei 1817386391
Support cache mode in the agent. (#4858) 2020-07-01 23:20:50 +08:00
吴晟 Wu Sheng 5de0d2c6f6
Set version to 8.1.0 for next iteration. (#4916)
* [maven-release-plugin] prepare release v8.0.0

* [maven-release-plugin] prepare for next development iteration

* Remove all shardingsphere cases.
2020-06-12 23:44:42 +08:00
吴晟 Wu Sheng fa9a44b750
Version number changed including a little documentation. (#4597) 2020-03-31 12:57:20 +08:00
吴晟 Wu Sheng 61f98c81f0
Move the main branch to 7.1.0 iteration. (#4537)
* [maven-release-plugin] prepare release v7.0.0

* [maven-release-plugin] prepare for next development iteration
2020-03-19 10:38:41 +08:00
kezhenxu94 5b255ba3e3
Set up more strict code styles and fix existing issues (#4337)
Motivation:

Review code styles with some bots automatically.

Modifications:

Set up ReviewDog in GitHub Action to review code style.

Add more check rules to checkstyle plugin.

Result:

Obvious code styles can be reviewed and commented automatically.
2020-02-11 17:10:49 +08:00
kezhenxu94 f676aece1f
Remove unused codes, close leaked I/O stream (#4325)
### Motivation:

Clean up unused codes and migrate to JDK8.

### Modifications:

- Remove unused codes.

- Close unclosed I/O stream.

- Remove meaningless comments.

### Result:

- No unnecessary codes concerns.

- No resources leak.
2020-02-08 09:21:24 +08:00
吴晟 Wu Sheng b570996006
Update JDK compiling level to 8, and remove zip dist. (#4119)
* Update JDK compiling level to 8, and remove zip dist.

* Exclude annotation and shade API.

* Fix more exclusion.

* 1. Update grava and gson 2. Fix compile issue. 3. Keep protoc and maven plugin in old version. Some incompatible of 3rd party grpc proto.

* Fix dependency conflicts, license and notice issue, and dependency check script issue

Co-authored-by: kezhenxu94 <kezhenxu94@163.com>
2019-12-25 15:55:24 +08:00
吴晟 Wu Sheng d7f7799c80
Set the main branch to 7.0.0-SNAPSHOT (#4115)
* [maven-release-plugin] prepare release v6.6.0

* [maven-release-plugin] prepare for next development iteration
2019-12-24 16:37:13 +08:00
wujun8 424ec7efcf ignore kryo ".reflectasm." class (#3845)
When using kryo, Byte-buddy occurs exception when match type.

> java.lang.IllegalStateException: Cannot resolve type description for com.esotericsoftware.reflectasm.PublicConstructorAccess
2019-11-13 19:32:53 +08:00
吴晟 Wu Sheng 3fbaec42dc
Move to 6.6.0 SNAPSHOT (#3839)
* [maven-release-plugin] prepare release v6.5.0

* [maven-release-plugin] prepare for next development iteration
2019-11-12 22:33:39 +08:00
吴晟 Wu Sheng ce20fe107d
Move to 6.5.0 (#3439)
* [maven-release-plugin] prepare release v6.4.0

* [maven-release-plugin] prepare for next development iteration
2019-09-08 16:24:21 -07:00
evanxuhe 1cc4a517c2 Log4j2 support AsyncRoot print tid. All versions above 2.0 supported (#3284)
* Log4j2 support AsyncRoot print tid
Support AsyncRoot print tid of all versions of log4j2 2.1+
2019-08-26 21:00:46 +08:00
吴晟 Wu Sheng 0ae2228a86
Make auto instrumentation works when Module definition existing (#3199)
* Refactor open edge.

* Make refactor works.

* Revert log back.

* Remove unnecessary codes.

* Open edge for all internal binding interceptors.

* Add document about JDK 9+ module.

* Change bytebuddy to 1.10.1(unreleased)

* Change document

* 1. Adopt the latest bytebudy changes(snapshot only), commit b609711564.
2. Remove disruptor by ArrayBlockingQueue, because Disruptor can't work in both JDK 8(1) and 9-12, if we don't add `--add-modules jdk.unsupported`
3. Doc update.

* Update README.md
2019-08-15 07:46:28 +08:00
吴晟 Wu Sheng b247dc979e
Move project master branch to 6.4.0-SNAPSHOT (#3220)
* [maven-release-plugin] prepare release v6.3.0

* [maven-release-plugin] prepare for next development iteration
2019-08-05 21:19:17 +08:00
吴晟 Wu Sheng b091c0ae48
Make bootstrap instrumentation available in JDK9 - 11 (#3194)
* Make JDK9-11 available for bootstrap instrumentation

* Remove temp folder of old bootstrap instrumentation requirement.
2019-07-31 15:30:11 +08:00
于玉桔 26c6767c36 fix-3155 (#3186) 2019-07-29 14:43:49 +08:00
吴晟 Wu Sheng d66f775fe5
Remove javassist from agent dependency (#3176)
* Remove javassist dependency

*   Finish the PR.

* Change doc title level.

* Remove the duplicated codes.
2019-07-28 23:33:48 +08:00