Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INLONG-11333][Agent] Retrieve IP from configuration file during audit reporting #11334

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading