fix(health): не затирать график uptime пробой down в том же бакете
quality / commitlint (push) Skipped
CD / update-wiki (push) Successful in 5s
quality / changes (push) Successful in 8s
quality / api (push) Skipped
quality / docker-check (push) Skipped
quality / web (push) Successful in 55s
CD / quality (push) Successful in 1m7s
CD / publish (push) Successful in 1m38s
quality / commitlint (push) Skipped
CD / update-wiki (push) Successful in 5s
quality / changes (push) Successful in 8s
quality / api (push) Skipped
quality / docker-check (push) Skipped
quality / web (push) Successful in 55s
CD / quality (push) Successful in 1m7s
CD / publish (push) Successful in 1m38s
Если в минутном бакете есть живой IP, линия строится по его пингу, а не по null от Down. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -45,6 +45,28 @@ describe('toAlignedSeries', () => {
|
|||||||
expect(keys).toEqual(['local', 'cloudflare', 'globalping'])
|
expect(keys).toEqual(['local', 'cloudflare', 'globalping'])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('keeps live latency when another IP in the same bucket is down', () => {
|
||||||
|
const { points } = toAlignedSeries([
|
||||||
|
probe({
|
||||||
|
id: 1,
|
||||||
|
latency_ms: 18,
|
||||||
|
checked_at: '2026-01-01T00:00:10.000Z',
|
||||||
|
}),
|
||||||
|
probe({
|
||||||
|
id: 2,
|
||||||
|
status: 'down',
|
||||||
|
ok: false,
|
||||||
|
latency_ms: null,
|
||||||
|
checked_at: '2026-01-01T00:00:12.000Z',
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
|
||||||
|
expect(points).toHaveLength(1)
|
||||||
|
expect(points[0]?.local).toBe(18)
|
||||||
|
expect(points[0]?.localOk).toBe(true)
|
||||||
|
expect(points[0]?.ok).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
it('does not plot down probes as latency 0', () => {
|
it('does not plot down probes as latency 0', () => {
|
||||||
const { points } = toAlignedSeries([
|
const { points } = toAlignedSeries([
|
||||||
probe({
|
probe({
|
||||||
|
|||||||
@@ -124,8 +124,13 @@ export function toAlignedSeries(items: UptimeProbe[]): {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ok = probeOk(item)
|
const ok = probeOk(item)
|
||||||
row[`${key}Ok`] = ok
|
const prevOk = row[`${key}Ok`]
|
||||||
row[key] = ok ? item.latency_ms : null
|
row[`${key}Ok`] = prevOk === true || ok
|
||||||
|
if (ok && item.latency_ms != null) {
|
||||||
|
row[key] = item.latency_ms
|
||||||
|
} else if (row[key] === undefined) {
|
||||||
|
row[key] = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const points = [...buckets.entries()]
|
const points = [...buckets.entries()]
|
||||||
|
|||||||
Reference in New Issue
Block a user