提交 11212c40 编写于 作者: I IluckySi 提交者: wu-sheng

Modify some spell error and prompt error (#2488)

上级 73cdce57
...@@ -40,7 +40,7 @@ public class Config { ...@@ -40,7 +40,7 @@ public class Config {
public static String NAMESPACE = ""; public static String NAMESPACE = "";
/** /**
* Application code is showed in skywalking-ui. Suggestion: set a unique name for each service, * Service name is showed in skywalking-ui. Suggestion: set a unique name for each service,
* service instance nodes share the same code * service instance nodes share the same code
*/ */
public static String SERVICE_NAME = ""; public static String SERVICE_NAME = "";
......
...@@ -54,11 +54,11 @@ public class SnifferConfigInitializer { ...@@ -54,11 +54,11 @@ public class SnifferConfigInitializer {
* specified agent config path is not set , the agent will try to locate `agent.config`, which should be in the * specified agent config path is not set , the agent will try to locate `agent.config`, which should be in the
* /config dictionary of agent package. * /config dictionary of agent package.
* <p> * <p>
* Also try to override the config by system.env and system.properties. All the keys in these two places should * Also try to override the config by system.properties. All the keys in this place should
* start with {@link #ENV_KEY_PREFIX}. e.g. in env `skywalking.agent.application_code=yourAppName` to override * start with {@link #ENV_KEY_PREFIX}. e.g. in env `skywalking.agent.service_name=yourAppName` to override
* `agent.application_code` in config file. * `agent.service_name` in config file.
* <p> * <p>
* At the end, `agent.application_code` and `collector.servers` must be not blank. * At the end, `agent.service_name` and `collector.servers` must be not blank.
*/ */
public static void initialize(String agentOptions) throws ConfigNotFoundException, AgentPackageNotFoundException { public static void initialize(String agentOptions) throws ConfigNotFoundException, AgentPackageNotFoundException {
InputStreamReader configFileStream; InputStreamReader configFileStream;
...@@ -80,7 +80,7 @@ public class SnifferConfigInitializer { ...@@ -80,7 +80,7 @@ public class SnifferConfigInitializer {
try { try {
overrideConfigBySystemProp(); overrideConfigBySystemProp();
} catch (Exception e) { } catch (Exception e) {
logger.error(e, "Failed to read the system env."); logger.error(e, "Failed to read the system properties.");
} }
if (!StringUtil.isEmpty(agentOptions)) { if (!StringUtil.isEmpty(agentOptions)) {
...@@ -95,10 +95,10 @@ public class SnifferConfigInitializer { ...@@ -95,10 +95,10 @@ public class SnifferConfigInitializer {
} }
if (StringUtil.isEmpty(Config.Agent.SERVICE_NAME)) { if (StringUtil.isEmpty(Config.Agent.SERVICE_NAME)) {
throw new ExceptionInInitializerError("`agent.service_code` is missing."); throw new ExceptionInInitializerError("`agent.service_name` is missing.");
} }
if (StringUtil.isEmpty(Config.Collector.BACKEND_SERVICE)) { if (StringUtil.isEmpty(Config.Collector.BACKEND_SERVICE)) {
throw new ExceptionInInitializerError("`collector.direct_servers` and `collector.servers` cannot be empty at the same time."); throw new ExceptionInInitializerError("`collector.backend_service` is missing.");
} }
IS_INIT_COMPLETED = true; IS_INIT_COMPLETED = true;
...@@ -149,12 +149,11 @@ public class SnifferConfigInitializer { ...@@ -149,12 +149,11 @@ public class SnifferConfigInitializer {
} }
/** /**
* Override the config by system properties. The env key must start with `skywalking`, the reuslt should be as same * Override the config by system properties. The property key must start with `skywalking`, the result should be as same
* as in `agent.config` * as in `agent.config`
* <p> * <p>
* such as: Env key of `agent.application_code` shoule be `skywalking.agent.application_code` * such as: Property key of `agent.service_name` should be `skywalking.agent.service_name`
* *
* @return the config file {@link InputStream}, or null if not needEnhance.
*/ */
private static void overrideConfigBySystemProp() throws IllegalAccessException { private static void overrideConfigBySystemProp() throws IllegalAccessException {
Properties properties = new Properties(); Properties properties = new Properties();
...@@ -162,8 +161,9 @@ public class SnifferConfigInitializer { ...@@ -162,8 +161,9 @@ public class SnifferConfigInitializer {
Iterator<Map.Entry<Object, Object>> entryIterator = systemProperties.entrySet().iterator(); Iterator<Map.Entry<Object, Object>> entryIterator = systemProperties.entrySet().iterator();
while (entryIterator.hasNext()) { while (entryIterator.hasNext()) {
Map.Entry<Object, Object> prop = entryIterator.next(); Map.Entry<Object, Object> prop = entryIterator.next();
if (prop.getKey().toString().startsWith(ENV_KEY_PREFIX)) { String key = prop.getKey().toString();
String realKey = prop.getKey().toString().substring(ENV_KEY_PREFIX.length()); if (key.startsWith(ENV_KEY_PREFIX)) {
String realKey = key.substring(ENV_KEY_PREFIX.length());
properties.put(realKey, prop.getValue()); properties.put(realKey, prop.getValue());
} }
} }
...@@ -189,11 +189,11 @@ public class SnifferConfigInitializer { ...@@ -189,11 +189,11 @@ public class SnifferConfigInitializer {
return new InputStreamReader(new FileInputStream(configFile), "UTF-8"); return new InputStreamReader(new FileInputStream(configFile), "UTF-8");
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
throw new ConfigNotFoundException("Fail to load agent.config", e); throw new ConfigNotFoundException("Failed to load agent.config", e);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
throw new ConfigReadFailedException("Fail to load agent.config", e); throw new ConfigReadFailedException("Failed to load agent.config", e);
} }
} }
throw new ConfigNotFoundException("Fail to load agent config file."); throw new ConfigNotFoundException("Failed to load agent.config.");
} }
} }
...@@ -40,7 +40,7 @@ import java.util.List; ...@@ -40,7 +40,7 @@ import java.util.List;
import static net.bytebuddy.matcher.ElementMatchers.*; import static net.bytebuddy.matcher.ElementMatchers.*;
/** /**
* The main entrance of sky-waking agent, based on javaagent mechanism. * The main entrance of sky-walking agent, based on javaagent mechanism.
* *
* @author wusheng * @author wusheng
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册