Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions api/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,43 @@ const defs = {
output: ARR(MetricSchema, 'Collected query metrics'),
description: 'Get SQL metrics from the deployment',
}),
'GET/api/deployment/metrics-router': route({
authorize: withUserSession,
fn: async (ctx, { deployment }) => {
const dep = await withDeploymentTableAccess(ctx, deployment)
try {
const urlStr = dep.url.startsWith('http')
? dep.url
: `${isLocal ? 'http' : 'https'}://${dep.url}`
return await fetchJson(`${urlStr}/api/router/metrics`, {
method: 'GET',
})
} catch (err) {
log.error('fetch-router-metrics-error', { error: err })
throw new respond.InternalServerErrorError({
message: err instanceof Error
? err.message
: 'Failed to fetch router metrics',
})
}
},
input: OBJ({ deployment: STR("The deployment's URL") }),
output: ARR(
OBJ({
key: STR('Route key (method:path) allow to identify which route'),
duration: NUM(
'Total time the route handler take to respond, in milliseconds',
),
count: NUM('How many times the route was called'),
error: NUM('Number of time it responded with a status 400 or above'),
success: NUM(
'Number of time it responded with a status under 399 (Success, Redirect and Info)',
),
}, 'Route metrics'),
'Collected route metrics',
),
description: 'Get router metrics from the deployment',
}),
'GET/api/deployment/doc': route({
authorize: withUserSession,
fn: async (_ctx, { deployment }) => {
Expand Down
16 changes: 8 additions & 8 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"imports": {
"./": "./",
"/": "./",
"@01edu/api": "jsr:@01edu/api@^0.2.7",
"@01edu/api": "jsr:@01edu/api@^0.2.11",
"@01edu/api-client": "jsr:@01edu/api-client@^0.2.6",
"@01edu/api-proxy": "jsr:@01edu/api-proxy@^0.2.1",
"@01edu/signal-router": "npm:@01edu/signal-router@^0.2.3",
Expand All @@ -47,15 +47,15 @@
"@std/streams": "jsr:@std/streams@^1.1.1",
"@std/testing": "jsr:@std/testing@^1.0.19",
"chdb": "npm:chdb@^2.0.1",
"vite": "npm:vite@^8.0.16",
"vite": "npm:vite@^8.1.0",
"preact": "npm:preact@^10.29.2",
"@preact/preset-vite": "npm:@preact/preset-vite@^2.10.5",
"@preact/signals": "npm:@preact/signals@^2.9.1",
"@clickhouse/client": "npm:@clickhouse/client@^1.19.0",
"@tailwindcss/vite": "npm:@tailwindcss/vite@^4.3.0",
"tailwindcss": "npm:tailwindcss@^4.3.0",
"daisyui": "npm:daisyui@^5.5.20",
"lucide-preact": "npm:lucide-preact@^1.17.0",
"@preact/signals": "npm:@preact/signals@^2.9.2",
"@clickhouse/client": "npm:@clickhouse/client@^1.22.0",
"@tailwindcss/vite": "npm:@tailwindcss/vite@^4.3.1",
"tailwindcss": "npm:tailwindcss@^4.3.1",
"daisyui": "npm:daisyui@^5.5.23",
"lucide-preact": "npm:lucide-preact@^1.21.0",
"@deno/gfm": "jsr:@deno/gfm@0.12.0"
},
"fmt": {
Expand Down
Loading
Loading