-
Notifications
You must be signed in to change notification settings - Fork 3
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
DATAGO-79772: Cloud managed EMA must not stream configPush logs to EP Core #191
DATAGO-79772: Cloud managed EMA must not stream configPush logs to EP Core #191
Conversation
public void deleteExecutionLogFiles(List<Path> listOfExecutionLogFiles) { | ||
boolean allFilesDeleted = listOfExecutionLogFiles | ||
.stream() | ||
.allMatch(this::deleteExecutionLogFile); | ||
if (!allFilesDeleted) { | ||
throw new IllegalArgumentException("Some of the execution log files were not deleted. Please check the logs"); | ||
} | ||
} | ||
|
||
private boolean deleteExecutionLogFile(Path path) { | ||
try { | ||
if (Files.exists(path)) { | ||
Files.delete(path); | ||
} | ||
} catch (IOException e) { | ||
log.warn("Error while deleting execution log at {}", path, e); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted these methods as is to CommandManager
as these methods are better suited there
@Bean | ||
@Qualifier("realCommandLogStreamingProcessor") | ||
public CommandLogStreamingProcessor realCommandLogStreamingProcessor(CommandLogsPublisher commandLogsPublisher, | ||
EventPortalProperties eventPortalProperties, | ||
ObjectMapper objectMapper) { | ||
return new CommandLogStreamingProcessor(commandLogsPublisher, eventPortalProperties, objectMapper); | ||
} | ||
|
||
@Bean | ||
@Qualifier("mockedCommandLogStreamingProcessor") | ||
@Primary | ||
public CommandLogStreamingProcessor mockedCommandLogStreamingProcessor() { | ||
return mock(CommandLogStreamingProcessor.class); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed
@@ -45,14 +48,14 @@ public class CommandManager { | |||
private final MessagingServiceDelegateService messagingServiceDelegateService; | |||
private final EventPortalProperties eventPortalProperties; | |||
private final ThreadPoolTaskExecutor configPushPool; | |||
private final CommandLogStreamingProcessor commandLogStreamingProcessor; | |||
private final Optional<CommandLogStreamingProcessor> commandLogStreamingProcessorOpt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commandLogStreamingProcessor is absent for cloud managed mode. So making it optional
if (commandLogStreamingProcessorOpt.isPresent()) { | ||
streamCommandExecutionLogToEpCore(request, command, executionLog); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only stream if the commandLogStreamingProcessorOpt is present (e.g. in self managed mode)
@DirtiesContext(classMode = BEFORE_EACH_TEST_METHOD) | ||
//CPD-OFF | ||
class CloudManagedEMACommandManagerTests { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be a separate class as we want to load a new application context in cloud managed mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but application.properties file must be rolled back before I can approve.
id: gateway | ||
name: evmr1 | ||
id: f0ydyzsr1jp | ||
name: POCCloudManagedEMAEVMR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please undo these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. See slack message on how I mitigated the impact
@@ -37,6 +38,9 @@ public class TerraformManager { | |||
private final TerraformProperties terraformProperties; | |||
private final TerraformClientFactory terraformClientFactory; | |||
|
|||
|
|||
private boolean isManagedAgent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this boolean used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed. Good Catch
@@ -7,6 +7,7 @@ | |||
import com.solace.maas.ep.event.management.agent.plugin.command.model.CommandResult; | |||
import com.solace.maas.ep.event.management.agent.plugin.command.model.JobStatus; | |||
import com.solace.maas.ep.event.management.agent.plugin.constants.RouteConstants; | |||
import com.solace.maas.ep.event.management.agent.plugin.messagingService.event.EventProperty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this library doesn't have PMD checks. Otherwise, it should have failed the build for un-used imports.
Please just roll-back this file considering there is no relevant change here.
What is the purpose of this change?
Currently, Self managed EMA streams Terraform execution logs to ep-core. These logs end up in Datadog and aids in debuggability. Cloud managed EMA already has DD integration. So we intend to disable the log streaming feature if the ema is running in cloud managed mode
How was this change implemented?
Java code change
How was this change tested?
IT
Is there anything the reviewers should focus on/be aware of?