From 11212c40528df25f385c0c361abebcb4a6c305c0 Mon Sep 17 00:00:00 2001 From: IluckySi Date: Tue, 16 Apr 2019 00:08:45 +0800 Subject: [PATCH] Modify some spell error and prompt error (#2488) --- .../apm/agent/core/conf/Config.java | 2 +- .../core/conf/SnifferConfigInitializer.java | 30 +++++++++---------- .../skywalking/apm/agent/SkyWalkingAgent.java | 2 +- 3 files changed, 17 insertions(+), 17 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 2553cca84a..14ef3a0a47 100644 --- 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 @@ -40,7 +40,7 @@ public class Config { 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 */ public static String SERVICE_NAME = ""; diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java index f17336b811..1d7c30df58 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/SnifferConfigInitializer.java @@ -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 * /config dictionary of agent package. *

- * Also try to override the config by system.env and system.properties. All the keys in these two places should - * start with {@link #ENV_KEY_PREFIX}. e.g. in env `skywalking.agent.application_code=yourAppName` to override - * `agent.application_code` in config file. + * 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.service_name=yourAppName` to override + * `agent.service_name` in config file. *

- * 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 { InputStreamReader configFileStream; @@ -80,7 +80,7 @@ public class SnifferConfigInitializer { try { overrideConfigBySystemProp(); } 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)) { @@ -95,10 +95,10 @@ public class SnifferConfigInitializer { } 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)) { - 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; @@ -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` *

- * 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 { Properties properties = new Properties(); @@ -162,8 +161,9 @@ public class SnifferConfigInitializer { Iterator> entryIterator = systemProperties.entrySet().iterator(); while (entryIterator.hasNext()) { Map.Entry prop = entryIterator.next(); - if (prop.getKey().toString().startsWith(ENV_KEY_PREFIX)) { - String realKey = prop.getKey().toString().substring(ENV_KEY_PREFIX.length()); + String key = prop.getKey().toString(); + if (key.startsWith(ENV_KEY_PREFIX)) { + String realKey = key.substring(ENV_KEY_PREFIX.length()); properties.put(realKey, prop.getValue()); } } @@ -189,11 +189,11 @@ public class SnifferConfigInitializer { return new InputStreamReader(new FileInputStream(configFile), "UTF-8"); } catch (FileNotFoundException e) { - throw new ConfigNotFoundException("Fail to load agent.config", e); + throw new ConfigNotFoundException("Failed to load agent.config", 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."); } } diff --git a/apm-sniffer/apm-agent/src/main/java/org/apache/skywalking/apm/agent/SkyWalkingAgent.java b/apm-sniffer/apm-agent/src/main/java/org/apache/skywalking/apm/agent/SkyWalkingAgent.java index 395d1290a2..033b831bac 100644 --- a/apm-sniffer/apm-agent/src/main/java/org/apache/skywalking/apm/agent/SkyWalkingAgent.java +++ b/apm-sniffer/apm-agent/src/main/java/org/apache/skywalking/apm/agent/SkyWalkingAgent.java @@ -40,7 +40,7 @@ import java.util.List; 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 */ -- GitLab