in src/main/java/software/amazon/cloudwatchlogs/emf/sinks/AgentSink.java [69:90]
public void accept(MetricsContext context) {
if (executor.isShutdown()) {
throw new EMFClientException(
"Attempted to write data to a sink that has been previously shutdown.");
}
if (!StringUtils.isNullOrEmpty(logGroupName)) {
context.putMetadata("LogGroupName", logGroupName);
}
if (!StringUtils.isNullOrEmpty(logStreamName)) {
context.putMetadata("LogStreamName", logStreamName);
}
try {
for (String event : context.serialize()) {
executor.submit(new Sender(event, client, retryStrategyFactory));
}
} catch (JsonProcessingException e) {
log.error("Failed to serialize the metrics with the exception: ", e);
}
}