Skip to content

Commit

Permalink
feat: enable debug config
Browse files Browse the repository at this point in the history
  • Loading branch information
YongwuHe authored and mr3 committed Jan 2, 2024
1 parent 674dd74 commit f3eafbe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,31 +330,29 @@ private static Map<String, String> parseConfigFile(String configPath) {

public void parseAgentConfig(String args) {
Map<String, String> agentMap = StringUtil.asMap(args);
if (!agentMap.isEmpty()) {
for (Map.Entry<String, String> entry : agentMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (StringUtil.isEmpty(key) || StringUtil.isEmpty(value)) {
continue;
}

switch (key) {
case ENABLE_DEBUG:
setEnableDebug(value);
break;
case STORAGE_SERVICE_MODE:
setStorageServiceMode(value);
break;
case STORAGE_SERVICE_HOST:
case DISABLE_MODULE:
continue;
default:
System.setProperty(key, value);
break;
}
if (agentMap.isEmpty()) {
return;

Check warning on line 334 in arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java

View check run for this annotation

Codecov / codecov/patch

arex-instrumentation-foundation/src/main/java/io/arex/foundation/config/ConfigManager.java#L334

Added line #L334 was not covered by tests
}
for (Map.Entry<String, String> entry : agentMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();

switch (key) {
case ENABLE_DEBUG:
setEnableDebug(value);
break;
case STORAGE_SERVICE_MODE:
setStorageServiceMode(value);
break;
case STORAGE_SERVICE_HOST:
case DISABLE_MODULE:
break;
default:
System.setProperty(key, value);
break;
}
updateRuntimeConfig();
}
updateRuntimeConfig();
}

public void updateConfigFromService(ResponseBody serviceConfig) {
Expand Down Expand Up @@ -385,6 +383,7 @@ private void updateRuntimeConfig() {
Map<String, String> extendFieldMap = getExtendField();
if (MapUtils.isNotEmpty(extendFieldMap)) {
configMap.putAll(extendFieldMap);
setEnableDebug(extendFieldMap.get(ENABLE_DEBUG));
}

ConfigBuilder.create(getServiceName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void replaceConfigFromService() {

@Test
void parseAgentConfig() {
configManager.parseAgentConfig("arex.storage.mode=xxx;arex.enable.debug=true");
configManager.parseAgentConfig("arex.storage.mode=xxx;arex.enable.debug=true;arex.disable.instrumentation.module=dynamic;arex.buffer.size=1024;arex.serializer.config=");
assertTrue(configManager.isEnableDebug());
}

Expand Down

0 comments on commit f3eafbe

Please sign in to comment.