use of com.netflix.conductor.common.metadata.tasks.TaskExecLog in project conductor by Netflix.
the class TestElasticSearchRestDAOV6 method createLog.
private TaskExecLog createLog(String taskId, String log) {
TaskExecLog taskExecLog = new TaskExecLog(log);
taskExecLog.setTaskId(taskId);
return taskExecLog;
}
use of com.netflix.conductor.common.metadata.tasks.TaskExecLog in project conductor by Netflix.
the class TestElasticSearchDAOV6 method createLog.
private TaskExecLog createLog(String taskId, String log) {
TaskExecLog taskExecLog = new TaskExecLog(log);
taskExecLog.setTaskId(taskId);
return taskExecLog;
}
use of com.netflix.conductor.common.metadata.tasks.TaskExecLog in project conductor by Netflix.
the class ExecutionService method log.
/**
* Adds task logs
* @param taskId Id of the task
* @param log logs
*/
public void log(String taskId, String log) {
TaskExecLog executionLog = new TaskExecLog();
executionLog.setTaskId(taskId);
executionLog.setLog(log);
executionLog.setCreatedTime(System.currentTimeMillis());
executionDAOFacade.addTaskExecLog(Collections.singletonList(executionLog));
}
use of com.netflix.conductor.common.metadata.tasks.TaskExecLog in project conductor by Netflix.
the class ElasticSearchDAOV5 method addTaskExecutionLogs.
@Override
public void addTaskExecutionLogs(List<TaskExecLog> taskExecLogs) {
if (taskExecLogs.isEmpty()) {
return;
}
try {
long startTime = Instant.now().toEpochMilli();
BulkRequestBuilderWrapper bulkRequestBuilder = new BulkRequestBuilderWrapper(elasticSearchClient.prepareBulk());
for (TaskExecLog log : taskExecLogs) {
IndexRequest request = new IndexRequest(logIndexName, LOG_DOC_TYPE);
request.source(objectMapper.writeValueAsBytes(log), XContentType.JSON);
bulkRequestBuilder.add(request);
}
new RetryUtil<BulkResponse>().retryOnException(() -> bulkRequestBuilder.execute().actionGet(5, TimeUnit.SECONDS), null, BulkResponse::hasFailures, RETRY_COUNT, "Indexing task execution logs", "addTaskExecutionLogs");
long endTime = Instant.now().toEpochMilli();
logger.debug("Time taken {} for indexing taskExecutionLogs", endTime - startTime);
Monitors.recordESIndexTime("index_task_execution_logs", LOG_DOC_TYPE, endTime - startTime);
Monitors.recordWorkerQueueSize("logQueue", ((ThreadPoolExecutor) logExecutorService).getQueue().size());
} catch (Exception e) {
List<String> taskIds = taskExecLogs.stream().map(TaskExecLog::getTaskId).collect(Collectors.toList());
logger.error("Failed to index task execution logs for tasks: {}", taskIds, e);
}
}
use of com.netflix.conductor.common.metadata.tasks.TaskExecLog in project conductor by Netflix.
the class ElasticSearchRestDAOV5 method addTaskExecutionLogs.
@Override
public void addTaskExecutionLogs(List<TaskExecLog> taskExecLogs) {
if (taskExecLogs.isEmpty()) {
return;
}
long startTime = Instant.now().toEpochMilli();
BulkRequest bulkRequest = new BulkRequest();
for (TaskExecLog log : taskExecLogs) {
byte[] docBytes;
try {
docBytes = objectMapper.writeValueAsBytes(log);
} catch (JsonProcessingException e) {
logger.error("Failed to convert task log to JSON for task {}", log.getTaskId());
continue;
}
IndexRequest request = new IndexRequest(logIndexName, LOG_DOC_TYPE);
request.source(docBytes, XContentType.JSON);
bulkRequest.add(request);
}
try {
new RetryUtil<BulkResponse>().retryOnException(() -> {
try {
return elasticSearchClient.bulk(bulkRequest);
} catch (IOException e) {
throw new RuntimeException(e);
}
}, null, BulkResponse::hasFailures, RETRY_COUNT, "Indexing task execution logs", "addTaskExecutionLogs");
long endTime = Instant.now().toEpochMilli();
logger.debug("Time taken {} for indexing taskExecutionLogs", endTime - startTime);
Monitors.recordESIndexTime("index_task_execution_logs", LOG_DOC_TYPE, endTime - startTime);
Monitors.recordWorkerQueueSize("logQueue", ((ThreadPoolExecutor) logExecutorService).getQueue().size());
} catch (Exception e) {
List<String> taskIds = taskExecLogs.stream().map(TaskExecLog::getTaskId).collect(Collectors.toList());
logger.error("Failed to index task execution logs for tasks: {}", taskIds, e);
}
}
Aggregations