@platformatic/service 3.13.1 → 3.15.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 +63 -3
- package/lib/capability.js +3 -5
- package/package.json +7 -7
- package/schema.json +135 -17
package/config.d.ts
CHANGED
|
@@ -313,7 +313,20 @@ export interface PlatformaticServiceConfig {
|
|
|
313
313
|
services?: {
|
|
314
314
|
[k: string]: unknown;
|
|
315
315
|
}[];
|
|
316
|
-
workers?:
|
|
316
|
+
workers?:
|
|
317
|
+
| number
|
|
318
|
+
| string
|
|
319
|
+
| {
|
|
320
|
+
static?: number;
|
|
321
|
+
dynamic?: boolean;
|
|
322
|
+
minimum?: number;
|
|
323
|
+
maximum?: number;
|
|
324
|
+
total?: number;
|
|
325
|
+
maxMemory?: number;
|
|
326
|
+
cooldown?: number;
|
|
327
|
+
gracePeriod?: number;
|
|
328
|
+
[k: string]: unknown;
|
|
329
|
+
};
|
|
317
330
|
workersRestartDelay?: number | string;
|
|
318
331
|
logger?: {
|
|
319
332
|
level: (
|
|
@@ -397,6 +410,7 @@ export interface PlatformaticServiceConfig {
|
|
|
397
410
|
rejectUnauthorized?: boolean;
|
|
398
411
|
};
|
|
399
412
|
};
|
|
413
|
+
reuseTcpPorts?: boolean;
|
|
400
414
|
startTimeout?: number;
|
|
401
415
|
restartOnError?: boolean | number;
|
|
402
416
|
exitOnUnhandledErrors?: boolean;
|
|
@@ -521,6 +535,37 @@ export interface PlatformaticServiceConfig {
|
|
|
521
535
|
};
|
|
522
536
|
plugins?: string[];
|
|
523
537
|
timeout?: number | string;
|
|
538
|
+
/**
|
|
539
|
+
* Configuration for exporting metrics to an OTLP endpoint
|
|
540
|
+
*/
|
|
541
|
+
otlpExporter?: {
|
|
542
|
+
/**
|
|
543
|
+
* Enable or disable OTLP metrics export
|
|
544
|
+
*/
|
|
545
|
+
enabled?: boolean | string;
|
|
546
|
+
/**
|
|
547
|
+
* OTLP endpoint URL (e.g., http://collector:4318/v1/metrics)
|
|
548
|
+
*/
|
|
549
|
+
endpoint: string;
|
|
550
|
+
/**
|
|
551
|
+
* Interval in milliseconds between metric pushes
|
|
552
|
+
*/
|
|
553
|
+
interval?: number | string;
|
|
554
|
+
/**
|
|
555
|
+
* Additional HTTP headers for authentication
|
|
556
|
+
*/
|
|
557
|
+
headers?: {
|
|
558
|
+
[k: string]: string;
|
|
559
|
+
};
|
|
560
|
+
/**
|
|
561
|
+
* Service name for OTLP resource attributes
|
|
562
|
+
*/
|
|
563
|
+
serviceName?: string;
|
|
564
|
+
/**
|
|
565
|
+
* Service version for OTLP resource attributes
|
|
566
|
+
*/
|
|
567
|
+
serviceVersion?: string;
|
|
568
|
+
};
|
|
524
569
|
};
|
|
525
570
|
telemetry?: {
|
|
526
571
|
enabled?: boolean | string;
|
|
@@ -604,13 +649,28 @@ export interface PlatformaticServiceConfig {
|
|
|
604
649
|
maxTotalMemory?: number;
|
|
605
650
|
minWorkers?: number;
|
|
606
651
|
maxWorkers?: number;
|
|
652
|
+
cooldownSec?: number;
|
|
653
|
+
gracePeriod?: number;
|
|
654
|
+
/**
|
|
655
|
+
* @deprecated
|
|
656
|
+
*/
|
|
607
657
|
scaleUpELU?: number;
|
|
658
|
+
/**
|
|
659
|
+
* @deprecated
|
|
660
|
+
*/
|
|
608
661
|
scaleDownELU?: number;
|
|
662
|
+
/**
|
|
663
|
+
* @deprecated
|
|
664
|
+
*/
|
|
609
665
|
timeWindowSec?: number;
|
|
666
|
+
/**
|
|
667
|
+
* @deprecated
|
|
668
|
+
*/
|
|
610
669
|
scaleDownTimeWindowSec?: number;
|
|
611
|
-
|
|
670
|
+
/**
|
|
671
|
+
* @deprecated
|
|
672
|
+
*/
|
|
612
673
|
scaleIntervalSec?: number;
|
|
613
|
-
gracePeriod?: number;
|
|
614
674
|
};
|
|
615
675
|
inspectorOptions?: {
|
|
616
676
|
host?: string;
|
package/lib/capability.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCapability, cleanBasePath, ensureTrailingSlash, getServerUrl } from '@platformatic/basic'
|
|
2
|
-
import { buildPinoFormatters, buildPinoTimestamp, deepmerge,
|
|
2
|
+
import { buildPinoFormatters, buildPinoTimestamp, deepmerge, isKeyEnabled } from '@platformatic/foundation'
|
|
3
3
|
import { telemetry } from '@platformatic/telemetry'
|
|
4
4
|
import fastify from 'fastify'
|
|
5
5
|
import { printSchema } from 'graphql'
|
|
@@ -69,6 +69,8 @@ export class ServiceCapability extends BaseCapability {
|
|
|
69
69
|
return this.url
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
await super._start()
|
|
73
|
+
|
|
72
74
|
// Create the application if needed
|
|
73
75
|
if (!this.#app) {
|
|
74
76
|
await this.init()
|
|
@@ -264,10 +266,6 @@ export class ServiceCapability extends BaseCapability {
|
|
|
264
266
|
const serverOptions = this.serverConfig
|
|
265
267
|
const listenOptions = { host: serverOptions?.hostname || '127.0.0.1', port: serverOptions?.port || 0 }
|
|
266
268
|
|
|
267
|
-
if (this.isProduction && features.node.reusePort) {
|
|
268
|
-
listenOptions.reusePort = true
|
|
269
|
-
}
|
|
270
|
-
|
|
271
269
|
await this.#app.listen(listenOptions)
|
|
272
270
|
this.url = getServerUrl(this.#app.server)
|
|
273
271
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/service",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
"rfdc": "^1.3.1",
|
|
68
68
|
"semgrator": "^0.3.0",
|
|
69
69
|
"undici": "^7.0.0",
|
|
70
|
-
"@platformatic/basic": "3.
|
|
71
|
-
"@platformatic/
|
|
72
|
-
"@platformatic/
|
|
73
|
-
"@platformatic/metrics": "3.
|
|
74
|
-
"@platformatic/
|
|
75
|
-
"@platformatic/
|
|
70
|
+
"@platformatic/basic": "3.15.0",
|
|
71
|
+
"@platformatic/generators": "3.15.0",
|
|
72
|
+
"@platformatic/scalar-theme": "3.15.0",
|
|
73
|
+
"@platformatic/metrics": "3.15.0",
|
|
74
|
+
"@platformatic/telemetry": "3.15.0",
|
|
75
|
+
"@platformatic/foundation": "3.15.0"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": ">=22.19.0"
|
package/schema.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/service/3.
|
|
3
|
-
"version": "3.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/service/3.15.0.json",
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"title": "Platformatic Service Config",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
@@ -1054,14 +1054,34 @@
|
|
|
1054
1054
|
"useHttp": {
|
|
1055
1055
|
"type": "boolean"
|
|
1056
1056
|
},
|
|
1057
|
+
"reuseTcpPorts": {
|
|
1058
|
+
"type": "boolean",
|
|
1059
|
+
"default": true
|
|
1060
|
+
},
|
|
1057
1061
|
"workers": {
|
|
1058
1062
|
"anyOf": [
|
|
1059
1063
|
{
|
|
1060
|
-
"type": "number"
|
|
1061
|
-
"minimum": 1
|
|
1064
|
+
"type": "number"
|
|
1062
1065
|
},
|
|
1063
1066
|
{
|
|
1064
1067
|
"type": "string"
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
"type": "object",
|
|
1071
|
+
"properties": {
|
|
1072
|
+
"static": {
|
|
1073
|
+
"type": "number",
|
|
1074
|
+
"minimum": 1
|
|
1075
|
+
},
|
|
1076
|
+
"minimum": {
|
|
1077
|
+
"type": "number",
|
|
1078
|
+
"minimum": 1
|
|
1079
|
+
},
|
|
1080
|
+
"maximum": {
|
|
1081
|
+
"type": "number",
|
|
1082
|
+
"minimum": 0
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1065
1085
|
}
|
|
1066
1086
|
]
|
|
1067
1087
|
},
|
|
@@ -1282,6 +1302,43 @@
|
|
|
1282
1302
|
},
|
|
1283
1303
|
{
|
|
1284
1304
|
"type": "string"
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
"type": "object",
|
|
1308
|
+
"properties": {
|
|
1309
|
+
"static": {
|
|
1310
|
+
"type": "number",
|
|
1311
|
+
"minimum": 1
|
|
1312
|
+
},
|
|
1313
|
+
"dynamic": {
|
|
1314
|
+
"type": "boolean",
|
|
1315
|
+
"default": false
|
|
1316
|
+
},
|
|
1317
|
+
"minimum": {
|
|
1318
|
+
"type": "number",
|
|
1319
|
+
"minimum": 1
|
|
1320
|
+
},
|
|
1321
|
+
"maximum": {
|
|
1322
|
+
"type": "number",
|
|
1323
|
+
"minimum": 0
|
|
1324
|
+
},
|
|
1325
|
+
"total": {
|
|
1326
|
+
"type": "number",
|
|
1327
|
+
"minimum": 1
|
|
1328
|
+
},
|
|
1329
|
+
"maxMemory": {
|
|
1330
|
+
"type": "number",
|
|
1331
|
+
"minimum": 0
|
|
1332
|
+
},
|
|
1333
|
+
"cooldown": {
|
|
1334
|
+
"type": "number",
|
|
1335
|
+
"minimum": 0
|
|
1336
|
+
},
|
|
1337
|
+
"gracePeriod": {
|
|
1338
|
+
"type": "number",
|
|
1339
|
+
"minimum": 0
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1285
1342
|
}
|
|
1286
1343
|
]
|
|
1287
1344
|
},
|
|
@@ -1567,6 +1624,10 @@
|
|
|
1567
1624
|
},
|
|
1568
1625
|
"additionalProperties": false
|
|
1569
1626
|
},
|
|
1627
|
+
"reuseTcpPorts": {
|
|
1628
|
+
"type": "boolean",
|
|
1629
|
+
"default": true
|
|
1630
|
+
},
|
|
1570
1631
|
"startTimeout": {
|
|
1571
1632
|
"default": 30000,
|
|
1572
1633
|
"type": "number",
|
|
@@ -2058,6 +2119,58 @@
|
|
|
2058
2119
|
}
|
|
2059
2120
|
],
|
|
2060
2121
|
"default": 10000
|
|
2122
|
+
},
|
|
2123
|
+
"otlpExporter": {
|
|
2124
|
+
"type": "object",
|
|
2125
|
+
"description": "Configuration for exporting metrics to an OTLP endpoint",
|
|
2126
|
+
"properties": {
|
|
2127
|
+
"enabled": {
|
|
2128
|
+
"anyOf": [
|
|
2129
|
+
{
|
|
2130
|
+
"type": "boolean"
|
|
2131
|
+
},
|
|
2132
|
+
{
|
|
2133
|
+
"type": "string"
|
|
2134
|
+
}
|
|
2135
|
+
],
|
|
2136
|
+
"description": "Enable or disable OTLP metrics export"
|
|
2137
|
+
},
|
|
2138
|
+
"endpoint": {
|
|
2139
|
+
"type": "string",
|
|
2140
|
+
"description": "OTLP endpoint URL (e.g., http://collector:4318/v1/metrics)"
|
|
2141
|
+
},
|
|
2142
|
+
"interval": {
|
|
2143
|
+
"anyOf": [
|
|
2144
|
+
{
|
|
2145
|
+
"type": "integer"
|
|
2146
|
+
},
|
|
2147
|
+
{
|
|
2148
|
+
"type": "string"
|
|
2149
|
+
}
|
|
2150
|
+
],
|
|
2151
|
+
"default": 60000,
|
|
2152
|
+
"description": "Interval in milliseconds between metric pushes"
|
|
2153
|
+
},
|
|
2154
|
+
"headers": {
|
|
2155
|
+
"type": "object",
|
|
2156
|
+
"additionalProperties": {
|
|
2157
|
+
"type": "string"
|
|
2158
|
+
},
|
|
2159
|
+
"description": "Additional HTTP headers for authentication"
|
|
2160
|
+
},
|
|
2161
|
+
"serviceName": {
|
|
2162
|
+
"type": "string",
|
|
2163
|
+
"description": "Service name for OTLP resource attributes"
|
|
2164
|
+
},
|
|
2165
|
+
"serviceVersion": {
|
|
2166
|
+
"type": "string",
|
|
2167
|
+
"description": "Service version for OTLP resource attributes"
|
|
2168
|
+
}
|
|
2169
|
+
},
|
|
2170
|
+
"required": [
|
|
2171
|
+
"endpoint"
|
|
2172
|
+
],
|
|
2173
|
+
"additionalProperties": false
|
|
2061
2174
|
}
|
|
2062
2175
|
},
|
|
2063
2176
|
"additionalProperties": false
|
|
@@ -2217,35 +2330,40 @@
|
|
|
2217
2330
|
"type": "number",
|
|
2218
2331
|
"minimum": 1
|
|
2219
2332
|
},
|
|
2333
|
+
"cooldownSec": {
|
|
2334
|
+
"type": "number",
|
|
2335
|
+
"minimum": 0
|
|
2336
|
+
},
|
|
2337
|
+
"gracePeriod": {
|
|
2338
|
+
"type": "number",
|
|
2339
|
+
"minimum": 0
|
|
2340
|
+
},
|
|
2220
2341
|
"scaleUpELU": {
|
|
2221
2342
|
"type": "number",
|
|
2222
2343
|
"minimum": 0,
|
|
2223
|
-
"maximum": 1
|
|
2344
|
+
"maximum": 1,
|
|
2345
|
+
"deprecated": true
|
|
2224
2346
|
},
|
|
2225
2347
|
"scaleDownELU": {
|
|
2226
2348
|
"type": "number",
|
|
2227
2349
|
"minimum": 0,
|
|
2228
|
-
"maximum": 1
|
|
2350
|
+
"maximum": 1,
|
|
2351
|
+
"deprecated": true
|
|
2229
2352
|
},
|
|
2230
2353
|
"timeWindowSec": {
|
|
2231
2354
|
"type": "number",
|
|
2232
|
-
"minimum": 0
|
|
2355
|
+
"minimum": 0,
|
|
2356
|
+
"deprecated": true
|
|
2233
2357
|
},
|
|
2234
2358
|
"scaleDownTimeWindowSec": {
|
|
2235
2359
|
"type": "number",
|
|
2236
|
-
"minimum": 0
|
|
2237
|
-
|
|
2238
|
-
"cooldownSec": {
|
|
2239
|
-
"type": "number",
|
|
2240
|
-
"minimum": 0
|
|
2360
|
+
"minimum": 0,
|
|
2361
|
+
"deprecated": true
|
|
2241
2362
|
},
|
|
2242
2363
|
"scaleIntervalSec": {
|
|
2243
2364
|
"type": "number",
|
|
2244
|
-
"minimum": 0
|
|
2245
|
-
|
|
2246
|
-
"gracePeriod": {
|
|
2247
|
-
"type": "number",
|
|
2248
|
-
"minimum": 0
|
|
2365
|
+
"minimum": 0,
|
|
2366
|
+
"deprecated": true
|
|
2249
2367
|
}
|
|
2250
2368
|
},
|
|
2251
2369
|
"additionalProperties": false
|