1
0

feat: 动态粒度趋势图,支持 auto bucket 选择 + P95 延迟 + 状态条

This commit is contained in:
2026-05-23 23:53:18 +08:00
parent 6601ab458d
commit 4f33fba793
16 changed files with 315 additions and 106 deletions

View File

@@ -551,7 +551,7 @@ if (r.body) {
**轻数据库指标计算规范**
- 数据库只负责存储、筛选、排序、分页、LIMIT 和标准 SQL 基础聚合(如 `COUNT``SUM(CASE)``AVG``MIN``MAX``GROUP BY`),用于减少应用层输入数据量
- 指标语义必须在后端应用层实现包括可用率舍入、百分位、状态翻转、故障段识别、MTTR、最长故障、连续状态、趋势 UTC 小时分桶和窗口边界处理
- 指标语义必须在后端应用层实现包括可用率舍入、百分位、状态翻转、故障段识别、MTTR、最长故障、连续状态、趋势按标准 bucket 聚合(`resolveAutoBucket` 自动选择粒度,`buildTrend` 按 UTC 整点/整分钟对齐)和窗口边界处理
- 禁止用 SQLite 专有时间函数承载趋势分桶语义,禁止用复杂 SQL/window function 承载故障事件或恢复时长等业务规则
**Schema**
@@ -791,7 +791,7 @@ hooks/use-theme-preference.ts浏览器 UI 偏好)
const queryKeys = {
dashboard: () => ["dashboard", "24h", 30] as const,
meta: () => ["meta"] as const,
metrics: (targetId: number, from: string, to: string, bucket: "1h") =>
metrics: (targetId: number, from: string, to: string, bucket: "auto" | MetricsBucket) =>
["metrics", targetId, from, to, bucket] as const,
history: (targetId: number, from: string, to: string, page: number) => ["history", targetId, from, to, page] as const,
};