fix(query): anchor=latest follows the newest sample of any level, not just the 1m rows [CI]
This commit is contained in:
1 parent
d95acc6575
commit
e1ec7c9b04
3 files changed
+21
-2
No files matched your search
@@ -45,8 +45,19 @@ public sealed class RowLoader
|
||||
return at + 1000;
|
||||
}
|
||||
|
||||
IReadOnlyList<MetricRow> rows = await _metrics.ReadAsync(MetricLevel.M1, agent, series, nowMs - (7 * Steps.Day), nowMs + 60_000, ct);
|
||||
return rows.Count == 0 ? null : rows.Max(r => r.WindowStart) + 60_000;
|
||||
// 热层空了(Backend 刚重启、热层还没攒起来)就看持久层:各层里最晚的窗口取最大。只看 1 分钟层会落后——它比 5 分钟层更新得慢时,
|
||||
// 窗口就被定在好几个小时以前,页面显示的全是旧数据。
|
||||
long? latest = null;
|
||||
foreach (MetricLevel level in new[] { MetricLevel.S10, MetricLevel.M1, MetricLevel.M5 })
|
||||
{
|
||||
if (await _metrics.LatestAsync(level, agent, series, ct) is { } start)
|
||||
{
|
||||
long end = Math.Min(start + level.WidthMs(), nowMs);
|
||||
latest = latest is null ? end : Math.Max(latest.Value, end);
|
||||
}
|
||||
}
|
||||
|
||||
return latest;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user