use of core.log.domain.ActionDocument in project core-ng-project by neowu.
the class ActionService method action.
private ActionDocument action(ActionLogMessage message) {
ActionDocument actionLog = new ActionDocument();
actionLog.date = message.date;
actionLog.app = message.app;
actionLog.serverIP = message.serverIP;
actionLog.id = message.id;
actionLog.result = message.result;
actionLog.refId = message.refId;
actionLog.action = message.action;
actionLog.errorCode = message.errorCode;
actionLog.errorMessage = message.errorMessage;
actionLog.elapsed = message.elapsed;
actionLog.cpuTime = message.cpuTime;
actionLog.context = message.context;
actionLog.stats = message.stats;
actionLog.performanceStats = message.performanceStats;
return actionLog;
}
use of core.log.domain.ActionDocument in project core-ng-project by neowu.
the class ActionServiceTest method bulkIndex.
@Test
void bulkIndex() {
List<ActionLogMessage> messages = Lists.newArrayList();
for (int i = 0; i < 6; i++) {
ActionLogMessage message = message("bulk-" + i, "TRACE");
message.traceLog = "trace";
messages.add(message);
}
LocalDate now = LocalDate.of(2016, Month.JANUARY, 15);
actionService.index(messages, now);
ActionDocument action = actionDocument(now, messages.get(0).id);
assertThat(action.result).isEqualTo("TRACE");
}
use of core.log.domain.ActionDocument in project core-ng-project by neowu.
the class DiagramService method getActionById.
private ActionDocument getActionById(String id) {
var request = new SearchRequest();
request.index = "action-*";
request.query = new Query.Builder().ids(ids(List.of(id))).build();
List<ActionDocument> documents = actionType.search(request).hits;
if (documents.isEmpty())
throw new NotFoundException("action not found, id=" + id);
return documents.get(0);
}
use of core.log.domain.ActionDocument in project core-ng-project by neowu.
the class DiagramService method action.
public String action(String actionId) {
var diagram = new ActionDiagram();
ActionDocument action = getActionById(actionId);
boolean isRootAction = action.correlationIds == null;
if (isRootAction)
diagram.add(action);
List<String> correlationIds = isRootAction ? List.of(actionId) : action.correlationIds;
List<ActionDocument> actions = findActionByCorrelationIds(correlationIds);
actions.forEach(diagram::add);
if (!isRootAction) {
// if not root action, then correlationId will be id of root action
List<ActionDocument> rootActions = findActionByIds(correlationIds);
for (ActionDocument rootAction : rootActions) {
diagram.add(rootAction);
}
}
return diagram.dot();
}
use of core.log.domain.ActionDocument in project core-ng-project by neowu.
the class ActionDiagram method apps.
private Set<String> apps() {
Set<String> apps = new HashSet<>();
for (Map.Entry<Key, List<ActionDocument>> entry : actions.entrySet()) {
Key key = entry.getKey();
apps.add(key.app);
if ((key.action.startsWith("api:") || key.action.startsWith("topic:")) && !key.action.contains(":task:")) {
for (ActionDocument action : entry.getValue()) {
apps.addAll(clients(action));
}
}
}
return apps;
}
Aggregations