18960 探活改打 /healthz:恒 404 的那一格只能读成"未验证",服务真死了也不响
`service_down` 探活在 java 进程内跑,根路径没有路由 ⇒ 现网每轮一条
`WARN 服务探测未验证业务可用性 detail=HTTP 404`,跟价 API 挂了通知面上是 0 行
(10-07 那次 41 分钟整站宕机在通知表上就是 0 行的同族形状)。
不能选 `/batch/status`:它 `beat("vc")` 会让服务用自己的健康检查刷新采集机心跳,
正是 10-04 变体采集停摆 12 小时没被发现的那条路。`/healthz` 是 18960 专为探针加的,
不写心跳、不碰 Redis/MySQL——两台实测 `/`→404、`/healthz`→200 {"ok":true}。
两条新用例分别钉"拼出来的地址"与"`probeServices()` 真请求的路径":只钉前者的话
调用点改回去照样绿(第一版就是这么漏的,变异注入才暴露)。全类 10→12 例。
This commit is contained in:
+14
-1
@@ -54,6 +54,14 @@ public class NotificationScanScheduler {
|
||||
private static final int REASON_MAX_LENGTH = 120;
|
||||
private static final int PROBE_READ_TIMEOUT_MILLIS = 8_000;
|
||||
|
||||
/**
|
||||
* 18960 的探针路径。根路径没有路由,恒 404 ⇒ 这一格只能读成「未验证」,
|
||||
* 现网每轮只打一条 WARN,服务真死了也不响。/healthz 是 18960 专为探针加的一条:
|
||||
* 不写心跳、不碰 Redis/MySQL——换成 /batch/status 会让服务用自己的健康检查
|
||||
* 刷新采集机心跳,正是 2026-10-04 变体采集停摆 12 小时没被发现的形状。
|
||||
*/
|
||||
static final String PRICE_TRACK_PROBE_PATH = "/healthz";
|
||||
|
||||
private static final DateTimeFormatter DAY_FORMAT = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
|
||||
/**
|
||||
@@ -190,7 +198,7 @@ public class NotificationScanScheduler {
|
||||
}
|
||||
if (hasText(properties.getPriceTrackApiUrl())) {
|
||||
reportProbe("price-track-api", "跟价任务 API",
|
||||
probeHttpWithRetry(joinUrl(properties.getPriceTrackApiUrl(), "/")));
|
||||
probeHttpWithRetry(priceTrackProbeUrl()));
|
||||
} else {
|
||||
log.info("[notification-scan] 跟价任务 API 探测地址未配置,跳过");
|
||||
}
|
||||
@@ -335,6 +343,11 @@ public class NotificationScanScheduler {
|
||||
return base + path;
|
||||
}
|
||||
|
||||
/** 组装跟价 API 的探针地址;包内可见,判据要在不联网的情况下钉住路径。 */
|
||||
String priceTrackProbeUrl() {
|
||||
return joinUrl(properties.getPriceTrackApiUrl(), PRICE_TRACK_PROBE_PATH);
|
||||
}
|
||||
|
||||
private String rootCauseMessage(Throwable throwable) {
|
||||
Throwable current = throwable;
|
||||
while (current.getCause() != null && current.getCause() != current) {
|
||||
|
||||
Reference in New Issue
Block a user