Skip to content
Merged
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
307 changes: 171 additions & 136 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
},
"dependencies": {
"@inquirer/prompts": "^7.3.3",
"@platformatic/composer": "^2.57.0",
"@platformatic/runtime": "^2.57.0",
"@platformatic/service": "^2.57.0",
"@platformatic/control": "^2.57.0",
"@platformatic/vite": "^2.57.0",
"@platformatic/composer": "^2.60.0",
"@platformatic/runtime": "^2.60.0",
"@platformatic/service": "^2.60.0",
"@platformatic/control": "^2.60.0",
"@platformatic/vite": "^2.60.0",
"proxyquire": "^2.1.3",
"split2": "4.2.0",
"fastify": "^5.0.0",
"wattpm": "^2.57.0"
"wattpm": "^2.60.0"
},
"devDependencies": {
"@fastify/type-provider-json-schema-to-ts": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion watt.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.platformatic.dev/wattpm/2.57.0.json",
"$schema": "https://schemas.platformatic.dev/wattpm/2.60.0.json",
"server": {
"hostname": "127.0.0.1",
"port": "{PORT}"
Expand Down
174 changes: 174 additions & 0 deletions web/backend/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"pid": {
"type": "integer"
Expand Down Expand Up @@ -113,11 +114,13 @@
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"dataMem": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
Expand Down Expand Up @@ -153,6 +156,7 @@
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
Expand All @@ -176,6 +180,7 @@
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
Expand Down Expand Up @@ -203,6 +208,7 @@
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
Expand Down Expand Up @@ -263,11 +269,176 @@
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"dataMem": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
"format": "date-time"
},
"rss": {
"type": "number"
},
"totalHeap": {
"type": "number"
},
"usedHeap": {
"type": "number"
},
"newSpace": {
"type": "number"
},
"oldSpace": {
"type": "number"
}
},
"required": [
"date",
"rss",
"totalHeap",
"usedHeap",
"newSpace",
"oldSpace"
]
}
},
"dataCpu": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
"format": "date-time"
},
"cpu": {
"type": "number"
},
"eventLoop": {
"type": "number"
}
},
"required": [
"date",
"cpu",
"eventLoop"
]
}
},
"dataLatency": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
"format": "date-time"
},
"p90": {
"type": "number"
},
"p95": {
"type": "number"
},
"p99": {
"type": "number"
}
},
"required": [
"date",
"p90",
"p95",
"p99"
]
}
},
"dataReq": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
"format": "date-time"
},
"count": {
"type": "number"
},
"rps": {
"type": "number"
}
},
"required": [
"date",
"count",
"rps"
]
}
}
},
"required": [
"dataMem",
"dataCpu",
"dataLatency",
"dataReq"
]
}
}
}
}
}
}
},
"/runtimes/{pid}/metrics/{serviceId}/{workerId}": {
"get": {
"parameters": [
{
"schema": {
"type": "number"
},
"in": "path",
"name": "pid",
"required": true
},
{
"schema": {
"type": "string"
},
"in": "path",
"name": "serviceId",
"required": true
},
{
"schema": {
"type": "number"
},
"in": "path",
"name": "workerId",
"required": true
}
],
"responses": {
"200": {
"description": "Default Response",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"dataMem": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
Expand Down Expand Up @@ -303,6 +474,7 @@
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
Expand All @@ -326,6 +498,7 @@
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
Expand Down Expand Up @@ -353,6 +526,7 @@
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"date": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion web/backend/platformatic.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.platformatic.dev/@platformatic/service/2.57.0.json",
"$schema": "https://schemas.platformatic.dev/@platformatic/service/2.60.0.json",
"service": {
"openapi": true
},
Expand Down
19 changes: 18 additions & 1 deletion web/backend/routes/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,24 @@ export default async function (fastify: FastifyInstance) {
response: { 200: metricResponseSchema }
}
}, async ({ params: { pid, serviceId } }) => {
return fastify.mappedMetrics[pid]?.services[serviceId] || emptyMetrics
return fastify.mappedMetrics[pid]?.services[serviceId]?.all || emptyMetrics
})

typedFastify.get('/runtimes/:pid/metrics/:serviceId/:workerId', {
schema: {
params: {
type: 'object',
properties: {
pid: { type: 'number' },
serviceId: { type: 'string' },
workerId: { type: 'number' },
},
required: ['pid', 'serviceId', 'workerId']
},
response: { 200: metricResponseSchema }
}
}, async ({ params: { pid, serviceId, workerId } }) => {
return fastify.mappedMetrics[pid]?.services[serviceId]?.[workerId] || emptyMetrics
})

typedFastify.get('/runtimes/:pid/services', {
Expand Down
6 changes: 6 additions & 0 deletions web/backend/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const dateSchema = { type: 'string', format: 'date-time' } as const

const memoryDataPointSchema = {
type: 'object',
additionalProperties: false,
properties: {
date: dateSchema,
rss: { type: 'number' },
Expand All @@ -18,6 +19,7 @@ export type MemoryDataPoint = FromSchema<typeof memoryDataPointSchema>

const cpuDataPointSchema = {
type: 'object',
additionalProperties: false,
properties: {
date: dateSchema,
cpu: { type: 'number' },
Expand All @@ -29,6 +31,7 @@ export type CpuDataPoint = FromSchema<typeof cpuDataPointSchema>

const latencyDataPointSchema = {
type: 'object',
additionalProperties: false,
properties: {
date: { type: 'string', format: 'date-time' },
p90: { type: 'number' },
Expand All @@ -41,6 +44,7 @@ export type LatencyDataPoint = FromSchema<typeof latencyDataPointSchema>

const requestDataPointSchema = {
type: 'object',
additionalProperties: false,
properties: {
date: { type: 'string', format: 'date-time' },
count: { type: 'number' },
Expand All @@ -52,6 +56,7 @@ export type RequestDataPoint = FromSchema<typeof requestDataPointSchema>

export const metricResponseSchema = {
type: 'object',
additionalProperties: false,
properties: {
dataMem: { type: 'array', items: memoryDataPointSchema },
dataCpu: { type: 'array', items: cpuDataPointSchema },
Expand All @@ -64,6 +69,7 @@ export type MetricsResponse = FromSchema<typeof metricResponseSchema>

export const selectableRuntimeSchema = {
type: 'object',
additionalProperties: false,
properties: {
pid: {
type: 'integer'
Expand Down
Loading
Loading