Skip to content

Commit

Permalink
[INLONG-11333][Agent] Retrieve IP from configuration file during audi…
Browse files Browse the repository at this point in the history
…t reporting (apache#11334)
  • Loading branch information
justinwwhuang authored Oct 11, 2024
1 parent 5abb311 commit 40f4b2c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.inlong.agent.metrics.audit;

import org.apache.inlong.agent.conf.AbstractConfiguration;
import org.apache.inlong.agent.constant.AgentConstants;
import org.apache.inlong.audit.AuditOperator;
import org.apache.inlong.audit.entity.AuditComponent;

Expand Down Expand Up @@ -59,7 +60,6 @@ public class AuditUtils {
public static int AUDIT_ID_AGENT_ADD_INSTANCE_MEM_FAILED = 1073741842;
public static int AUDIT_ID_AGENT_DEL_INSTANCE_MEM_UNUSUAL = 1073741843;
private static boolean IS_AUDIT = true;
private static AbstractConfiguration conf;

/**
* Init audit config
Expand All @@ -69,6 +69,7 @@ public static void initAudit(AbstractConfiguration conf) {
if (IS_AUDIT) {
AuditOperator.getInstance().setAuditProxy(AuditComponent.AGENT, conf.get(AGENT_MANAGER_ADDR),
conf.get(AGENT_MANAGER_AUTH_SECRET_ID), conf.get(AGENT_MANAGER_AUTH_SECRET_KEY));
AuditOperator.getInstance().setLocalIP(conf.get(AgentConstants.AGENT_LOCAL_IP));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public AgentBaseTestsHelper setupAgentHome() {
boolean result = testRootDir.toFile().mkdirs();
LOGGER.info("try to create {}, result is {}", testRootDir, result);
AgentConfiguration.getAgentConf().set(AgentConstants.AGENT_HOME, testRootDir.toString());
AgentConfiguration.getAgentConf().set(AgentConstants.AGENT_LOCAL_IP, "127.0.0.1");
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public AgentBaseTestsHelper setupAgentHome() {
LOGGER.info("try to create {}, result is {}", testRootDir, result);
AgentConfiguration.getAgentConf().set(AgentConstants.AGENT_HOME, testRootDir.toString());
AgentConfiguration.getAgentConf().set(FetcherConstants.AGENT_MANAGER_ADDR, "");
AgentConfiguration.getAgentConf().set(AgentConstants.AGENT_LOCAL_IP, "127.0.0.1");
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public BaseTestsHelper setupAgentHome() {
LOGGER.info("try to create {}, result is {}", testRootDir, result);
InstallerConfiguration.getInstallerConf().set(AgentConstants.AGENT_HOME, testRootDir.toString());
InstallerConfiguration.getInstallerConf().set(FetcherConstants.AGENT_MANAGER_ADDR, "");
InstallerConfiguration.getInstallerConf().set(AgentConstants.AGENT_LOCAL_IP, "127.0.0.1");
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public AgentBaseTestsHelper setupAgentHome() {
LOGGER.info("try to create {}, result is {}", testRootDir, result);
AgentConfiguration.getAgentConf().set(AgentConstants.AGENT_HOME, testRootDir.toString());
AgentConfiguration.getAgentConf().set(FetcherConstants.AGENT_MANAGER_ADDR, "");
AgentConfiguration.getAgentConf().set(AgentConstants.AGENT_LOCAL_IP, "127.0.0.1");
return this;
}

Expand Down

0 comments on commit 40f4b2c

Please sign in to comment.