@antelopejs/dms-api 0.4.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/frontend-module.d.ts +2 -0
- package/dist/frontend-module.js +17 -0
- package/dist/frontend-module.js.map +1 -0
- package/dist/index.js +2 -8
- package/dist/index.js.map +1 -1
- package/dist/pages/logs.d.ts +1 -1
- package/dist/pages/logs.js +3 -4
- package/dist/pages/logs.js.map +1 -1
- package/dist/pages/overview.d.ts +1 -1
- package/dist/pages/overview.js +13 -12
- package/dist/pages/overview.js.map +1 -1
- package/dist/pages/request-table.js +13 -9
- package/dist/pages/request-table.js.map +1 -1
- package/dist/pages/routes.d.ts +1 -1
- package/dist/pages/routes.js +12 -11
- package/dist/pages/routes.js.map +1 -1
- package/dist/pages/toolbar.d.ts +6 -5
- package/dist/pages/toolbar.js +26 -19
- package/dist/pages/toolbar.js.map +1 -1
- package/dist/routes/logs.d.ts +10 -1
- package/dist/routes/logs.js +10 -3
- package/dist/routes/logs.js.map +1 -1
- package/dist/routes/overview.d.ts +2 -2
- package/dist/routes/overview.js +3 -2
- package/dist/routes/overview.js.map +1 -1
- package/dist/services/comparison.d.ts +16 -0
- package/dist/services/comparison.js +66 -0
- package/dist/services/comparison.js.map +1 -0
- package/dist/services/live.d.ts +19 -3
- package/dist/services/live.js +104 -17
- package/dist/services/live.js.map +1 -1
- package/dist/services/overview-lists.d.ts +25 -0
- package/dist/services/overview-lists.js +119 -0
- package/dist/services/overview-lists.js.map +1 -0
- package/dist/services/overview.d.ts +7 -22
- package/dist/services/overview.js +18 -92
- package/dist/services/overview.js.map +1 -1
- package/dist/services/route-statistics.d.ts +4 -0
- package/dist/services/route-statistics.js +101 -39
- package/dist/services/route-statistics.js.map +1 -1
- package/dist/services/settings-form.js +4 -1
- package/dist/services/settings-form.js.map +1 -1
- package/dist/services/traffic.d.ts +8 -0
- package/dist/services/traffic.js +77 -0
- package/dist/services/traffic.js.map +1 -1
- package/dist/services/window.d.ts +6 -0
- package/dist/services/window.js +32 -9
- package/dist/services/window.js.map +1 -1
- package/frontend-vue/app/components/blocks/HealthHero.vue +23 -13
- package/frontend-vue/app/components/blocks/LiveTraffic.vue +165 -38
- package/frontend-vue/app/components/blocks/LogsFilters.vue +1 -1
- package/frontend-vue/app/components/blocks/RequestDetail.vue +43 -37
- package/frontend-vue/app/components/blocks/RouteHeader.vue +35 -15
- package/frontend-vue/app/components/blocks/RouteTree.vue +7 -8
- package/frontend-vue/app/composables/useLastRoute.ts +16 -0
- package/frontend-vue/app/middleware/defaultRoute.ts +31 -0
- package/frontend-vue/app/utils/format.ts +9 -0
- package/frontend-vue/app/utils/minuteHistogram.ts +51 -16
- package/frontend-vue/app/utils/routeExplorer.ts +23 -15
- package/frontend-vue/dms.frontend.ts +5 -0
- package/frontend-vue/i18n/locales/api-en-GB.json +41 -12
- package/frontend-vue/i18n/locales/api-fr-FR.json +41 -12
- package/frontend-vue/package.json +1 -1
- package/frontend-vue/tests/defaultRoute.test.ts +94 -0
- package/frontend-vue/tests/format.test.ts +10 -1
- package/frontend-vue/tests/minuteHistogram.test.ts +51 -0
- package/frontend-vue/tests/registration.test.ts +6 -2
- package/frontend-vue/tests/requestDrawer.test.ts +13 -0
- package/frontend-vue/tests/routeExplorer.test.ts +35 -28
- package/package.json +7 -6
- package/skills/dms-api/SKILL.md +3 -1
- package/dist/pages/period.d.ts +0 -9
- package/dist/pages/period.js +0 -24
- package/dist/pages/period.js.map +0 -1
|
@@ -150,7 +150,6 @@
|
|
|
150
150
|
"title": "Bêta",
|
|
151
151
|
"description": "La console API est en lecture seule pour l'instant : inspecter, surveiller et tester les routes."
|
|
152
152
|
},
|
|
153
|
-
"no_previous": "Pas de période précédente à comparer",
|
|
154
153
|
"traffic": {
|
|
155
154
|
"title": "Trafic et erreurs",
|
|
156
155
|
"2xx": "2xx succès",
|
|
@@ -221,7 +220,19 @@
|
|
|
221
220
|
}
|
|
222
221
|
},
|
|
223
222
|
"live": {
|
|
224
|
-
"title": "Requêtes par
|
|
223
|
+
"title": "Requêtes par {bucket} · {period} · tout le trafic",
|
|
224
|
+
"title_pending": "Requêtes · tout le trafic",
|
|
225
|
+
"bucket_minute": "minute",
|
|
226
|
+
"bucket_minutes": "{amount} min",
|
|
227
|
+
"bucket_hours": "{amount} h",
|
|
228
|
+
"bucket_day": "jour",
|
|
229
|
+
"period_last-hour": "dernière heure",
|
|
230
|
+
"period_last-24h": "dernières 24 h",
|
|
231
|
+
"period_last-7-days": "7 derniers jours",
|
|
232
|
+
"period_last-30-days": "30 derniers jours",
|
|
233
|
+
"period_all": "tous les logs conservés",
|
|
234
|
+
"period_custom": "{from} – {to}",
|
|
235
|
+
"past": "Période passée · pas en direct",
|
|
225
236
|
"kept": "Conservées {days} jours · corps jusqu'à {size}",
|
|
226
237
|
"kept_days": "Conservées {days} jours",
|
|
227
238
|
"kept_no_bodies": "Conservées {days} jours · corps non capturés",
|
|
@@ -234,14 +245,14 @@
|
|
|
234
245
|
"paused": "En pause",
|
|
235
246
|
"last_data": "données de {time}",
|
|
236
247
|
"no_data_yet": "aucune donnée pour l'instant",
|
|
237
|
-
"error": "Impossible de charger
|
|
248
|
+
"error": "Impossible de charger l'histogramme des requêtes",
|
|
238
249
|
"error_description": "Le graphe réessaie à la prochaine actualisation.",
|
|
239
|
-
"scale": "Échelle jusqu'à {count} par
|
|
240
|
-
"scale_cut": "les
|
|
250
|
+
"scale": "Échelle jusqu'à {count} par {bucket}",
|
|
251
|
+
"scale_cut": "les barres plus hautes sont coupées",
|
|
241
252
|
"tooltip_none": "aucune requête",
|
|
242
|
-
"tooltip_current": "
|
|
243
|
-
"summary": "Requêtes par
|
|
244
|
-
"summary_empty": "Aucune requête sur
|
|
253
|
+
"tooltip_current": "en cours",
|
|
254
|
+
"summary": "Requêtes par {bucket}, {period} : {total} requêtes, {client} 4xx, {server} 5xx. Pic : {peak} à {time}.",
|
|
255
|
+
"summary_empty": "Aucune requête sur cette période."
|
|
245
256
|
},
|
|
246
257
|
"live_mode": {
|
|
247
258
|
"verdict": {
|
|
@@ -376,7 +387,7 @@
|
|
|
376
387
|
"slow_ratio": "Lente · {ratio}× le seuil",
|
|
377
388
|
"threshold_ratio": "{ratio}× le seuil de lenteur",
|
|
378
389
|
"threshold": "Seuil de lenteur {threshold}, tel que réglé aujourd'hui.",
|
|
379
|
-
"route_latency": "Cette route, dernier jour : p50
|
|
390
|
+
"route_latency": "Cette route, dernier jour : p50\u00a0{p50} · p95\u00a0{p95} | Cette route, {days} derniers jours : p50\u00a0{p50} · p95\u00a0{p95}",
|
|
380
391
|
"meter_label": "Durée par rapport au seuil de lenteur",
|
|
381
392
|
"not_measured": "non mesurée",
|
|
382
393
|
"not_measured_hint": "Non mesurée : la requête a été rejetée avant d'atteindre un handler.",
|
|
@@ -418,7 +429,6 @@
|
|
|
418
429
|
"forbidden_description": "Votre rôle affiche cette liste, mais pas le détail de ses requêtes. Demandez à un administrateur l'accès aux journaux des requêtes.",
|
|
419
430
|
"error_title": "Impossible d'ouvrir cette requête",
|
|
420
431
|
"error_description": "La console n'a pas répondu. Réessayez.",
|
|
421
|
-
"position": "Requête {index} sur {total} affichées",
|
|
422
432
|
"heading": "{method} {path}"
|
|
423
433
|
},
|
|
424
434
|
"routes": {
|
|
@@ -516,8 +526,6 @@
|
|
|
516
526
|
"rate": "{rate}",
|
|
517
527
|
"error_split": "{client} × 4xx · {server} × 5xx",
|
|
518
528
|
"slow_line": "lent au-delà de {threshold}",
|
|
519
|
-
"no_baseline": "Pas de période précédente",
|
|
520
|
-
"vs_previous": "{delta} par rapport à la période précédente",
|
|
521
529
|
"summary": "Indicateurs de la route",
|
|
522
530
|
"p95_detail": "p95 {p95}",
|
|
523
531
|
"p95_none": "Aucune p95 conservée sur la période",
|
|
@@ -861,6 +869,27 @@
|
|
|
861
869
|
"adjusted_min": "{typed} est sous le minimum : ramené à {value}.",
|
|
862
870
|
"adjusted_step": "{typed} n'est pas un multiple de {step} : arrondi à {value}."
|
|
863
871
|
}
|
|
872
|
+
},
|
|
873
|
+
"compare": {
|
|
874
|
+
"series": {
|
|
875
|
+
"previous_period": "Période précédente",
|
|
876
|
+
"custom": "Période comparée"
|
|
877
|
+
},
|
|
878
|
+
"versus": {
|
|
879
|
+
"previous_period": "{delta} vs {previous} période précédente",
|
|
880
|
+
"custom": "{delta} vs {previous} période comparée"
|
|
881
|
+
},
|
|
882
|
+
"from_zero": {
|
|
883
|
+
"previous_period": "aucun sur la période précédente",
|
|
884
|
+
"custom": "aucun sur la période comparée"
|
|
885
|
+
},
|
|
886
|
+
"no_baseline": {
|
|
887
|
+
"previous_period": "Pas de période précédente",
|
|
888
|
+
"custom": "Pas de données sur la période comparée"
|
|
889
|
+
},
|
|
890
|
+
"change_percent": "{sign}{value}",
|
|
891
|
+
"change_points": "{sign}{value} pt",
|
|
892
|
+
"with": "{detail} · {versus}"
|
|
864
893
|
}
|
|
865
894
|
}
|
|
866
895
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
|
|
3
|
+
type Middleware = (to: {
|
|
4
|
+
path: string
|
|
5
|
+
query: Record<string, string>
|
|
6
|
+
}) => unknown
|
|
7
|
+
|
|
8
|
+
const ROUTES = [
|
|
9
|
+
{
|
|
10
|
+
ref: 'GET /health',
|
|
11
|
+
method: 'GET',
|
|
12
|
+
path: '/health',
|
|
13
|
+
folder: '/health',
|
|
14
|
+
state: 'healthy',
|
|
15
|
+
requests: 90,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
ref: 'POST /orders',
|
|
19
|
+
method: 'POST',
|
|
20
|
+
path: '/orders',
|
|
21
|
+
folder: '/orders',
|
|
22
|
+
state: 'failing',
|
|
23
|
+
requests: 4,
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
const authFetch = vi.fn()
|
|
28
|
+
const cookie = { value: null as string | null }
|
|
29
|
+
const session = { loggedIn: { value: true } }
|
|
30
|
+
|
|
31
|
+
async function load(): Promise<Middleware> {
|
|
32
|
+
vi.resetModules()
|
|
33
|
+
vi.stubGlobal('defineDmsMiddleware', (handler: Middleware) => handler)
|
|
34
|
+
vi.stubGlobal('useDmsUserSession', () => session)
|
|
35
|
+
vi.stubGlobal('useAuthFetch', () => ({ $authFetch: authFetch }))
|
|
36
|
+
vi.stubGlobal('useDmsCookie', () => cookie)
|
|
37
|
+
return (await import('../app/middleware/defaultRoute')).default as Middleware
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
describe('the Routes page opened without a route', () => {
|
|
41
|
+
beforeEach(() => {
|
|
42
|
+
authFetch.mockReset().mockResolvedValue({ routes: ROUTES })
|
|
43
|
+
cookie.value = null
|
|
44
|
+
session.loggedIn.value = true
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('lands on the route needing a look first, the query kept', async () => {
|
|
48
|
+
const middleware = await load()
|
|
49
|
+
await expect(
|
|
50
|
+
middleware({ path: '/modules/api/routes', query: { tab: 'tester' } }),
|
|
51
|
+
).resolves.toEqual({
|
|
52
|
+
path: '/modules/api/routes',
|
|
53
|
+
query: { tab: 'tester', route: 'POST /orders' },
|
|
54
|
+
})
|
|
55
|
+
expect(authFetch).toHaveBeenCalledWith('/api/monitoring/routes/list')
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('lands on the route last opened in the session', async () => {
|
|
59
|
+
cookie.value = 'GET /health'
|
|
60
|
+
const middleware = await load()
|
|
61
|
+
await expect(
|
|
62
|
+
middleware({ path: '/modules/api/routes', query: {} }),
|
|
63
|
+
).resolves.toMatchObject({ query: { route: 'GET /health' } })
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it('leaves alone a visit naming a route, and the other pages', async () => {
|
|
67
|
+
const middleware = await load()
|
|
68
|
+
await expect(
|
|
69
|
+
middleware({
|
|
70
|
+
path: '/modules/api/routes',
|
|
71
|
+
query: { route: 'GET /health' },
|
|
72
|
+
}),
|
|
73
|
+
).resolves.toBeUndefined()
|
|
74
|
+
await expect(
|
|
75
|
+
middleware({ path: '/modules/api/logs', query: {} }),
|
|
76
|
+
).resolves.toBeUndefined()
|
|
77
|
+
expect(authFetch).not.toHaveBeenCalled()
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('opens the page as it is signed out or without the list', async () => {
|
|
81
|
+
session.loggedIn.value = false
|
|
82
|
+
const middleware = await load()
|
|
83
|
+
await expect(
|
|
84
|
+
middleware({ path: '/modules/api/routes', query: {} }),
|
|
85
|
+
).resolves.toBeUndefined()
|
|
86
|
+
expect(authFetch).not.toHaveBeenCalled()
|
|
87
|
+
|
|
88
|
+
session.loggedIn.value = true
|
|
89
|
+
authFetch.mockRejectedValue(new Error('offline'))
|
|
90
|
+
await expect(
|
|
91
|
+
middleware({ path: '/modules/api/routes', query: {} }),
|
|
92
|
+
).resolves.toBeUndefined()
|
|
93
|
+
})
|
|
94
|
+
})
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
formatRelativeDay,
|
|
12
12
|
formatThreshold,
|
|
13
13
|
spanPart,
|
|
14
|
+
unbreakable,
|
|
14
15
|
} from '../app/utils/format'
|
|
15
16
|
|
|
16
17
|
// What the blocks pass, the DMS's regional formatter, without preferences.
|
|
@@ -22,7 +23,7 @@ const en: DateFormat = formatIn('en-GB')
|
|
|
22
23
|
const fr: DateFormat = formatIn('fr-FR')
|
|
23
24
|
|
|
24
25
|
// Intl writes French spaces as narrow no-break ones: compare on plain spaces.
|
|
25
|
-
const plain = (text: string) => text.replace(/[
|
|
26
|
+
const plain = (text: string) => text.replace(/[ \u00A0]/g, ' ')
|
|
26
27
|
|
|
27
28
|
describe('formatPercent', () => {
|
|
28
29
|
it('writes a percentage the way the locale does', () => {
|
|
@@ -137,6 +138,14 @@ describe('formatMs', () => {
|
|
|
137
138
|
})
|
|
138
139
|
})
|
|
139
140
|
|
|
141
|
+
describe('unbreakable', () => {
|
|
142
|
+
it('joins a value and its unit with no-break spaces', () => {
|
|
143
|
+
expect(unbreakable(formatMs(68, 'en-GB'))).toBe('68\u00A0ms')
|
|
144
|
+
expect(unbreakable(formatMs(0.4, 'en-GB'))).toBe('<\u00A01\u00A0ms')
|
|
145
|
+
expect(unbreakable('1,840')).toBe('1,840')
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
|
|
140
149
|
describe('formatThreshold', () => {
|
|
141
150
|
it('writes a threshold in ms under a second, in seconds from one', () => {
|
|
142
151
|
expect(formatThreshold(800, 'en-GB')).toBe('800 ms')
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
2
|
import {
|
|
3
3
|
axisTicks,
|
|
4
|
+
barTimeFormat,
|
|
5
|
+
bucketLabel,
|
|
4
6
|
liveStatus,
|
|
5
7
|
minuteBars,
|
|
6
8
|
peakBar,
|
|
@@ -8,6 +10,8 @@ import {
|
|
|
8
10
|
} from '../app/utils/minuteHistogram'
|
|
9
11
|
|
|
10
12
|
const MINUTE = 60_000
|
|
13
|
+
const HOUR = 60 * MINUTE
|
|
14
|
+
const DAY = 24 * HOUR
|
|
11
15
|
const START = Date.UTC(2026, 9, 10, 16, 40)
|
|
12
16
|
|
|
13
17
|
function bucket(index: number, success: number, client = 0, server = 0) {
|
|
@@ -85,10 +89,57 @@ describe('minuteBars', () => {
|
|
|
85
89
|
})
|
|
86
90
|
})
|
|
87
91
|
|
|
92
|
+
describe('bars longer than a minute', () => {
|
|
93
|
+
const quarter = 15 * MINUTE
|
|
94
|
+
const buckets = [0, 1, 2].map((index) => ({
|
|
95
|
+
start: START + index * quarter,
|
|
96
|
+
success: 4,
|
|
97
|
+
clientErrors: 0,
|
|
98
|
+
serverErrors: 0,
|
|
99
|
+
}))
|
|
100
|
+
|
|
101
|
+
it('marks the bar holding now as still running', () => {
|
|
102
|
+
const now = new Date(START + 2 * quarter + 7 * MINUTE).toISOString()
|
|
103
|
+
const { bars } = minuteBars(buckets, now, quarter)
|
|
104
|
+
expect(bars.map((bar) => bar.current)).toEqual([false, false, true])
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it('marks none over a past range', () => {
|
|
108
|
+
const { bars } = minuteBars(buckets, undefined, quarter)
|
|
109
|
+
expect(bars.some((bar) => bar.current)).toBe(false)
|
|
110
|
+
})
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
describe('bucketLabel', () => {
|
|
114
|
+
it('names each bar length as the title says it', () => {
|
|
115
|
+
expect(bucketLabel(MINUTE)).toEqual({ unit: 'minute' })
|
|
116
|
+
expect(bucketLabel(15 * MINUTE)).toEqual({ unit: 'minutes', amount: 15 })
|
|
117
|
+
expect(bucketLabel(2 * HOUR)).toEqual({ unit: 'hours', amount: 2 })
|
|
118
|
+
expect(bucketLabel(6 * HOUR)).toEqual({ unit: 'hours', amount: 6 })
|
|
119
|
+
expect(bucketLabel(DAY)).toEqual({ unit: 'day' })
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
describe('barTimeFormat', () => {
|
|
124
|
+
it('writes the date once the period spans days', () => {
|
|
125
|
+
expect(barTimeFormat(MINUTE, HOUR)).toBe('time')
|
|
126
|
+
expect(barTimeFormat(15 * MINUTE, DAY)).toBe('time')
|
|
127
|
+
expect(barTimeFormat(2 * HOUR, 7 * DAY)).toBe('dateTime')
|
|
128
|
+
expect(barTimeFormat(6 * HOUR, 30 * DAY)).toBe('dateTime')
|
|
129
|
+
expect(barTimeFormat(DAY, 200 * DAY)).toBe('date')
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
|
|
88
133
|
describe('live indicator', () => {
|
|
89
134
|
it('says reconnecting from the first failure, paused whatever failed', () => {
|
|
90
135
|
expect(liveStatus(true, 0)).toBe('live')
|
|
91
136
|
expect(liveStatus(true, 1)).toBe('reconnecting')
|
|
92
137
|
expect(liveStatus(false, 4)).toBe('paused')
|
|
93
138
|
})
|
|
139
|
+
|
|
140
|
+
it('says a past range is not live, Direct or paused', () => {
|
|
141
|
+
expect(liveStatus(true, 0, false)).toBe('past')
|
|
142
|
+
expect(liveStatus(false, 0, false)).toBe('past')
|
|
143
|
+
expect(liveStatus(true, 1, false)).toBe('reconnecting')
|
|
144
|
+
})
|
|
94
145
|
})
|
|
@@ -2,6 +2,7 @@ import { expect, it, vi } from 'vitest'
|
|
|
2
2
|
import frontendModule from '../dms.frontend'
|
|
3
3
|
|
|
4
4
|
vi.mock('../app/plugins/displays', () => ({ default: () => {} }))
|
|
5
|
+
vi.mock('../app/middleware/defaultRoute', () => ({ default: () => {} }))
|
|
5
6
|
|
|
6
7
|
it('registers the blocks the backend pages name, and nothing else', async () => {
|
|
7
8
|
const registerComponent = vi.fn()
|
|
@@ -40,6 +41,9 @@ it('registers the blocks the backend pages name, and nothing else', async () =>
|
|
|
40
41
|
// Universal: the cell displays draw in the server render too.
|
|
41
42
|
expect(registerPlugin).toHaveBeenCalledTimes(1)
|
|
42
43
|
expect(registerPlugin.mock.calls[0]?.[1]).toEqual({ clientOnly: false })
|
|
43
|
-
//
|
|
44
|
-
|
|
44
|
+
// One middleware, on every visit: the Routes page opened without a route
|
|
45
|
+
// lands on one, on the server too. The request drawer and its URL are the DMS's.
|
|
46
|
+
expect(registerMiddleware).toHaveBeenCalledTimes(1)
|
|
47
|
+
expect(registerMiddleware.mock.calls[0]?.[0]).toBe('dms-api-default-route')
|
|
48
|
+
expect(registerMiddleware.mock.calls[0]?.[2]).toEqual({ global: true })
|
|
45
49
|
})
|
|
@@ -177,3 +177,16 @@ describe('reading a request', () => {
|
|
|
177
177
|
).toBe('/modules/api/logs?route=GET+%2Forders&slow=true')
|
|
178
178
|
})
|
|
179
179
|
})
|
|
180
|
+
|
|
181
|
+
describe("the route's latency line", () => {
|
|
182
|
+
it('keeps each percentile with its value, in every locale', async () => {
|
|
183
|
+
for (const locale of ['en-GB', 'fr-FR']) {
|
|
184
|
+
const messages = (await import(`../i18n/locales/api-${locale}.json`))
|
|
185
|
+
.default as { api: { request: { route_latency: string } } }
|
|
186
|
+
const line = messages.api.request.route_latency
|
|
187
|
+
expect(line).toMatch(/p50 \{p50\}/)
|
|
188
|
+
expect(line).toMatch(/p95 \{p95\}/)
|
|
189
|
+
expect(line).not.toMatch(/p(50|95) \{/)
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
})
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
2
|
import {
|
|
3
3
|
bySeverity,
|
|
4
|
+
defaultRouteLocation,
|
|
4
5
|
type ExplorerRoute,
|
|
5
6
|
groupRoutes,
|
|
6
7
|
initialRoute,
|
|
7
|
-
lastRoute,
|
|
8
8
|
listedFolders,
|
|
9
9
|
listedMessages,
|
|
10
10
|
needsAttention,
|
|
11
11
|
optionId,
|
|
12
|
-
rememberRoute,
|
|
13
12
|
type RouteState,
|
|
14
13
|
stepFrom,
|
|
15
14
|
windowParts,
|
|
@@ -143,36 +142,44 @@ describe('opening the page', () => {
|
|
|
143
142
|
expect(initialRoute(ROUTES, null)?.ref).toBe('POST /api/orders')
|
|
144
143
|
})
|
|
145
144
|
|
|
146
|
-
describe('
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
145
|
+
describe('a visit naming no route', () => {
|
|
146
|
+
const PAGE = '/modules/api/routes'
|
|
147
|
+
|
|
148
|
+
it('lands on the route the list would open, the query kept', () => {
|
|
149
|
+
expect(
|
|
150
|
+
defaultRouteLocation(
|
|
151
|
+
{ path: PAGE, query: { tab: 'tester' } },
|
|
152
|
+
ROUTES,
|
|
153
|
+
null,
|
|
154
|
+
),
|
|
155
|
+
).toEqual({
|
|
156
|
+
path: PAGE,
|
|
157
|
+
query: { tab: 'tester', route: 'POST /api/orders' },
|
|
157
158
|
})
|
|
158
159
|
})
|
|
159
160
|
|
|
160
|
-
it('
|
|
161
|
-
expect(
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
it('lands on the last route opened while it is listed', () => {
|
|
162
|
+
expect(
|
|
163
|
+
defaultRouteLocation({ path: PAGE, query: {} }, ROUTES, 'GET /health')
|
|
164
|
+
?.query.route,
|
|
165
|
+
).toBe('GET /health')
|
|
166
|
+
expect(
|
|
167
|
+
defaultRouteLocation({ path: PAGE, query: {} }, ROUTES, 'GET /gone')
|
|
168
|
+
?.query.route,
|
|
169
|
+
).toBe('POST /api/orders')
|
|
164
170
|
})
|
|
165
171
|
|
|
166
|
-
it('
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
expect(
|
|
175
|
-
|
|
172
|
+
it('leaves a visit naming a route, or a list without any, as it is', () => {
|
|
173
|
+
expect(
|
|
174
|
+
defaultRouteLocation(
|
|
175
|
+
{ path: PAGE, query: { route: 'GET /api/orders' } },
|
|
176
|
+
ROUTES,
|
|
177
|
+
null,
|
|
178
|
+
),
|
|
179
|
+
).toBeUndefined()
|
|
180
|
+
expect(
|
|
181
|
+
defaultRouteLocation({ path: PAGE, query: {} }, [], 'GET /health'),
|
|
182
|
+
).toBeUndefined()
|
|
176
183
|
})
|
|
177
184
|
})
|
|
178
185
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "API console for the AntelopeJS DMS: API health, request logs, per-route statistics, inferred contracts and a request tester.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"@antelopejs/interface-api": ">=0.0.15 <1.0.0",
|
|
49
49
|
"@antelopejs/interface-api-util": ">=0.1.3 <1.0.0",
|
|
50
50
|
"@antelopejs/interface-core": ">=0.2.4 <1.0.0",
|
|
51
|
-
"@antelopejs/interface-database": ">=0.1.
|
|
52
|
-
"@antelopejs/interface-database-decorators": ">=0.1.
|
|
53
|
-
"@antelopejs/interface-dms": ">=0.
|
|
51
|
+
"@antelopejs/interface-database": ">=0.1.11 <1.0.0",
|
|
52
|
+
"@antelopejs/interface-database-decorators": ">=0.1.10 <1.0.0",
|
|
53
|
+
"@antelopejs/interface-dms": ">=0.9.0 <1.0.0",
|
|
54
54
|
"node-cron": "^4.2.1",
|
|
55
55
|
"zod": "^3.24.2"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@antelopejs/core": "1.
|
|
58
|
+
"@antelopejs/core": "1.17.1",
|
|
59
59
|
"@antelopejs/tooling-configs": ">=0.0.9 <1.0.0",
|
|
60
60
|
"@types/node": "^24.0.0",
|
|
61
61
|
"knip": "^6.34.0",
|
|
@@ -82,5 +82,6 @@
|
|
|
82
82
|
"skills": [
|
|
83
83
|
"./skills"
|
|
84
84
|
]
|
|
85
|
-
}
|
|
85
|
+
},
|
|
86
|
+
"dmsFrontend": "dist/frontend-module.js"
|
|
86
87
|
}
|
package/skills/dms-api/SKILL.md
CHANGED
|
@@ -12,7 +12,7 @@ Monitors the project's own HTTP API: it captures each request of the routes in s
|
|
|
12
12
|
|
|
13
13
|
## When to reach for it
|
|
14
14
|
|
|
15
|
-
- Debug a route: read its failed requests in `/modules/api/logs` (
|
|
15
|
+
- Debug a route: read its failed requests in `/modules/api/logs` (its drawer holds the error, stack, headers and bodies) or replay one in the route's Tester.
|
|
16
16
|
- Alert on a broken route: an automation procedure on `api.route-unhealthy` (`flags`: `broken`, `slow`, `warn`; default `broken` + `slow`).
|
|
17
17
|
|
|
18
18
|
## Config (`antelope.config.ts`; the API settings page overrides it at runtime)
|
|
@@ -29,3 +29,5 @@ Monitors the project's own HTTP API: it captures each request of the routes in s
|
|
|
29
29
|
- A route reads "Auth unknown" when the check happens inside the handler; guard with the DMS auth decorators or name the middleware in `authMiddlewareCallbacks`.
|
|
30
30
|
- Each block is its own permission (`@AuthUserWithPermission(<block>)`): grant roles the blocks they need.
|
|
31
31
|
- Request logs can hold application data; secret-looking keys are always redacted.
|
|
32
|
+
- Overview and Routes compare with the period before or with nothing (`?api.compare=previous-period|none`); every chart draws the compared period dashed and every figure says its change and its value then. No year-back comparison: the retention never keeps a year of statistics. The Request logs compare nothing.
|
|
33
|
+
- The Request logs histogram follows the page's period (`GET /api/monitoring/logs/live?preset=last-7-days`, or `from` / `to`, or `preset=all`), in bars of 1 min (1H), 15 min (24H), 2 h (7D) or 6 h (30D, All time), all traffic in scope whatever the table filters.
|
package/dist/pages/period.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type PeriodSelectorProps } from "@antelopejs/interface-dms/base/period-selector";
|
|
2
|
-
import type { ComponentBuilder } from "@antelopejs/interface-dms/component";
|
|
3
|
-
import { PERIOD_SCOPE } from "@/services/window";
|
|
4
|
-
export { PERIOD_SCOPE };
|
|
5
|
-
export interface PeriodSelectorOptions {
|
|
6
|
-
compare?: boolean;
|
|
7
|
-
allTime?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare function periodSelector(options?: PeriodSelectorOptions): ComponentBuilder<PeriodSelectorProps>;
|
package/dist/pages/period.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PERIOD_SCOPE = void 0;
|
|
4
|
-
exports.periodSelector = periodSelector;
|
|
5
|
-
const period_selector_1 = require("@antelopejs/interface-dms/base/period-selector");
|
|
6
|
-
const window_1 = require("@/services/window");
|
|
7
|
-
Object.defineProperty(exports, "PERIOD_SCOPE", { enumerable: true, get: function () { return window_1.PERIOD_SCOPE; } });
|
|
8
|
-
function periodSelector(options = {}) {
|
|
9
|
-
const comparison = options.compare ? "previous-period" : "none";
|
|
10
|
-
return (0, period_selector_1.PeriodSelector)({
|
|
11
|
-
id: window_1.PERIOD_SCOPE,
|
|
12
|
-
rememberKey: window_1.PERIOD_SCOPE,
|
|
13
|
-
variant: "segmented",
|
|
14
|
-
size: "sm",
|
|
15
|
-
align: "right",
|
|
16
|
-
rangeLabel: "relative",
|
|
17
|
-
presets: [...window_1.WINDOW_PRESETS, ...(options.allTime ? ["all"] : [])],
|
|
18
|
-
defaultPreset: window_1.DEFAULT_WINDOW,
|
|
19
|
-
comparisons: [comparison],
|
|
20
|
-
defaultComparison: comparison,
|
|
21
|
-
comparisonControl: "hidden",
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=period.js.map
|
package/dist/pages/period.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"period.js","sourceRoot":"","sources":["../../src/pages/period.ts"],"names":[],"mappings":";;;AAqCA,wCAiBC;AAtDD,oFAGwD;AAExD,8CAI2B;AAElB,6FAJP,qBAAY,OAIO;AA0BrB,SAAgB,cAAc,CAC5B,UAAiC,EAAE;IAEnC,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC;IAChE,OAAO,IAAA,gCAAc,EAAC;QACpB,EAAE,EAAE,qBAAY;QAChB,WAAW,EAAE,qBAAY;QACzB,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE,CAAC,GAAG,uBAAc,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC1E,aAAa,EAAE,uBAAc;QAC7B,WAAW,EAAE,CAAC,UAAU,CAAC;QACzB,iBAAiB,EAAE,UAAU;QAC7B,iBAAiB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACL,CAAC"}
|