提交 efad1165 编写于 作者: L lixin40

add system env for trace ignore plugin

上级 5577f67d
......@@ -20,4 +20,4 @@
# /path/* Match any number of characters
# /path/** Match any number of characters and support multilevel directories
# Multiple path comma separation, like trace.ignore_path=/eureka/**,/consul/**
#trace.ignore_path=/eureka/**
#trace.ignore_path=${SW_TRACE_IGNORE_PATH:/eureka/**}
\ No newline at end of file
......@@ -24,6 +24,9 @@ import org.apache.skywalking.apm.agent.core.conf.ConfigNotFoundException;
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
import org.apache.skywalking.apm.util.ConfigInitializer;
import org.apache.skywalking.apm.util.PlaceholderConfigurerSupport;
import org.apache.skywalking.apm.util.PropertyPlaceholderHelper;
import org.apache.skywalking.apm.util.StringUtil;
import java.io.File;
import java.io.FileInputStream;
......@@ -57,6 +60,18 @@ public class IgnoreConfigInitializer {
configFileStream = loadConfigFromAgentFolder();
Properties properties = new Properties();
properties.load(configFileStream);
PropertyPlaceholderHelper helper =
new PropertyPlaceholderHelper(PlaceholderConfigurerSupport.DEFAULT_PLACEHOLDER_PREFIX,
PlaceholderConfigurerSupport.DEFAULT_PLACEHOLDER_SUFFIX,
PlaceholderConfigurerSupport.DEFAULT_VALUE_SEPARATOR, true);
for (String key : properties.stringPropertyNames()) {
String value = (String)properties.get(key);
//replace the key's value. properties.replace(key,value) in jdk8+
value = helper.replacePlaceholders(value, properties);
if (!StringUtil.isEmpty(value)) {
properties.put(key, helper.replacePlaceholders(value, properties));
}
}
ConfigInitializer.initialize(properties, IgnoreConfig.class);
} catch (Exception e) {
LOGGER.error(e, "Failed to read the config file, skywalking is going to run in default config.");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册