fix: remove core LogIndexService to fix CI snapshot resolution
LogIndexService in server-core imported LogEntry from cameleer3-common, but the SNAPSHOT on the registry may not have it yet when the server CI runs. Moved the dependency to server-app where both the controller and OpenSearch implementation live. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
package com.cameleer3.server.app.controller;
|
package com.cameleer3.server.app.controller;
|
||||||
|
|
||||||
import com.cameleer3.common.model.LogBatch;
|
import com.cameleer3.common.model.LogBatch;
|
||||||
|
import com.cameleer3.server.app.search.OpenSearchLogIndex;
|
||||||
import com.cameleer3.server.core.agent.AgentInfo;
|
import com.cameleer3.server.core.agent.AgentInfo;
|
||||||
import com.cameleer3.server.core.agent.AgentRegistryService;
|
import com.cameleer3.server.core.agent.AgentRegistryService;
|
||||||
import com.cameleer3.server.core.logging.LogIndexService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -24,12 +24,12 @@ public class LogIngestionController {
|
|||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(LogIngestionController.class);
|
private static final Logger log = LoggerFactory.getLogger(LogIngestionController.class);
|
||||||
|
|
||||||
private final LogIndexService logIndexService;
|
private final OpenSearchLogIndex logIndex;
|
||||||
private final AgentRegistryService registryService;
|
private final AgentRegistryService registryService;
|
||||||
|
|
||||||
public LogIngestionController(LogIndexService logIndexService,
|
public LogIngestionController(OpenSearchLogIndex logIndex,
|
||||||
AgentRegistryService registryService) {
|
AgentRegistryService registryService) {
|
||||||
this.logIndexService = logIndexService;
|
this.logIndex = logIndex;
|
||||||
this.registryService = registryService;
|
this.registryService = registryService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ public class LogIngestionController {
|
|||||||
|
|
||||||
if (batch.getEntries() != null && !batch.getEntries().isEmpty()) {
|
if (batch.getEntries() != null && !batch.getEntries().isEmpty()) {
|
||||||
log.debug("Received {} log entries from agent={}, app={}", batch.getEntries().size(), agentId, application);
|
log.debug("Received {} log entries from agent={}, app={}", batch.getEntries().size(), agentId, application);
|
||||||
logIndexService.indexBatch(agentId, application, batch.getEntries());
|
logIndex.indexBatch(agentId, application, batch.getEntries());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.accepted().build();
|
return ResponseEntity.accepted().build();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.cameleer3.server.app.search;
|
package com.cameleer3.server.app.search;
|
||||||
|
|
||||||
import com.cameleer3.common.model.LogEntry;
|
import com.cameleer3.common.model.LogEntry;
|
||||||
import com.cameleer3.server.core.logging.LogIndexService;
|
|
||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import org.opensearch.client.opensearch.OpenSearchClient;
|
import org.opensearch.client.opensearch.OpenSearchClient;
|
||||||
import org.opensearch.client.opensearch._types.mapping.Property;
|
import org.opensearch.client.opensearch._types.mapping.Property;
|
||||||
@@ -23,7 +22,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class OpenSearchLogIndex implements LogIndexService {
|
public class OpenSearchLogIndex {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(OpenSearchLogIndex.class);
|
private static final Logger log = LoggerFactory.getLogger(OpenSearchLogIndex.class);
|
||||||
private static final DateTimeFormatter DAY_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
private static final DateTimeFormatter DAY_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
||||||
@@ -92,7 +91,6 @@ public class OpenSearchLogIndex implements LogIndexService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void indexBatch(String agentId, String application, List<LogEntry> entries) {
|
public void indexBatch(String agentId, String application, List<LogEntry> entries) {
|
||||||
if (entries == null || entries.isEmpty()) {
|
if (entries == null || entries.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
package com.cameleer3.server.core.logging;
|
|
||||||
|
|
||||||
import com.cameleer3.common.model.LogEntry;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface LogIndexService {
|
|
||||||
|
|
||||||
void indexBatch(String agentId, String application, List<LogEntry> entries);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user