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
301 changes: 181 additions & 120 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
},
"dependencies": {
"@inquirer/prompts": "^7.3.3",
"@platformatic/composer": "^2.52.0",
"@platformatic/runtime": "^2.52.0",
"@platformatic/composer": "^2.53.1",
"@platformatic/runtime": "^2.53.1",
"proxyquire": "^2.1.3",
"split2": "4.2.0",
"wattpm": "^2.52.0"
"wattpm": "^2.53.1"
},
"devDependencies": {
"@inquirer/testing": "^2.1.45",
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.52.0.json",
"$schema": "https://schemas.platformatic.dev/wattpm/2.53.1.json",
"server": {
"hostname": "127.0.0.1",
"port": "{PORT}"
Expand Down
6 changes: 3 additions & 3 deletions web/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
},
"devDependencies": {
"@fastify/type-provider-json-schema-to-ts": "^5.0.0",
"@platformatic/service": "^2.52.0",
"@platformatic/service": "^2.53.1",
"@types/proxyquire": "1.3.31",
"borp": "^0.19.0",
"eslint": "^9.17.0",
"fastify": "^5.0.0",
"fastify-tsconfig": "^2.0.0",
"neostandard": "^0.12.0",
"typescript": "^5.5.4",
"wattpm": "^2.52.0"
"wattpm": "^2.53.1"
},
"dependencies": {
"@platformatic/control": "^2.52.0"
"@platformatic/control": "^2.53.1"
}
}
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.52.0.json",
"$schema": "https://schemas.platformatic.dev/@platformatic/service/2.53.1.json",
"service": {
"openapi": true
},
Expand Down
21 changes: 8 additions & 13 deletions web/backend/routes/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { JsonSchemaToTsProvider } from '@fastify/type-provider-json-schema-to-ts
import { RuntimeApiClient, Runtime } from '@platformatic/control'
import { getLogsFromReadable } from '../utils/log'

type SelectableRuntime = Runtime & { selected?: boolean }

export default async function (fastify: FastifyInstance) {
const typedFastify = fastify.withTypeProvider<JsonSchemaToTsProvider>()
const api = new RuntimeApiClient()
Expand All @@ -21,21 +23,14 @@ export default async function (fastify: FastifyInstance) {
}
}, async (request) => {
const runtimes = await api.getRuntimes()

type SelectableRuntime = Runtime & { selected?: boolean }

let selectableRuntimes: SelectableRuntime[] = runtimes

if (!request.query.includeAdmin) {
selectableRuntimes = selectableRuntimes.filter((runtime) => runtime.packageName !== 'watt-admin')
}

for (const runtime of selectableRuntimes) {
if (process.env.SELECTED_RUNTIME === runtime.pid.toString()) {
runtime.selected = true
const selectableRuntimes: SelectableRuntime[] = []
for (const runtime of runtimes) {
if (!request.query.includeAdmin && runtime.packageName === 'watt-admin') {
continue
}
const selected = process.env.SELECTED_RUNTIME === runtime.pid.toString()
selectableRuntimes.push({ ...runtime, selected })
}

return selectableRuntimes
})

Expand Down
6 changes: 3 additions & 3 deletions web/backend/test/plugins/metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ test('metrics with runtime', async (t) => {
assert.strictEqual(res.statusCode, 200)

const metrics = res.json<MetricsResponse>()
assert.ok(metrics.dataCpu[0].cpu > 0)
assert.ok(metrics.dataCpu[0].eventLoop > 0)
assert.ok(metrics.dataCpu[0].cpu >= 0)
assert.ok(metrics.dataCpu[0].eventLoop >= 0)
assert.ok(new Date(metrics.dataCpu[0].date) <= new Date())

assert.ok(metrics.dataLatency[0].p90 >= 0)
Expand All @@ -43,7 +43,7 @@ test('metrics with runtime', async (t) => {
assert.ok(metrics.dataMem[0].oldSpace >= 0)
assert.ok(new Date(metrics.dataMem[0].date) <= new Date())

assert.ok(metrics.dataReq[0].count > 0)
assert.ok(metrics.dataReq[0].count >= 0)
assert.ok(new Date(metrics.dataReq[0].date) <= new Date())

const backendMetrics = await server.inject({
Expand Down
5 changes: 2 additions & 3 deletions web/backend/utils/calc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,10 @@ export const calculateMetrics = async ({ mappedMetrics, log }: FastifyInstance):
}

if (metric.name === 'http_request_duration_seconds') {
// FIXME: update MetricValue type with metricName (string) and exemplar (unknown) when this is released https://github.com/platformatic/platformatic/pull/3947
const count = metric.values.find((val: any) => val.metricName === 'http_request_duration_seconds_count'
const count = metric.values.find(({ metricName }) => metricName === 'http_request_duration_seconds_count'
)?.value
if (!count) {
log.warn(metric.values, 'Unable to get HTTP count')
log.debug(metric.values, 'Empty HTTP request count')
} else {
serviceReqData.count = count
aggregatedReqData.count += count
Expand Down
2 changes: 1 addition & 1 deletion web/composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"typescript": "^5.5.4"
},
"dependencies": {
"@platformatic/composer": "^2.52.0"
"@platformatic/composer": "^2.53.1"
}
}
2 changes: 1 addition & 1 deletion web/composer/platformatic.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.platformatic.dev/@platformatic/composer/2.52.0.json",
"$schema": "https://schemas.platformatic.dev/@platformatic/composer/2.53.1.json",
"composer": {
"services": [
{
Expand Down
2 changes: 1 addition & 1 deletion web/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"zustand": "^5.0.2"
},
"dependencies": {
"@platformatic/vite": "^2.52.0",
"@platformatic/vite": "^2.53.1",
"source-map-support": "^0.5.21"
},
"standard": {
Expand Down
2 changes: 1 addition & 1 deletion web/frontend/watt.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://schemas.platformatic.dev/@platformatic/vite/2.52.0.json",
"$schema": "https://schemas.platformatic.dev/@platformatic/vite/2.53.1.json",
"application": { "basePath": "/" },
"vite": {
"ssr": false
Expand Down
Loading