You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/09/21 23:14:59 UTC
[skywalking] branch master updated: Add `MOUNT` config in the agent
core. (#5529)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 075cb98 Add `MOUNT` config in the agent core. (#5529)
075cb98 is described below
commit 075cb981a9d9140629a4435a9d79dce0f7ece8ec
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Tue Sep 22 07:14:34 2020 +0800
Add `MOUNT` config in the agent core. (#5529)
---
.../java/org/apache/skywalking/apm/agent/core/conf/Config.java | 8 +++++++-
.../apm/agent/core/plugin/loader/AgentClassLoader.java | 4 ++--
apm-sniffer/config/agent.config | 9 ++++++---
docs/en/setup/service-agent/java-agent/README.md | 1 +
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
index c1b1019..41a86d4 100755
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Config.java
@@ -18,7 +18,9 @@
package org.apache.skywalking.apm.agent.core.conf;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
import org.apache.skywalking.apm.agent.core.logging.core.LogLevel;
@@ -122,7 +124,6 @@ public class Config {
* Keep tracing even the backend is not available.
*/
public static boolean KEEP_TRACING = false;
-
}
public static class OsInfo {
@@ -292,6 +293,11 @@ public class Config {
* Exclude activated plugins
*/
public static String EXCLUDE_PLUGINS = "";
+
+ /**
+ * Mount the folders of the plugins. The folder path is relative to agent.jar.
+ */
+ public static List<String> MOUNT = Arrays.asList("plugins", "activations");
}
public static class Correlation {
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/loader/AgentClassLoader.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/loader/AgentClassLoader.java
index a459a22..d6c806a 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/loader/AgentClassLoader.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/loader/AgentClassLoader.java
@@ -35,6 +35,7 @@ import lombok.RequiredArgsConstructor;
import org.apache.skywalking.apm.agent.core.boot.AgentPackageNotFoundException;
import org.apache.skywalking.apm.agent.core.boot.AgentPackagePath;
import org.apache.skywalking.apm.agent.core.boot.PluginConfig;
+import org.apache.skywalking.apm.agent.core.conf.Config;
import org.apache.skywalking.apm.agent.core.conf.SnifferConfigInitializer;
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
@@ -85,8 +86,7 @@ public class AgentClassLoader extends ClassLoader {
super(parent);
File agentDictionary = AgentPackagePath.getPath();
classpath = new LinkedList<>();
- classpath.add(new File(agentDictionary, "plugins"));
- classpath.add(new File(agentDictionary, "activations"));
+ Config.Plugin.MOUNT.forEach(mountFolder -> classpath.add(new File(agentDictionary, mountFolder)));
}
@Override
diff --git a/apm-sniffer/config/agent.config b/apm-sniffer/config/agent.config
index fdf4699..1ee8b86 100644
--- a/apm-sniffer/config/agent.config
+++ b/apm-sniffer/config/agent.config
@@ -92,14 +92,17 @@ logging.level=${SW_LOGGING_LEVEL:INFO}
# The max recursive depth when checking the exception traced by the agent. Typically, we don't recommend setting this more than 10, which could cause a performance issue. Negative value and 0 would be ignored, which means all exceptions would make the span tagged in error status.
# statuscheck.max_recursive_depth=${SW_STATUSCHECK_MAX_RECURSIVE_DEPTH:1}
+# Mount the specific folders of the plugins. Plugins in mounted folders would work.
+plugin.mount=${SW_MOUNT_FOLDERS:plugins,activations}
+
+# Exclude activated plugins
+# plugin.exclude_plugins=${SW_EXCLUDE_PLUGINS:}
+
# mysql plugin configuration
# plugin.mysql.trace_sql_parameters=${SW_MYSQL_TRACE_SQL_PARAMETERS:false}
# Kafka producer configuration
# plugin.kafka.bootstrap_servers=${SW_KAFKA_BOOTSTRAP_SERVERS:localhost:9092}
-# Exclude activated plugins
-# plugin.exclude_plugins=${SW_EXCLUDE_PLUGINS:}
-
# Match spring bean with regex expression for classname
# plugin.springannotation.classname_match_regex=${SW_SPRINGANNOTATION_CLASSNAME_MATCH_REGEX:}
diff --git a/docs/en/setup/service-agent/java-agent/README.md b/docs/en/setup/service-agent/java-agent/README.md
index ab09956..54ae20d 100755
--- a/docs/en/setup/service-agent/java-agent/README.md
+++ b/docs/en/setup/service-agent/java-agent/README.md
@@ -113,6 +113,7 @@ property key | Description | Default |
`meter.active`|If true, the agent collects and reports metrics to the backend.|`true`|
`meter.report_interval`|Report meters interval. The unit is second|`20`|
`meter.max_meter_size`| Max size of the meter pool |`500`|
+`plugin.mount` | Mount the specific folders of the plugins. Plugins in mounted folders would work. | `plugins,activations` |
`plugin.peer_max_length `|Peer maximum description limit.|`200`|
`plugin.exclude_plugins `|Exclude some plugins define in plugins dir.Plugin names is defined in [Agent plugin list](Plugin-list.md)|`""`|
`plugin.mongodb.trace_param`|If true, trace all the parameters in MongoDB access, default is false. Only trace the operation, not include parameters.|`false`|