@platformatic/runtime 3.56.0 → 3.57.0
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/config.d.ts +43 -0
- package/lib/prom-server.js +30 -1
- package/lib/worker/controller.js +12 -10
- package/package.json +17 -17
- package/schema.json +126 -1
package/config.d.ts
CHANGED
|
@@ -333,6 +333,33 @@ export type PlatformaticRuntimeConfig = {
|
|
|
333
333
|
enabled?: boolean | string;
|
|
334
334
|
hostname?: string;
|
|
335
335
|
endpoint?: string;
|
|
336
|
+
https?: {
|
|
337
|
+
allowHTTP1?: boolean;
|
|
338
|
+
key:
|
|
339
|
+
| string
|
|
340
|
+
| {
|
|
341
|
+
path?: string;
|
|
342
|
+
}
|
|
343
|
+
| (
|
|
344
|
+
| string
|
|
345
|
+
| {
|
|
346
|
+
path?: string;
|
|
347
|
+
}
|
|
348
|
+
)[];
|
|
349
|
+
cert:
|
|
350
|
+
| string
|
|
351
|
+
| {
|
|
352
|
+
path?: string;
|
|
353
|
+
}
|
|
354
|
+
| (
|
|
355
|
+
| string
|
|
356
|
+
| {
|
|
357
|
+
path?: string;
|
|
358
|
+
}
|
|
359
|
+
)[];
|
|
360
|
+
requestCert?: boolean;
|
|
361
|
+
rejectUnauthorized?: boolean;
|
|
362
|
+
};
|
|
336
363
|
auth?: {
|
|
337
364
|
username: string;
|
|
338
365
|
password: string;
|
|
@@ -471,6 +498,14 @@ export type PlatformaticRuntimeConfig = {
|
|
|
471
498
|
* The path to write the traces to. Only for file exporter.
|
|
472
499
|
*/
|
|
473
500
|
path?: string;
|
|
501
|
+
/**
|
|
502
|
+
* The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http.
|
|
503
|
+
*/
|
|
504
|
+
protocol?: "http" | "grpc";
|
|
505
|
+
/**
|
|
506
|
+
* Alias for protocol. Only for the otlp exporter. Defaults to http.
|
|
507
|
+
*/
|
|
508
|
+
transport?: "http" | "grpc";
|
|
474
509
|
[k: string]: unknown;
|
|
475
510
|
};
|
|
476
511
|
additionalProperties?: never;
|
|
@@ -496,6 +531,14 @@ export type PlatformaticRuntimeConfig = {
|
|
|
496
531
|
* The path to write the traces to. Only for file exporter.
|
|
497
532
|
*/
|
|
498
533
|
path?: string;
|
|
534
|
+
/**
|
|
535
|
+
* The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http.
|
|
536
|
+
*/
|
|
537
|
+
protocol?: "http" | "grpc";
|
|
538
|
+
/**
|
|
539
|
+
* Alias for protocol. Only for the otlp exporter. Defaults to http.
|
|
540
|
+
*/
|
|
541
|
+
transport?: "http" | "grpc";
|
|
499
542
|
[k: string]: unknown;
|
|
500
543
|
};
|
|
501
544
|
additionalProperties?: never;
|
package/lib/prom-server.js
CHANGED
|
@@ -2,6 +2,7 @@ import fastifyAccepts from '@fastify/accepts'
|
|
|
2
2
|
import fastifyBasicAuth from '@fastify/basic-auth'
|
|
3
3
|
import { loadModule } from '@platformatic/foundation'
|
|
4
4
|
import fastify from 'fastify'
|
|
5
|
+
import { readFile } from 'node:fs/promises'
|
|
5
6
|
import { createRequire } from 'node:module'
|
|
6
7
|
import { resolve } from 'node:path'
|
|
7
8
|
|
|
@@ -52,6 +53,33 @@ async function checkReadiness (runtime) {
|
|
|
52
53
|
return { response, status }
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
async function sanitizeHTTPSArgument (arg) {
|
|
57
|
+
if (typeof arg === 'string') {
|
|
58
|
+
return arg
|
|
59
|
+
} else if (!Array.isArray(arg)) {
|
|
60
|
+
return readFile(arg.path)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const sanitized = []
|
|
64
|
+
for (const item of arg) {
|
|
65
|
+
sanitized.push(typeof item === 'string' ? item : await readFile(item.path))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return sanitized
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function sanitizeHTTPSOptions (https) {
|
|
72
|
+
if (!https) {
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
...https,
|
|
78
|
+
key: await sanitizeHTTPSArgument(https.key),
|
|
79
|
+
cert: await sanitizeHTTPSArgument(https.cert)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
55
83
|
async function checkLiveness (runtime) {
|
|
56
84
|
const { status: ready, response: readinessResponse } = await checkReadiness(runtime)
|
|
57
85
|
if (!ready) {
|
|
@@ -84,8 +112,9 @@ export async function startPrometheusServer (runtime, opts) {
|
|
|
84
112
|
const port = opts.port ?? DEFAULT_PORT
|
|
85
113
|
const metricsEndpoint = opts.endpoint ?? DEFAULT_METRICS_ENDPOINT
|
|
86
114
|
const auth = opts.auth ?? null
|
|
115
|
+
const https = await sanitizeHTTPSOptions(opts.https)
|
|
87
116
|
|
|
88
|
-
const promServer = fastify({ name: 'Prometheus server', loggerInstance: runtime.logger })
|
|
117
|
+
const promServer = fastify({ name: 'Prometheus server', loggerInstance: runtime.logger, https })
|
|
89
118
|
promServer.register(fastifyAccepts)
|
|
90
119
|
|
|
91
120
|
let onRequestHook
|
package/lib/worker/controller.js
CHANGED
|
@@ -263,20 +263,22 @@ export class Controller extends EventEmitter {
|
|
|
263
263
|
const onHttpStatsFree = getOnHttpStatsFree({ throwOnMissing: false })
|
|
264
264
|
|
|
265
265
|
if (onHttpStatsFree && dispatcher?.stats) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
const
|
|
270
|
-
const
|
|
266
|
+
// The capability might come from an older version of @platformatic/basic
|
|
267
|
+
// which registered these globals without the fields tracking, so never throw.
|
|
268
|
+
const onHttpStatsConnected = getOnHttpStatsConnected({ throwOnMissing: false })
|
|
269
|
+
const onHttpStatsPending = getOnHttpStatsPending({ throwOnMissing: false })
|
|
270
|
+
const onHttpStatsQueued = getOnHttpStatsQueued({ throwOnMissing: false })
|
|
271
|
+
const onHttpStatsRunning = getOnHttpStatsRunning({ throwOnMissing: false })
|
|
272
|
+
const onHttpStatsSize = getOnHttpStatsSize({ throwOnMissing: false })
|
|
271
273
|
|
|
272
274
|
for (const url in dispatcher.stats) {
|
|
273
275
|
const { free, connected, pending, queued, running, size } = dispatcher.stats[url]
|
|
274
276
|
onHttpStatsFree(url, free || 0)
|
|
275
|
-
onHttpStatsConnected(url, connected || 0)
|
|
276
|
-
onHttpStatsPending(url, pending || 0)
|
|
277
|
-
onHttpStatsQueued(url, queued || 0)
|
|
278
|
-
onHttpStatsRunning(url, running || 0)
|
|
279
|
-
onHttpStatsSize(url, size || 0)
|
|
277
|
+
onHttpStatsConnected?.(url, connected || 0)
|
|
278
|
+
onHttpStatsPending?.(url, pending || 0)
|
|
279
|
+
onHttpStatsQueued?.(url, queued || 0)
|
|
280
|
+
onHttpStatsRunning?.(url, running || 0)
|
|
281
|
+
onHttpStatsSize?.(url, size || 0)
|
|
280
282
|
}
|
|
281
283
|
}
|
|
282
284
|
const onActiveResourcesEventLoop = getOnActiveResourcesEventLoop({ throwOnMissing: false })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/runtime",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.57.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@fastify/formbody": "^8.0.0",
|
|
21
21
|
"atomic-sleep": "^1.0.0",
|
|
22
22
|
"autocannon": "^8.0.0",
|
|
23
|
-
"c8": "^
|
|
23
|
+
"c8": "^11.0.0",
|
|
24
24
|
"cleaner-spec-reporter": "^0.5.0",
|
|
25
25
|
"eslint": "9",
|
|
26
26
|
"execa": "^9.0.0",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"typescript": "^5.5.4",
|
|
37
37
|
"undici-oidc-interceptor": "^0.5.0",
|
|
38
38
|
"why-is-node-running": "^2.2.2",
|
|
39
|
-
"@platformatic/
|
|
40
|
-
"@platformatic/
|
|
41
|
-
"@platformatic/
|
|
42
|
-
"@platformatic/gateway": "3.
|
|
43
|
-
"@platformatic/
|
|
44
|
-
"@platformatic/sql-
|
|
45
|
-
"@platformatic/
|
|
46
|
-
"@platformatic/
|
|
39
|
+
"@platformatic/db": "3.57.0",
|
|
40
|
+
"@platformatic/node": "3.57.0",
|
|
41
|
+
"@platformatic/composer": "3.57.0",
|
|
42
|
+
"@platformatic/gateway": "3.57.0",
|
|
43
|
+
"@platformatic/service": "3.57.0",
|
|
44
|
+
"@platformatic/sql-graphql": "3.57.0",
|
|
45
|
+
"@platformatic/wattpm-pprof-capture": "3.57.0",
|
|
46
|
+
"@platformatic/sql-mapper": "3.57.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@fastify/accepts": "^5.0.0",
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
"undici": "^7.27.2",
|
|
74
74
|
"undici-thread-interceptor": "^1.3.1",
|
|
75
75
|
"ws": "^8.16.0",
|
|
76
|
-
"@platformatic/basic": "3.
|
|
77
|
-
"@platformatic/
|
|
78
|
-
"@platformatic/
|
|
79
|
-
"@platformatic/
|
|
80
|
-
"@platformatic/itc": "3.
|
|
81
|
-
"@platformatic/
|
|
82
|
-
"@platformatic/
|
|
76
|
+
"@platformatic/basic": "3.57.0",
|
|
77
|
+
"@platformatic/globals": "3.57.0",
|
|
78
|
+
"@platformatic/generators": "3.57.0",
|
|
79
|
+
"@platformatic/foundation": "3.57.0",
|
|
80
|
+
"@platformatic/itc": "3.57.0",
|
|
81
|
+
"@platformatic/metrics": "3.57.0",
|
|
82
|
+
"@platformatic/telemetry": "3.57.0"
|
|
83
83
|
},
|
|
84
84
|
"engines": {
|
|
85
85
|
"node": ">=22.19.0"
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.57.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Runtime Config",
|
|
5
5
|
"type": "object",
|
|
@@ -2361,6 +2361,99 @@
|
|
|
2361
2361
|
"endpoint": {
|
|
2362
2362
|
"type": "string"
|
|
2363
2363
|
},
|
|
2364
|
+
"https": {
|
|
2365
|
+
"type": "object",
|
|
2366
|
+
"properties": {
|
|
2367
|
+
"allowHTTP1": {
|
|
2368
|
+
"type": "boolean"
|
|
2369
|
+
},
|
|
2370
|
+
"key": {
|
|
2371
|
+
"anyOf": [
|
|
2372
|
+
{
|
|
2373
|
+
"type": "string"
|
|
2374
|
+
},
|
|
2375
|
+
{
|
|
2376
|
+
"type": "object",
|
|
2377
|
+
"properties": {
|
|
2378
|
+
"path": {
|
|
2379
|
+
"type": "string",
|
|
2380
|
+
"resolvePath": true
|
|
2381
|
+
}
|
|
2382
|
+
},
|
|
2383
|
+
"additionalProperties": false
|
|
2384
|
+
},
|
|
2385
|
+
{
|
|
2386
|
+
"type": "array",
|
|
2387
|
+
"items": {
|
|
2388
|
+
"anyOf": [
|
|
2389
|
+
{
|
|
2390
|
+
"type": "string"
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
"type": "object",
|
|
2394
|
+
"properties": {
|
|
2395
|
+
"path": {
|
|
2396
|
+
"type": "string",
|
|
2397
|
+
"resolvePath": true
|
|
2398
|
+
}
|
|
2399
|
+
},
|
|
2400
|
+
"additionalProperties": false
|
|
2401
|
+
}
|
|
2402
|
+
]
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
]
|
|
2406
|
+
},
|
|
2407
|
+
"cert": {
|
|
2408
|
+
"anyOf": [
|
|
2409
|
+
{
|
|
2410
|
+
"type": "string"
|
|
2411
|
+
},
|
|
2412
|
+
{
|
|
2413
|
+
"type": "object",
|
|
2414
|
+
"properties": {
|
|
2415
|
+
"path": {
|
|
2416
|
+
"type": "string",
|
|
2417
|
+
"resolvePath": true
|
|
2418
|
+
}
|
|
2419
|
+
},
|
|
2420
|
+
"additionalProperties": false
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
"type": "array",
|
|
2424
|
+
"items": {
|
|
2425
|
+
"anyOf": [
|
|
2426
|
+
{
|
|
2427
|
+
"type": "string"
|
|
2428
|
+
},
|
|
2429
|
+
{
|
|
2430
|
+
"type": "object",
|
|
2431
|
+
"properties": {
|
|
2432
|
+
"path": {
|
|
2433
|
+
"type": "string",
|
|
2434
|
+
"resolvePath": true
|
|
2435
|
+
}
|
|
2436
|
+
},
|
|
2437
|
+
"additionalProperties": false
|
|
2438
|
+
}
|
|
2439
|
+
]
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
]
|
|
2443
|
+
},
|
|
2444
|
+
"requestCert": {
|
|
2445
|
+
"type": "boolean"
|
|
2446
|
+
},
|
|
2447
|
+
"rejectUnauthorized": {
|
|
2448
|
+
"type": "boolean"
|
|
2449
|
+
}
|
|
2450
|
+
},
|
|
2451
|
+
"additionalProperties": false,
|
|
2452
|
+
"required": [
|
|
2453
|
+
"key",
|
|
2454
|
+
"cert"
|
|
2455
|
+
]
|
|
2456
|
+
},
|
|
2364
2457
|
"auth": {
|
|
2365
2458
|
"type": "object",
|
|
2366
2459
|
"properties": {
|
|
@@ -2676,6 +2769,22 @@
|
|
|
2676
2769
|
"path": {
|
|
2677
2770
|
"type": "string",
|
|
2678
2771
|
"description": "The path to write the traces to. Only for file exporter."
|
|
2772
|
+
},
|
|
2773
|
+
"protocol": {
|
|
2774
|
+
"type": "string",
|
|
2775
|
+
"enum": [
|
|
2776
|
+
"http",
|
|
2777
|
+
"grpc"
|
|
2778
|
+
],
|
|
2779
|
+
"description": "The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http."
|
|
2780
|
+
},
|
|
2781
|
+
"transport": {
|
|
2782
|
+
"type": "string",
|
|
2783
|
+
"enum": [
|
|
2784
|
+
"http",
|
|
2785
|
+
"grpc"
|
|
2786
|
+
],
|
|
2787
|
+
"description": "Alias for protocol. Only for the otlp exporter. Defaults to http."
|
|
2679
2788
|
}
|
|
2680
2789
|
}
|
|
2681
2790
|
},
|
|
@@ -2712,6 +2821,22 @@
|
|
|
2712
2821
|
"path": {
|
|
2713
2822
|
"type": "string",
|
|
2714
2823
|
"description": "The path to write the traces to. Only for file exporter."
|
|
2824
|
+
},
|
|
2825
|
+
"protocol": {
|
|
2826
|
+
"type": "string",
|
|
2827
|
+
"enum": [
|
|
2828
|
+
"http",
|
|
2829
|
+
"grpc"
|
|
2830
|
+
],
|
|
2831
|
+
"description": "The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http."
|
|
2832
|
+
},
|
|
2833
|
+
"transport": {
|
|
2834
|
+
"type": "string",
|
|
2835
|
+
"enum": [
|
|
2836
|
+
"http",
|
|
2837
|
+
"grpc"
|
|
2838
|
+
],
|
|
2839
|
+
"description": "Alias for protocol. Only for the otlp exporter. Defaults to http."
|
|
2715
2840
|
}
|
|
2716
2841
|
}
|
|
2717
2842
|
},
|