mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-02 08:31:35 +00:00
fix(channel-monitor-v2): default mode v1 and gentle adaptive backfill
Default channel_monitor_mode to v1 (opt-in V2) so upgrades keep active probes; existing explicit v2 rows are left alone via ON CONFLICT DO NOTHING plus migration checksum compatibility for already-applied 195. V2 first-enable backfill no longer compresses ticks to 5s or uses 24h chunks. Each tick does recent overlap plus at most one historical chunk with depth-based ceilings (2h/4h/6h), adaptive grow/shrink, and failure backoff. Error request_id dedup is bounded by a 90-minute lookback so ops_error_logs is not scanned for full history. Also align hide_throughput parse default with privacy-preserving public runtime (missing key → true).
This commit is contained in:
1 parent
a4faa015a7
commit
825f9c78d5
16 files changed
+262
-62
No files matched your search
@@ -21,11 +21,11 @@ export default {
|
||||
enabled: 'Enable Channel Monitor',
|
||||
enabledHint: 'Disabling stops both the V1 scheduler and V2 aggregation; existing config and history are kept.',
|
||||
mode: 'Monitor mode',
|
||||
modeHint: 'Only one implementation can be active: V2 never sends upstream probes; V1 probes configured monitors on a schedule.',
|
||||
modeHint: 'Default is V1 (active probes). Switch to V2 only when you want passive aggregation; only one implementation can be active at a time.',
|
||||
modeV2: 'V2 passive monitoring',
|
||||
modeV1: 'V1 active probes',
|
||||
modeV2Hint: 'Aggregates health metrics from real gateway traffic without upstream probe traffic.',
|
||||
modeV1Hint: 'Runs scheduled upstream health checks for configured channel monitors (probe traffic).',
|
||||
modeV2Hint: 'Opt-in: aggregates health metrics from real gateway traffic without upstream probe traffic. V1 probes stop while V2 is active.',
|
||||
modeV1Hint: 'Default: runs scheduled upstream health checks for configured channel monitors (probe traffic).',
|
||||
defaultInterval: 'Default check interval (seconds)',
|
||||
defaultIntervalHint: 'V1 only: default interval for new monitors (overridable per monitor). Range 15 – 3600 seconds.',
|
||||
hideThroughput: 'Hide throughput rates from users (RPM / TPM)',
|
||||
|
||||
@@ -21,11 +21,11 @@ export default {
|
||||
enabled: '启用渠道监控',
|
||||
enabledHint: '关闭后 V1 调度器与 V2 聚合均停止;已有配置与历史保留。',
|
||||
mode: '监控模式',
|
||||
modeHint: '同一时间只能启用一种实现:V2 不产生上游探测流量;V1 会按配置的监控项主动探活。',
|
||||
modeHint: '默认 V1(主动探测)。仅在需要被动聚合时切换到 V2;同一时间只能启用一种实现。',
|
||||
modeV2: 'V2 被动监控',
|
||||
modeV1: 'V1 主动探测',
|
||||
modeV2Hint: '基于真实网关流量聚合健康指标,不向上游发送探活请求。',
|
||||
modeV1Hint: '按配置的渠道监控项定时发起上游健康检查(产生探测流量)。',
|
||||
modeV2Hint: '需主动选择:基于真实网关流量聚合健康指标,不向上游发送探活请求;启用期间 V1 探测停止。',
|
||||
modeV1Hint: '默认模式:按配置的渠道监控项定时发起上游健康检查(产生探测流量)。',
|
||||
defaultInterval: '默认检测间隔(秒)',
|
||||
defaultIntervalHint: '仅 V1 模式使用:新建渠道监控时表单的默认值,可被单个渠道覆盖。范围 15 – 3600 秒。',
|
||||
hideThroughput: '对用户隐藏吞吐速率(RPM / TPM)',
|
||||
|
||||
@@ -160,11 +160,11 @@ export function isChannelMonitorRouteEnabled(): boolean {
|
||||
|
||||
export type ChannelMonitorMode = 'v1' | 'v2'
|
||||
|
||||
/** Exclusive channel-monitor implementation. Invalid/missing → v2. */
|
||||
/** Exclusive channel-monitor implementation. Invalid/missing → v1 (opt-in to v2). */
|
||||
export function getChannelMonitorMode(): ChannelMonitorMode {
|
||||
const appStore = useAppStore()
|
||||
const mode = appStore.cachedPublicSettings?.channel_monitor_mode
|
||||
return mode === 'v1' ? 'v1' : 'v2'
|
||||
return mode === 'v2' ? 'v2' : 'v1'
|
||||
}
|
||||
|
||||
export function isChannelMonitorV1Mode(): boolean {
|
||||
|
||||
@@ -9516,7 +9516,7 @@ const form = reactive<SettingsForm>({
|
||||
account_quota_notify_emails: [] as NotifyEmailEntry[],
|
||||
// Channel Monitor feature switch
|
||||
channel_monitor_enabled: true,
|
||||
channel_monitor_mode: 'v2' as 'v1' | 'v2',
|
||||
channel_monitor_mode: 'v1' as 'v1' | 'v2',
|
||||
channel_monitor_default_interval_seconds: 60,
|
||||
channel_monitor_hide_throughput: false,
|
||||
// Available Channels feature switch
|
||||
@@ -10516,7 +10516,7 @@ async function loadSettings() {
|
||||
form.login_agreement_mode =
|
||||
settings.login_agreement_mode === "checkbox" ? "checkbox" : "modal";
|
||||
form.channel_monitor_mode =
|
||||
settings.channel_monitor_mode === "v1" ? "v1" : "v2";
|
||||
settings.channel_monitor_mode === "v2" ? "v2" : "v1";
|
||||
form.channel_monitor_hide_throughput = Boolean(
|
||||
settings.channel_monitor_hide_throughput
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user