From 67b8e1f1f7d8b900ce22ef97a9c5725e4c48c9de Mon Sep 17 00:00:00 2001 From: lvxiao Date: Thu, 22 Dec 2022 11:57:28 +0800 Subject: [PATCH 1/2] intercept the update of the database name through method setDatabase --- .../v8/define/ConnectionInstrumentation.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apm-sniffer/apm-sdk-plugin/mysql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/v8/define/ConnectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/mysql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/v8/define/ConnectionInstrumentation.java index c464e2b2a9..a79c92251c 100644 --- a/apm-sniffer/apm-sdk-plugin/mysql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/v8/define/ConnectionInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/mysql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/v8/define/ConnectionInstrumentation.java @@ -115,6 +115,22 @@ public String getMethodsInterceptor() { return org.apache.skywalking.apm.plugin.jdbc.mysql.Constants.SET_CATALOG_INTERCEPTOR; } + @Override + public boolean isOverrideArgs() { + return false; + } + }, + new InstanceMethodsInterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("setDatabase"); + } + + @Override + public String getMethodsInterceptor() { + return org.apache.skywalking.apm.plugin.jdbc.mysql.Constants.SET_CATALOG_INTERCEPTOR; + } + @Override public boolean isOverrideArgs() { return false; From 6bac7fef1c3a514dfbdd14cd3f070e147ec82580 Mon Sep 17 00:00:00 2001 From: lvxiao Date: Thu, 22 Dec 2022 15:14:13 +0800 Subject: [PATCH 2/2] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 9c4cdb3b94..717dae3830 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,7 @@ Release Notes. * Add [Micrometer Observation](https://github.com/micrometer-metrics/micrometer/) support * Add tags `mq.message.keys` and `mq.message.tags` for RocketMQ producer span * Clean the trace context which injected into Pulsar MessageImpl after the instance recycled +* Fix In the higher version of mysql-connector-java 8x, there is an error in the value of db.instance. #### Documentation