Modify some spell error and prompt error (#2488)
This commit is contained in:
parent
73cdce576e
commit
11212c4052
|
|
@ -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 = "";
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
* <p>
|
||||
* 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.
|
||||
* <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 {
|
||||
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`
|
||||
* <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 {
|
||||
Properties properties = new Properties();
|
||||
|
|
@ -162,8 +161,9 @@ public class SnifferConfigInitializer {
|
|||
Iterator<Map.Entry<Object, Object>> entryIterator = systemProperties.entrySet().iterator();
|
||||
while (entryIterator.hasNext()) {
|
||||
Map.Entry<Object, Object> 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.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue