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 @@ -8,6 +8,7 @@
import org.springframework.context.annotation.Profile;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.core.task.TaskRejectedException;
import org.springframework.stereotype.Service;

import com.github.f4b6a3.tsid.Tsid;
Expand Down Expand Up @@ -120,11 +121,17 @@ private void sendAdminTarget(Long memberId, UserLogRequest request) {
return;
}

adminLogFeatureDispatchService.dispatch(
memberId,
eventName,
request.timestamp()
);
try {
adminLogFeatureDispatchService.dispatch(
memberId,
eventName,
request.timestamp()
);
customerMetrics.recordAdminLogFeatureDispatch("enqueued");
} catch (TaskRejectedException e) {
log.warn("[UserLog] Admin log-feature dispatch rejected. memberId={}, eventName={}", memberId, eventName);
customerMetrics.recordAdminLogFeatureDispatch("rejected");
}
Comment thread
tkv00 marked this conversation as resolved.
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ThreadPoolTaskExecutor adminLogFeatureTaskExecutor() {
executor.setMaxPoolSize(16);
executor.setQueueCapacity(512);
executor.setThreadNamePrefix("admin-log-feature-");
executor.setRejectedExecutionHandler(new java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy());
executor.setRejectedExecutionHandler(new java.util.concurrent.ThreadPoolExecutor.AbortPolicy());
executor.initialize();
return executor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,12 @@ public void stopAdminLogFeatureDuration(Timer.Sample sample, String result) {
.tag("result", result)
.register(meterRegistry));
}

public void recordAdminLogFeatureDispatch(String result) {
Counter.builder("holliverse.userlog.admin_log_feature.dispatch")
.description("Admin log-feature async dispatch enqueue results")
.tag("result", result)
.register(meterRegistry)
.increment();
}
}
Loading