@platformatic/runtime 3.72.0 → 4.0.0-alpha.1

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 CHANGED
@@ -10,138 +10,111 @@ export type PlatformaticRuntimeConfig = {
10
10
  } & {
11
11
  $schema?: string;
12
12
  preload?: string | string[];
13
- extensions?:
14
- | string
15
- | {
16
- path: string;
17
- options?: {
18
- [k: string]: unknown;
19
- };
20
- build?: boolean;
21
- }
22
- | (
23
- | string
24
- | {
25
- path: string;
26
- options?: {
27
- [k: string]: unknown;
28
- };
29
- build?: boolean;
30
- }
31
- )[];
32
- entrypoint?: string;
13
+ extensions?: string | ExtensionEntry | (string | ExtensionEntry1)[];
33
14
  basePath?: string;
34
15
  autoload?: {
35
16
  path: string;
36
17
  exclude?: string[];
37
18
  mappings?: {
38
- [k: string]: {
39
- id: string;
40
- enabled?:
41
- | boolean
42
- | string
43
- | {
44
- [k: string]: boolean;
45
- };
46
- config?: string;
47
- useHttp?: boolean;
48
- websocket?: boolean;
49
- reuseTcpPorts?: boolean;
50
- workers?:
51
- | number
52
- | string
53
- | {
54
- static?: number;
55
- minimum?: number;
56
- maximum?: number;
57
- scaleUpELU?: number;
58
- scaleDownELU?: number;
59
- [k: string]: unknown;
60
- };
61
- health?: {
62
- enabled?: boolean | string;
63
- interval?: number | string;
64
- gracePeriod?: number | string;
65
- maxUnhealthyChecks?: number | string;
66
- maxELU?: number | string;
67
- maxEventLoopDelay?: number | string;
68
- maxEventLoopDelayP99?: number | string;
69
- maxHeapUsed?: number | string;
70
- maxHeapTotal?: number | string;
71
- maxYoungGeneration?: number | string;
72
- codeRangeSize?: number | string;
73
- bufferPoolSize?: number | string;
74
- defaultHighWaterMark?: number | string;
75
- };
76
- /**
77
- * Overrides the runtime-level restartOnError for this application. Set to false or 0 to never restart the application when it crashes, a positive number to wait that amount of milliseconds between restarts, or true to use the default delay.
78
- */
79
- restartOnError?: boolean | number;
80
- dependencies?: string[];
81
- arguments?: string[];
82
- env?: {
83
- [k: string]: string;
84
- };
85
- envfile?: string;
86
- sourceMaps?: boolean;
87
- nodeModulesSourceMaps?: string[];
88
- packageManager?: "npm" | "pnpm" | "yarn";
89
- preload?: string | string[];
90
- nodeOptions?: string;
91
- execArgv?: string[];
92
- permissions?: {
93
- fs?: {
94
- read?: string[];
95
- write?: string[];
96
- };
97
- };
98
- telemetry?: {
99
- /**
100
- * An array of instrumentations loaded if telemetry is enabled
101
- */
102
- instrumentations?: (
103
- | string
104
- | {
105
- package: string;
106
- exportName?: string;
107
- options?: {
108
- [k: string]: unknown;
109
- };
110
- [k: string]: unknown;
111
- }
112
- )[];
113
- [k: string]: unknown;
114
- };
115
- compileCache?:
116
- | boolean
117
- | {
118
- /**
119
- * Enable Node.js module compile cache for faster startup
120
- */
121
- enabled?: boolean;
122
- /**
123
- * Directory to store compile cache. Defaults to .plt/compile-cache in app root
124
- */
125
- directory?: string;
126
- };
127
- management?:
128
- | boolean
129
- | {
130
- enabled?: boolean;
131
- operations?: string[];
132
- };
133
- };
19
+ [k: string]: ApplicationEntryOverrides;
134
20
  };
135
21
  };
136
- applications?: {
22
+ applications?: ApplicationEntry[];
23
+ services?: ApplicationEntry1[];
24
+ web?: ApplicationEntry2[];
25
+ workers?: number | string | WorkersOptions;
26
+ workersRestartDelay?: number | string;
27
+ logger?: RuntimeLoggerOptions;
28
+ reuseTcpPorts?: boolean;
29
+ startTimeout?: number;
30
+ restartOnError?: boolean | number;
31
+ exitOnUnhandledErrors?: boolean | number;
32
+ gracefulShutdown?: GracefulShutdownOptions;
33
+ health?: HealthOptions;
34
+ healthProbes?: boolean | string | HealthProbesOptions;
35
+ undici?: UndiciOptions;
36
+ httpCache?: boolean | HttpCacheOptions;
37
+ watch?: boolean | string;
38
+ managementApi?: boolean | string | ManagementApiOptions;
39
+ management?:
40
+ | boolean
41
+ | {
42
+ enabled?: boolean;
43
+ operations?: string[];
44
+ };
45
+ metrics?: boolean | MetricsOptions;
46
+ tracing?: TelemetryOptions;
47
+ inspectorOptions?: {
48
+ host?: string;
49
+ port?: number;
50
+ breakFirstLine?: boolean;
51
+ watchDisabled?: boolean;
137
52
  [k: string]: unknown;
138
- }[];
139
- services?: {
53
+ };
54
+ applicationTimeout?: number | string;
55
+ startupConcurrency?: number | string;
56
+ messagingTimeout?: number | string;
57
+ resolvedApplicationsBasePath?: string;
58
+ env?: {
59
+ [k: string]: string;
60
+ };
61
+ envfile?: string;
62
+ /**
63
+ * When set to true, the configuration loading fails if a {PLT_*} placeholder references an environment variable which is not set. When set to "warn", a warning listing the missing variables is logged but the placeholders are still replaced with an empty string. Defaults to false.
64
+ */
65
+ strictEnv?: boolean | string;
66
+ sourceMaps?: boolean;
67
+ nodeModulesSourceMaps?: string[];
68
+ policies?: {
69
+ deny: {
70
+ /**
71
+ * This interface was referenced by `undefined`'s JSON-Schema definition
72
+ * via the `patternProperty` "^.*$".
73
+ */
74
+ [k: string]: string | [string, ...string[]];
75
+ };
76
+ };
77
+ compileCache?: boolean | CompileCacheOptions;
78
+ module?: string;
79
+ };
80
+ export type ApplicationEntry = {
81
+ [k: string]: unknown;
82
+ };
83
+ export type ApplicationEntry1 = {
84
+ [k: string]: unknown;
85
+ };
86
+ export type ApplicationEntry2 = {
87
+ [k: string]: unknown;
88
+ };
89
+
90
+ export interface ExtensionEntry {
91
+ path: string;
92
+ options?: {
140
93
  [k: string]: unknown;
141
- }[];
142
- web?: {
94
+ };
95
+ build?: boolean;
96
+ }
97
+ export interface ExtensionEntry1 {
98
+ path: string;
99
+ options?: {
143
100
  [k: string]: unknown;
144
- }[];
101
+ };
102
+ build?: boolean;
103
+ }
104
+ export interface ApplicationEntryOverrides {
105
+ id: string;
106
+ enabled?:
107
+ | boolean
108
+ | string
109
+ | {
110
+ [k: string]: boolean;
111
+ };
112
+ config?:
113
+ | string
114
+ | {
115
+ [k: string]: unknown;
116
+ };
117
+ reuseTcpPorts?: boolean;
145
118
  workers?:
146
119
  | number
147
120
  | string
@@ -150,639 +123,595 @@ export type PlatformaticRuntimeConfig = {
150
123
  dynamic?: boolean;
151
124
  minimum?: number;
152
125
  maximum?: number;
153
- total?: number;
154
- maxMemory?: number;
155
- cooldown?: number;
156
- gracePeriod?: number;
157
- scaleUpELU?: number;
158
- scaleDownELU?: number;
159
- [k: string]: unknown;
126
+ eluThreshold?: number;
127
+ heapThresholdMb?: number;
160
128
  };
161
- workersRestartDelay?: number | string;
162
- logger?: {
129
+ health?: {
130
+ enabled?: boolean | string;
131
+ interval?: number | string;
132
+ gracePeriod?: number | string;
133
+ maxUnhealthyChecks?: number | string;
134
+ maxELU?: number | string;
135
+ maxEventLoopDelay?: number | string;
136
+ maxEventLoopDelayP99?: number | string;
137
+ maxHeapUsed?: number | string;
138
+ maxHeapTotal?: number | string;
139
+ maxYoungGeneration?: number | string;
140
+ codeRangeSize?: number | string;
141
+ bufferPoolSize?: number | string;
142
+ defaultHighWaterMark?: number | string;
143
+ };
144
+ /**
145
+ * Overrides the runtime-level restartOnError for this application. Set to false or 0 to never restart the application when it crashes, a positive number to wait that amount of milliseconds between restarts, or true to use the default delay.
146
+ */
147
+ restartOnError?: boolean | number;
148
+ dependencies?: string[];
149
+ arguments?: string[];
150
+ env?: {
151
+ [k: string]: string;
152
+ };
153
+ envfile?: string;
154
+ sourceMaps?: boolean;
155
+ nodeModulesSourceMaps?: string[];
156
+ packageManager?: "npm" | "pnpm" | "yarn";
157
+ preload?: string | string[];
158
+ nodeOptions?: string;
159
+ execArgv?: string[];
160
+ permissions?: {
161
+ fs?: {
162
+ read?: string[];
163
+ write?: string[];
164
+ };
165
+ };
166
+ tracing?: {
163
167
  /**
164
- * The log level. It must be one of the standard pino levels (fatal, error, warn, info, debug, trace, silent) or, when customLevels is set, one of the custom levels.
168
+ * An array of instrumentations loaded if tracing is enabled
165
169
  */
166
- level?: string;
167
- transport?:
170
+ instrumentations?: (
171
+ | string
168
172
  | {
169
- target?: string;
173
+ package: string;
174
+ exportName?: string;
170
175
  options?: {
171
176
  [k: string]: unknown;
172
177
  };
178
+ [k: string]: unknown;
173
179
  }
174
- | {
175
- targets?: {
176
- target?: string;
177
- options?: {
178
- [k: string]: unknown;
179
- };
180
- level?: string;
181
- }[];
180
+ )[];
181
+ [k: string]: unknown;
182
+ };
183
+ compileCache?:
184
+ | boolean
185
+ | {
186
+ /**
187
+ * Enable Node.js module compile cache for faster startup
188
+ */
189
+ enabled?: boolean;
190
+ /**
191
+ * Directory to store compile cache. Defaults to .plt/compile-cache in app root
192
+ */
193
+ directory?: string;
194
+ /**
195
+ * Wait for the first worker to start before starting the remaining workers
196
+ */
197
+ awaitFirstWorker?: boolean;
198
+ };
199
+ management?:
200
+ | boolean
201
+ | {
202
+ enabled?: boolean;
203
+ operations?: string[];
204
+ };
205
+ }
206
+ export interface WorkersOptions {
207
+ static?: number;
208
+ dynamic?: boolean;
209
+ minimum?: number;
210
+ maximum?: number;
211
+ total?: number;
212
+ maxMemory?: number;
213
+ eluThreshold?: number;
214
+ heapThresholdMb?: number;
215
+ processIntervalMs?: number;
216
+ maxScaleUpStep?: number;
217
+ redistributionMs?: number;
218
+ alphaUp?: number;
219
+ alphaDown?: number;
220
+ betaUp?: number;
221
+ betaDown?: number;
222
+ cooldowns?: {
223
+ scaleUpAfterScaleUpMs?: number;
224
+ scaleUpAfterScaleDownMs?: number;
225
+ scaleDownAfterScaleUpMs?: number;
226
+ scaleDownAfterScaleDownMs?: number;
227
+ };
228
+ }
229
+ export interface RuntimeLoggerOptions {
230
+ /**
231
+ * A standard Pino log level or a level defined in customLevels.
232
+ */
233
+ level?: string;
234
+ transport?:
235
+ | {
236
+ target?: string;
237
+ options?: {
238
+ [k: string]: unknown;
239
+ };
240
+ }
241
+ | {
242
+ targets?: {
243
+ target?: string;
182
244
  options?: {
183
245
  [k: string]: unknown;
184
246
  };
247
+ level?: string;
248
+ }[];
249
+ options?: {
250
+ [k: string]: unknown;
185
251
  };
186
- pipeline?: {
187
- target?: string;
188
- options?: {
189
- [k: string]: unknown;
190
252
  };
191
- };
192
- formatters?: {
193
- path: string;
194
- };
195
- timestamp?: "epochTime" | "unixTime" | "nullTime" | "isoTime";
196
- redact?: {
197
- paths: string[];
198
- censor?: string;
199
- /**
200
- * Remove the redacted keys entirely instead of replacing their values with the censor. Defaults to false.
201
- */
202
- remove?: boolean;
203
- };
204
- base?: {
205
- [k: string]: unknown;
206
- } | null;
207
- messageKey?: string;
208
- customLevels?: {
253
+ pipeline?: {
254
+ target?: string;
255
+ options?: {
209
256
  [k: string]: unknown;
210
257
  };
258
+ };
259
+ formatters?: {
260
+ path: string;
261
+ };
262
+ timestamp?: "epochTime" | "unixTime" | "nullTime" | "isoTime";
263
+ redact?: {
264
+ paths: string[];
265
+ censor?: string;
211
266
  /**
212
- * The numeric value of the level defined in level, when it is not one of the standard pino levels.
267
+ * Remove the redacted keys entirely instead of replacing their values with the censor. Defaults to false.
213
268
  */
214
- levelVal?: number;
269
+ remove?: boolean;
270
+ };
271
+ base?: {
272
+ [k: string]: unknown;
273
+ } | null;
274
+ messageKey?: string;
275
+ customLevels?: {
276
+ [k: string]: unknown;
277
+ };
278
+ /**
279
+ * The numeric value of the level defined in level, when it is not one of the standard pino levels.
280
+ */
281
+ levelVal?: number;
282
+ /**
283
+ * Only use the levels defined in customLevels and omit the standard pino ones.
284
+ */
285
+ useOnlyCustomLevels?: boolean;
286
+ /**
287
+ * How log levels are compared to the logger level. Use DESC when lower values are more severe. Defaults to ASC.
288
+ */
289
+ levelComparison?: "ASC" | "DESC";
290
+ /**
291
+ * A string prefixed to every message, including the ones of child loggers.
292
+ */
293
+ msgPrefix?: string;
294
+ /**
295
+ * The key under which any logged object is placed.
296
+ */
297
+ nestedKey?: string;
298
+ /**
299
+ * The key used for the serialized error in the log object. Defaults to err.
300
+ */
301
+ errorKey?: string;
302
+ /**
303
+ * The stringification limit at a specific nesting depth when logging circular objects. Defaults to 5.
304
+ */
305
+ depthLimit?: number;
306
+ /**
307
+ * The stringification limit of properties or elements when logging a circular object or array. Defaults to 100.
308
+ */
309
+ edgeLimit?: number;
310
+ /**
311
+ * Terminate each log line with \r\n instead of \n. Defaults to false.
312
+ */
313
+ crlf?: boolean;
314
+ /**
315
+ * Set to false to disable logging entirely. Defaults to true.
316
+ */
317
+ enabled?: boolean;
318
+ openTelemetryExporter?: {
319
+ protocol: "grpc" | "http";
320
+ url: string;
321
+ };
322
+ captureStdio?: boolean;
323
+ pino?: {
324
+ level?: string;
325
+ time?: string;
326
+ message?: string;
327
+ };
328
+ [k: string]: unknown;
329
+ }
330
+ export interface GracefulShutdownOptions {
331
+ runtime: number | string;
332
+ application: number | string;
333
+ /**
334
+ * Add Connection: close header to HTTP responses during graceful shutdown
335
+ */
336
+ closeConnections?: boolean;
337
+ }
338
+ export interface HealthOptions {
339
+ enabled?: boolean | string;
340
+ interval?: number | string;
341
+ gracePeriod?: number | string;
342
+ maxUnhealthyChecks?: number | string;
343
+ maxELU?: number | string;
344
+ maxEventLoopDelay?: number | string;
345
+ maxEventLoopDelayP99?: number | string;
346
+ maxHeapUsed?: number | string;
347
+ maxHeapTotal?: number | string;
348
+ maxYoungGeneration?: number | string;
349
+ codeRangeSize?: number | string;
350
+ bufferPoolSize?: number | string;
351
+ defaultHighWaterMark?: number | string;
352
+ }
353
+ export interface HealthProbesOptions {
354
+ enabled?: boolean | string;
355
+ hostname?: string;
356
+ port?: number | string;
357
+ readiness?:
358
+ | boolean
359
+ | {
360
+ endpoint?: string;
361
+ success?: {
362
+ statusCode?: number;
363
+ body?: string;
364
+ };
365
+ fail?: {
366
+ statusCode?: number;
367
+ body?: string;
368
+ };
369
+ };
370
+ liveness?:
371
+ | boolean
372
+ | {
373
+ endpoint?: string;
374
+ success?: {
375
+ statusCode?: number;
376
+ body?: string;
377
+ };
378
+ fail?: {
379
+ statusCode?: number;
380
+ body?: string;
381
+ };
382
+ };
383
+ }
384
+ export interface UndiciOptions {
385
+ agentOptions?: {
386
+ [k: string]: unknown;
387
+ };
388
+ interceptors?:
389
+ | {
390
+ module: string;
391
+ options: {
392
+ [k: string]: unknown;
393
+ };
394
+ [k: string]: unknown;
395
+ }[]
396
+ | {
397
+ Client?: {
398
+ module: string;
399
+ options: {
400
+ [k: string]: unknown;
401
+ };
402
+ [k: string]: unknown;
403
+ }[];
404
+ Pool?: {
405
+ module: string;
406
+ options: {
407
+ [k: string]: unknown;
408
+ };
409
+ [k: string]: unknown;
410
+ }[];
411
+ Agent?: {
412
+ module: string;
413
+ options: {
414
+ [k: string]: unknown;
415
+ };
416
+ [k: string]: unknown;
417
+ }[];
418
+ [k: string]: unknown;
419
+ };
420
+ [k: string]: unknown;
421
+ }
422
+ export interface HttpCacheOptions {
423
+ store?: string;
424
+ /**
425
+ * @minItems 1
426
+ */
427
+ methods?: [string, ...string[]];
428
+ cacheTagsHeader?: string;
429
+ maxSize?: number;
430
+ maxEntrySize?: number;
431
+ maxCount?: number;
432
+ /**
433
+ * Whitelist of origins to cache. Supports exact strings and regex patterns (e.g., "/https:\\/\\/.*\\.example\\.com/").
434
+ */
435
+ origins?: string[];
436
+ /**
437
+ * Default cache duration in seconds for responses without explicit expiration headers.
438
+ */
439
+ cacheByDefault?: number;
440
+ /**
441
+ * Cache type. "shared" caches may be shared between users, "private" caches are user-specific.
442
+ */
443
+ type?: "shared" | "private";
444
+ [k: string]: unknown;
445
+ }
446
+ export interface ManagementApiOptions {
447
+ logs?: {
448
+ maxSize?: number;
449
+ };
450
+ /**
451
+ * Custom path for the control socket. If not specified, uses the default platform-specific location.
452
+ */
453
+ socket?: string;
454
+ }
455
+ export interface MetricsOptions {
456
+ port?: number | string;
457
+ enabled?: boolean | string;
458
+ hostname?: string;
459
+ endpoint?: string;
460
+ https?: HttpsOptions;
461
+ auth?: {
462
+ username: string;
463
+ password: string;
464
+ };
465
+ labels?: {
466
+ [k: string]: string;
467
+ };
468
+ /**
469
+ * The label name to use for the application identifier in metrics (e.g., applicationId, serviceId)
470
+ */
471
+ applicationLabel?: string;
472
+ /**
473
+ * Enable outgoing HTTP client request duration metrics
474
+ */
475
+ httpClientMetrics?: boolean | string;
476
+ readiness?:
477
+ | boolean
478
+ | {
479
+ endpoint?: string;
480
+ success?: {
481
+ statusCode?: number;
482
+ body?: string;
483
+ };
484
+ fail?: {
485
+ statusCode?: number;
486
+ body?: string;
487
+ };
488
+ };
489
+ liveness?:
490
+ | boolean
491
+ | {
492
+ endpoint?: string;
493
+ success?: {
494
+ statusCode?: number;
495
+ body?: string;
496
+ };
497
+ fail?: {
498
+ statusCode?: number;
499
+ body?: string;
500
+ };
501
+ };
502
+ /**
503
+ * @deprecated
504
+ * Deprecated. Health probe timeout configuration is no longer used.
505
+ */
506
+ healthChecksTimeouts?: number | string;
507
+ plugins?: string[];
508
+ timeout?: number | string;
509
+ /**
510
+ * Configuration for exporting metrics to an OTLP endpoint
511
+ */
512
+ otlpExporter?: {
513
+ /**
514
+ * Enable or disable OTLP metrics export
515
+ */
516
+ enabled?: boolean | string;
215
517
  /**
216
- * Only use the levels defined in customLevels and omit the standard pino ones.
518
+ * OTLP endpoint URL (e.g., http://collector:4318/v1/metrics)
217
519
  */
218
- useOnlyCustomLevels?: boolean;
520
+ endpoint: string;
219
521
  /**
220
- * How log levels are compared to the logger level. Use DESC when lower values are more severe. Defaults to ASC.
522
+ * Interval in milliseconds between metric pushes
221
523
  */
222
- levelComparison?: "ASC" | "DESC";
524
+ interval?: number | string;
223
525
  /**
224
- * A string prefixed to every message, including the ones of child loggers.
526
+ * Additional HTTP headers for authentication
225
527
  */
226
- msgPrefix?: string;
528
+ headers?: {
529
+ [k: string]: string;
530
+ };
227
531
  /**
228
- * The key under which any logged object is placed.
532
+ * Service name for OTLP resource attributes
229
533
  */
230
- nestedKey?: string;
534
+ serviceName?: string;
231
535
  /**
232
- * The key used for the serialized error in the log object. Defaults to err.
536
+ * Service version for OTLP resource attributes
233
537
  */
234
- errorKey?: string;
538
+ serviceVersion?: string;
539
+ };
540
+ /**
541
+ * Configuration for forwarding user OpenTelemetry metrics to an OTLP endpoint
542
+ */
543
+ opentelemetry?: {
235
544
  /**
236
- * The stringification limit at a specific nesting depth when logging circular objects. Defaults to 5.
545
+ * Enable or disable OpenTelemetry metrics forwarding
237
546
  */
238
- depthLimit?: number;
547
+ enabled?: boolean | string;
239
548
  /**
240
- * The stringification limit of properties or elements when logging a circular object or array. Defaults to 100.
549
+ * OTLP metrics endpoint URL (e.g., http://collector:4318/v1/metrics)
241
550
  */
242
- edgeLimit?: number;
551
+ endpoint: string;
243
552
  /**
244
- * Terminate each log line with \r\n instead of \n. Defaults to false.
553
+ * Interval in milliseconds between metric forwards
245
554
  */
246
- crlf?: boolean;
555
+ interval?: number | string;
247
556
  /**
248
- * Set to false to disable logging entirely. Defaults to true.
557
+ * Additional HTTP headers for authentication
249
558
  */
250
- enabled?: boolean;
251
- openTelemetryExporter?: {
252
- protocol: "grpc" | "http";
253
- url: string;
254
- };
255
- captureStdio?: boolean;
256
- pino?: {
257
- level?: string;
258
- time?: string;
259
- message?: string;
559
+ headers?: {
560
+ [k: string]: string;
260
561
  };
261
- [k: string]: unknown;
262
562
  };
263
- server?: {
264
- hostname?: string;
265
- port?: number | string;
563
+ /**
564
+ * Custom labels to add to HTTP metrics (http_request_all_duration_seconds). Each label extracts its value from an HTTP request header.
565
+ */
566
+ httpCustomLabels?: {
567
+ /**
568
+ * The label name to use in metrics
569
+ */
570
+ name: string;
266
571
  /**
267
- * Configures how entrypoint server worker ports are assigned. When set to shared, all workers listen on the same port. When set to perWorkerIncrement, each worker will use its own port, starting from port (worker 0).
572
+ * The HTTP request header to extract the value from
268
573
  */
269
- portAssignment?: "shared" | "perWorkerIncrement";
574
+ header: string;
270
575
  /**
271
- * The maximum length of the queue of pending connections
576
+ * Default value when header is missing (defaults to "unknown")
272
577
  */
273
- backlog?: number;
274
- http2?: boolean;
275
- https?: {
276
- allowHTTP1?: boolean;
277
- key:
578
+ default?: string;
579
+ }[];
580
+ }
581
+ export interface HttpsOptions {
582
+ allowHTTP1?: boolean;
583
+ key:
584
+ | string
585
+ | {
586
+ path?: string;
587
+ }
588
+ | (
278
589
  | string
279
590
  | {
280
591
  path?: string;
281
592
  }
282
- | (
283
- | string
284
- | {
285
- path?: string;
286
- }
287
- )[];
288
- cert:
593
+ )[];
594
+ cert:
595
+ | string
596
+ | {
597
+ path?: string;
598
+ }
599
+ | (
289
600
  | string
290
601
  | {
291
602
  path?: string;
292
603
  }
293
- | (
294
- | string
295
- | {
296
- path?: string;
297
- }
298
- )[];
299
- requestCert?: boolean;
300
- rejectUnauthorized?: boolean;
301
- };
302
- };
303
- reuseTcpPorts?: boolean;
304
- startTimeout?: number;
305
- restartOnError?: boolean | number;
306
- exitOnUnhandledErrors?: boolean | number;
307
- gracefulShutdown?: {
308
- runtime: number | string;
309
- application: number | string;
604
+ )[];
605
+ requestCert?: boolean;
606
+ rejectUnauthorized?: boolean;
607
+ }
608
+ export interface TelemetryOptions {
609
+ enabled?: boolean | string;
610
+ /**
611
+ * The name of the application. Defaults to the folder name if not specified.
612
+ */
613
+ applicationName: string;
614
+ /**
615
+ * The version of the application (optional)
616
+ */
617
+ version?: string;
618
+ /**
619
+ * An array of paths to skip when creating spans. Useful for health checks and other endpoints that do not need to be traced.
620
+ */
621
+ skip?: {
310
622
  /**
311
- * Add Connection: close header to HTTP responses during graceful shutdown
623
+ * The path to skip. Can be a string or a regex.
312
624
  */
313
- closeConnections?: boolean;
314
- };
315
- health?: {
316
- enabled?: boolean | string;
317
- interval?: number | string;
318
- gracePeriod?: number | string;
319
- maxUnhealthyChecks?: number | string;
320
- maxELU?: number | string;
321
- maxEventLoopDelay?: number | string;
322
- maxEventLoopDelayP99?: number | string;
323
- maxHeapUsed?: number | string;
324
- maxHeapTotal?: number | string;
325
- maxYoungGeneration?: number | string;
326
- codeRangeSize?: number | string;
327
- bufferPoolSize?: number | string;
328
- defaultHighWaterMark?: number | string;
329
- };
330
- healthProbes?:
331
- | boolean
332
- | string
333
- | {
334
- enabled?: boolean | string;
335
- hostname?: string;
336
- port?: number | string;
337
- readiness?:
338
- | boolean
339
- | {
340
- endpoint?: string;
341
- success?: {
342
- statusCode?: number;
343
- body?: string;
344
- };
345
- fail?: {
346
- statusCode?: number;
347
- body?: string;
348
- };
349
- };
350
- liveness?:
351
- | boolean
352
- | {
353
- endpoint?: string;
354
- success?: {
355
- statusCode?: number;
356
- body?: string;
357
- };
358
- fail?: {
359
- statusCode?: number;
360
- body?: string;
361
- };
362
- };
363
- };
364
- undici?: {
365
- agentOptions?: {
366
- [k: string]: unknown;
367
- };
368
- interceptors?:
369
- | {
370
- module: string;
371
- options: {
372
- [k: string]: unknown;
373
- };
374
- [k: string]: unknown;
375
- }[]
376
- | {
377
- Client?: {
378
- module: string;
379
- options: {
380
- [k: string]: unknown;
381
- };
382
- [k: string]: unknown;
383
- }[];
384
- Pool?: {
385
- module: string;
386
- options: {
387
- [k: string]: unknown;
388
- };
389
- [k: string]: unknown;
390
- }[];
391
- Agent?: {
392
- module: string;
393
- options: {
394
- [k: string]: unknown;
395
- };
396
- [k: string]: unknown;
397
- }[];
398
- [k: string]: unknown;
399
- };
625
+ path?: string;
626
+ /**
627
+ * HTTP method to skip
628
+ */
629
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
400
630
  [k: string]: unknown;
401
- };
402
- httpCache?:
403
- | boolean
404
- | {
405
- store?: string;
406
- /**
407
- * @minItems 1
408
- */
409
- methods?: [string, ...string[]];
410
- cacheTagsHeader?: string;
411
- maxSize?: number;
412
- maxEntrySize?: number;
413
- maxCount?: number;
414
- /**
415
- * Whitelist of origins to cache. Supports exact strings and regex patterns (e.g., "/https:\\/\\/.*\\.example\\.com/").
416
- */
417
- origins?: string[];
418
- /**
419
- * Default cache duration in seconds for responses without explicit expiration headers.
420
- */
421
- cacheByDefault?: number;
422
- /**
423
- * Cache type. "shared" caches may be shared between users, "private" caches are user-specific.
424
- */
425
- type?: "shared" | "private";
426
- [k: string]: unknown;
427
- };
428
- watch?: boolean | string;
429
- managementApi?:
430
- | boolean
431
- | string
432
- | {
433
- logs?: {
434
- maxSize?: number;
435
- };
436
- /**
437
- * Custom path for the control socket. If not specified, uses the default platform-specific location.
438
- */
439
- socket?: string;
440
- };
441
- management?:
442
- | boolean
443
- | {
444
- enabled?: boolean;
445
- operations?: string[];
446
- };
447
- metrics?:
448
- | boolean
631
+ }[];
632
+ exporter?:
449
633
  | {
450
- port?: number | string;
451
- enabled?: boolean | string;
452
- hostname?: string;
453
- endpoint?: string;
454
- https?: {
455
- allowHTTP1?: boolean;
456
- key:
457
- | string
458
- | {
459
- path?: string;
460
- }
461
- | (
462
- | string
463
- | {
464
- path?: string;
465
- }
466
- )[];
467
- cert:
468
- | string
469
- | {
470
- path?: string;
471
- }
472
- | (
473
- | string
474
- | {
475
- path?: string;
476
- }
477
- )[];
478
- requestCert?: boolean;
479
- rejectUnauthorized?: boolean;
480
- };
481
- auth?: {
482
- username: string;
483
- password: string;
484
- };
485
- labels?: {
486
- [k: string]: string;
487
- };
488
- /**
489
- * The label name to use for the application identifier in metrics (e.g., applicationId, serviceId)
490
- */
491
- applicationLabel?: string;
492
- /**
493
- * Enable outgoing HTTP client request duration metrics
494
- */
495
- httpClientMetrics?: boolean | string;
496
- readiness?:
497
- | boolean
498
- | {
499
- endpoint?: string;
500
- success?: {
501
- statusCode?: number;
502
- body?: string;
503
- };
504
- fail?: {
505
- statusCode?: number;
506
- body?: string;
507
- };
508
- };
509
- liveness?:
510
- | boolean
511
- | {
512
- endpoint?: string;
513
- success?: {
514
- statusCode?: number;
515
- body?: string;
516
- };
517
- fail?: {
518
- statusCode?: number;
519
- body?: string;
520
- };
521
- };
522
- /**
523
- * @deprecated
524
- * Deprecated. Health probe timeout configuration is no longer used.
525
- */
526
- healthChecksTimeouts?: number | string;
527
- plugins?: string[];
528
- timeout?: number | string;
634
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
529
635
  /**
530
- * Configuration for exporting metrics to an OTLP endpoint
636
+ * Options for the exporter. These are passed directly to the exporter.
531
637
  */
532
- otlpExporter?: {
533
- /**
534
- * Enable or disable OTLP metrics export
535
- */
536
- enabled?: boolean | string;
537
- /**
538
- * OTLP endpoint URL (e.g., http://collector:4318/v1/metrics)
539
- */
540
- endpoint: string;
638
+ options?: {
541
639
  /**
542
- * Interval in milliseconds between metric pushes
640
+ * The URL to send the traces to. Not used for console or memory exporters.
543
641
  */
544
- interval?: number | string;
642
+ url?: string;
545
643
  /**
546
- * Additional HTTP headers for authentication
644
+ * Headers to send to the exporter. Not used for console or memory exporters.
547
645
  */
548
646
  headers?: {
549
- [k: string]: string;
647
+ [k: string]: unknown;
550
648
  };
551
649
  /**
552
- * Service name for OTLP resource attributes
553
- */
554
- serviceName?: string;
555
- /**
556
- * Service version for OTLP resource attributes
557
- */
558
- serviceVersion?: string;
559
- };
560
- /**
561
- * Configuration for forwarding user OpenTelemetry metrics to an OTLP endpoint
562
- */
563
- opentelemetry?: {
564
- /**
565
- * Enable or disable OpenTelemetry metrics forwarding
650
+ * The path to write the traces to. Only for file exporter.
566
651
  */
567
- enabled?: boolean | string;
652
+ path?: string;
568
653
  /**
569
- * OTLP metrics endpoint URL (e.g., http://collector:4318/v1/metrics)
654
+ * The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http.
570
655
  */
571
- endpoint: string;
656
+ protocol?: "http" | "grpc";
572
657
  /**
573
- * Interval in milliseconds between metric forwards
658
+ * Alias for protocol. Only for the otlp exporter. Defaults to http.
574
659
  */
575
- interval?: number | string;
576
- /**
577
- * Additional HTTP headers for authentication
578
- */
579
- headers?: {
580
- [k: string]: string;
581
- };
660
+ transport?: "http" | "grpc";
661
+ [k: string]: unknown;
582
662
  };
663
+ additionalProperties?: never;
664
+ [k: string]: unknown;
665
+ }[]
666
+ | {
667
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
583
668
  /**
584
- * Custom labels to add to HTTP metrics (http_request_all_duration_seconds). Each label extracts its value from an HTTP request header.
669
+ * Options for the exporter. These are passed directly to the exporter.
585
670
  */
586
- httpCustomLabels?: {
671
+ options?: {
587
672
  /**
588
- * The label name to use in metrics
673
+ * The URL to send the traces to. Not used for console or memory exporters.
589
674
  */
590
- name: string;
675
+ url?: string;
591
676
  /**
592
- * The HTTP request header to extract the value from
677
+ * Headers to send to the exporter. Not used for console or memory exporters.
593
678
  */
594
- header: string;
679
+ headers?: {
680
+ [k: string]: unknown;
681
+ };
595
682
  /**
596
- * Default value when header is missing (defaults to "unknown")
683
+ * The path to write the traces to. Only for file exporter.
597
684
  */
598
- default?: string;
599
- }[];
600
- };
601
- telemetry?: {
602
- enabled?: boolean | string;
603
- /**
604
- * The name of the application. Defaults to the folder name if not specified.
605
- */
606
- applicationName: string;
607
- /**
608
- * The version of the application (optional)
609
- */
610
- version?: string;
611
- /**
612
- * An array of paths to skip when creating spans. Useful for health checks and other endpoints that do not need to be traced.
613
- */
614
- skip?: {
615
- /**
616
- * The path to skip. Can be a string or a regex.
617
- */
618
- path?: string;
619
- /**
620
- * HTTP method to skip
621
- */
622
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
623
- [k: string]: unknown;
624
- }[];
625
- exporter?:
626
- | {
627
- type?: "console" | "otlp" | "zipkin" | "memory" | "file";
685
+ path?: string;
628
686
  /**
629
- * Options for the exporter. These are passed directly to the exporter.
687
+ * The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http.
630
688
  */
631
- options?: {
632
- /**
633
- * The URL to send the traces to. Not used for console or memory exporters.
634
- */
635
- url?: string;
636
- /**
637
- * Headers to send to the exporter. Not used for console or memory exporters.
638
- */
639
- headers?: {
640
- [k: string]: unknown;
641
- };
642
- /**
643
- * The path to write the traces to. Only for file exporter.
644
- */
645
- path?: string;
646
- /**
647
- * The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http.
648
- */
649
- protocol?: "http" | "grpc";
650
- /**
651
- * Alias for protocol. Only for the otlp exporter. Defaults to http.
652
- */
653
- transport?: "http" | "grpc";
654
- [k: string]: unknown;
655
- };
656
- additionalProperties?: never;
657
- [k: string]: unknown;
658
- }[]
659
- | {
660
- type?: "console" | "otlp" | "zipkin" | "memory" | "file";
689
+ protocol?: "http" | "grpc";
661
690
  /**
662
- * Options for the exporter. These are passed directly to the exporter.
691
+ * Alias for protocol. Only for the otlp exporter. Defaults to http.
663
692
  */
664
- options?: {
665
- /**
666
- * The URL to send the traces to. Not used for console or memory exporters.
667
- */
668
- url?: string;
669
- /**
670
- * Headers to send to the exporter. Not used for console or memory exporters.
671
- */
672
- headers?: {
673
- [k: string]: unknown;
674
- };
675
- /**
676
- * The path to write the traces to. Only for file exporter.
677
- */
678
- path?: string;
679
- /**
680
- * The OTLP transport protocol to use. Only for the otlp exporter. Defaults to http.
681
- */
682
- protocol?: "http" | "grpc";
683
- /**
684
- * Alias for protocol. Only for the otlp exporter. Defaults to http.
685
- */
686
- transport?: "http" | "grpc";
687
- [k: string]: unknown;
688
- };
689
- additionalProperties?: never;
693
+ transport?: "http" | "grpc";
690
694
  [k: string]: unknown;
691
695
  };
692
- /**
693
- * Enable the OpenTelemetry diagnostic logger. Diagnostic messages are forwarded to the Platformatic global logger using the current logger level.
694
- */
695
- diagLogger?: boolean | string;
696
- };
697
- verticalScaler?: {
698
- enabled?: boolean;
699
- maxTotalWorkers?: number;
700
- maxTotalMemory?: number;
701
- minWorkers?: number;
702
- maxWorkers?: number;
703
- cooldownSec?: number;
704
- gracePeriod?: number;
705
- scaleUpELU?: number;
706
- scaleDownELU?: number;
707
- /**
708
- * @deprecated
709
- */
710
- timeWindowSec?: number;
711
- /**
712
- * @deprecated
713
- */
714
- scaleDownTimeWindowSec?: number;
715
- /**
716
- * @deprecated
717
- */
718
- scaleIntervalSec?: number;
719
- applications?: {
720
- [k: string]: {
721
- minWorkers?: number;
722
- maxWorkers?: number;
723
- scaleUpELU?: number;
724
- scaleDownELU?: number;
696
+ additionalProperties?: never;
697
+ [k: string]: unknown;
725
698
  };
726
- };
727
- };
728
- inspectorOptions?: {
729
- host?: string;
730
- port?: number;
731
- breakFirstLine?: boolean;
732
- watchDisabled?: boolean;
733
- [k: string]: unknown;
734
- };
735
- applicationTimeout?: number | string;
736
- startupConcurrency?: number | string;
737
- messagingTimeout?: number | string;
738
- resolvedApplicationsBasePath?: string;
739
- env?: {
740
- [k: string]: string;
741
- };
742
- envfile?: string;
743
699
  /**
744
- * When set to true, the configuration loading fails if a {PLT_*} placeholder references an environment variable which is not set. When set to "warn", a warning listing the missing variables is logged but the placeholders are still replaced with an empty string. Defaults to false.
700
+ * Enable the OpenTelemetry diagnostic logger. Diagnostic messages are forwarded to the Platformatic global logger using the current logger level.
745
701
  */
746
- strictEnv?: boolean | string;
747
- sourceMaps?: boolean;
748
- nodeModulesSourceMaps?: string[];
749
- scheduler?: {
750
- enabled?: boolean | string;
751
- name: string;
752
- cron: string;
753
- callbackUrl: string;
754
- method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
755
- headers?: {
756
- [k: string]: string;
757
- };
758
- body?:
759
- | string
760
- | {
761
- [k: string]: unknown;
762
- };
763
- maxRetries?: number;
764
- [k: string]: unknown;
765
- }[];
766
- policies?: {
767
- deny: {
768
- /**
769
- * This interface was referenced by `undefined`'s JSON-Schema definition
770
- * via the `patternProperty` "^.*$".
771
- */
772
- [k: string]: string | [string, ...string[]];
773
- };
774
- };
775
- compileCache?:
776
- | boolean
777
- | {
778
- /**
779
- * Enable Node.js module compile cache for faster startup
780
- */
781
- enabled?: boolean;
782
- /**
783
- * Directory to store compile cache. Defaults to .plt/compile-cache in app root
784
- */
785
- directory?: string;
786
- };
787
- module?: string;
788
- };
702
+ diagLogger?: boolean | string;
703
+ }
704
+ export interface CompileCacheOptions {
705
+ /**
706
+ * Enable Node.js module compile cache for faster startup
707
+ */
708
+ enabled?: boolean;
709
+ /**
710
+ * Directory to store compile cache. Defaults to .plt/compile-cache in app root
711
+ */
712
+ directory?: string;
713
+ /**
714
+ * Wait for the first worker to start before starting the remaining workers
715
+ */
716
+ awaitFirstWorker?: boolean;
717
+ }