Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class EventLabelKeys {
public static final String TASK_TYPE = "taskType";
public static final String TASK_STATUS = "taskStatus";
public static final String TRIGGER_TIME = "triggerTime";
public static final String DESCRIPTION = "description";

/**
* connection info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static com.oceanbase.odc.service.notification.constant.EventLabelKeys.CREATOR_NAME;
import static com.oceanbase.odc.service.notification.constant.EventLabelKeys.DATABASE_ID;
import static com.oceanbase.odc.service.notification.constant.EventLabelKeys.DATABASE_NAME;
import static com.oceanbase.odc.service.notification.constant.EventLabelKeys.DESCRIPTION;
import static com.oceanbase.odc.service.notification.constant.EventLabelKeys.ENVIRONMENT;
import static com.oceanbase.odc.service.notification.constant.EventLabelKeys.PROJECT_ID;
import static com.oceanbase.odc.service.notification.constant.EventLabelKeys.PROJECT_NAME;
Expand Down Expand Up @@ -188,6 +189,7 @@ private Event ofTask(TaskEntity task, TaskEvent status) {
labels.putIfNonNull(CREATOR_ID, task.getCreatorId());
labels.putIfNonNull(TRIGGER_TIME, LocalDateTime.now().format(DATE_FORMATTER));
labels.putIfNonNull(REGION, OB_ARN_PARTITION);
labels.putIfNonNull(DESCRIPTION, task.getDescription());
Comment thread
LuckyPickleZZ marked this conversation as resolved.

Long projectId;
if (Objects.nonNull(task.getDatabaseId())) {
Expand Down Expand Up @@ -233,6 +235,7 @@ private Event ofSchedule(ScheduleEntity schedule, TaskEvent status) {
labels.putIfNonNull(TASK_STATUS, status.name());
labels.putIfNonNull(TRIGGER_TIME, LocalDateTime.now().format(DATE_FORMATTER));
labels.putIfNonNull(REGION, OB_ARN_PARTITION);
labels.putIfNonNull(DESCRIPTION, schedule.getDescription());

switch (schedule.getJobType()) {
case DATA_ARCHIVE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,18 @@ public void jobWasExecuted(JobExecutionContext context, JobExecutionException jo
ScheduleTaskContextHolder.clear();
Optional<ScheduleEntity> scheduleEntityOptional =
scheduleRepository.findById(ScheduleTaskUtils.getScheduleId(context));
if (scheduleEntityOptional.isPresent()) {
ScheduleEntity scheduleEntity = scheduleEntityOptional.get();
if (jobException != null && notificationProperties.isEnabled()) {
try {
if (notificationProperties.isEnabled() && scheduleEntityOptional.isPresent()) {
try {
ScheduleEntity scheduleEntity = scheduleEntityOptional.get();
if (jobException != null) {
broker.enqueueEvent(eventBuilder.ofFailedTask(scheduleEntity));
} catch (Exception e) {
log.warn("Failed to enqueue event.", e);
} else if (!taskFrameworkEnabledProperties.isEnabled()
Comment thread
LuckyPickleZZ marked this conversation as resolved.
&& scheduleEntity.getJobType().executeInTaskFramework()) {
// only create event for DLM jobs when task framework not enabled to avoid duplicate events
broker.enqueueEvent(eventBuilder.ofSucceededTask(scheduleEntity));
}
} catch (Exception e) {
log.warn("Failed to enqueue event.", e);
}
}
}
Expand Down