@platformatic/service 3.13.0 → 3.14.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 CHANGED
@@ -313,7 +313,20 @@ export interface PlatformaticServiceConfig {
313
313
  services?: {
314
314
  [k: string]: unknown;
315
315
  }[];
316
- workers?: number | string;
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: (
@@ -521,6 +534,37 @@ export interface PlatformaticServiceConfig {
521
534
  };
522
535
  plugins?: string[];
523
536
  timeout?: number | string;
537
+ /**
538
+ * Configuration for exporting metrics to an OTLP endpoint
539
+ */
540
+ otlpExporter?: {
541
+ /**
542
+ * Enable or disable OTLP metrics export
543
+ */
544
+ enabled?: boolean | string;
545
+ /**
546
+ * OTLP endpoint URL (e.g., http://collector:4318/v1/metrics)
547
+ */
548
+ endpoint: string;
549
+ /**
550
+ * Interval in milliseconds between metric pushes
551
+ */
552
+ interval?: number | string;
553
+ /**
554
+ * Additional HTTP headers for authentication
555
+ */
556
+ headers?: {
557
+ [k: string]: string;
558
+ };
559
+ /**
560
+ * Service name for OTLP resource attributes
561
+ */
562
+ serviceName?: string;
563
+ /**
564
+ * Service version for OTLP resource attributes
565
+ */
566
+ serviceVersion?: string;
567
+ };
524
568
  };
525
569
  telemetry?: {
526
570
  enabled?: boolean | string;
@@ -604,13 +648,28 @@ export interface PlatformaticServiceConfig {
604
648
  maxTotalMemory?: number;
605
649
  minWorkers?: number;
606
650
  maxWorkers?: number;
651
+ cooldownSec?: number;
652
+ gracePeriod?: number;
653
+ /**
654
+ * @deprecated
655
+ */
607
656
  scaleUpELU?: number;
657
+ /**
658
+ * @deprecated
659
+ */
608
660
  scaleDownELU?: number;
661
+ /**
662
+ * @deprecated
663
+ */
609
664
  timeWindowSec?: number;
665
+ /**
666
+ * @deprecated
667
+ */
610
668
  scaleDownTimeWindowSec?: number;
611
- cooldownSec?: number;
669
+ /**
670
+ * @deprecated
671
+ */
612
672
  scaleIntervalSec?: number;
613
- gracePeriod?: number;
614
673
  };
615
674
  inspectorOptions?: {
616
675
  host?: string;
package/lib/capability.js CHANGED
@@ -239,11 +239,10 @@ export class ServiceCapability extends BaseCapability {
239
239
  pinoOptions.name = this.context.applicationId
240
240
  }
241
241
 
242
- if (this.context?.worker?.count > 1 && this.loggerConfig?.base !== null) {
243
- pinoOptions.base = { pid: process.pid, hostname: hostname(), worker: this.context.worker.index }
244
- } else if (this.loggerConfig?.base === null) {
245
- pinoOptions.base = undefined
246
- }
242
+ pinoOptions.base =
243
+ this.loggerConfig?.base !== null
244
+ ? { pid: process.pid, hostname: hostname(), worker: this.context.worker.index }
245
+ : undefined
247
246
 
248
247
  if (this.loggerConfig?.formatters) {
249
248
  pinoOptions.formatters = buildPinoFormatters(this.loggerConfig?.formatters)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/service",
3
- "version": "3.13.0",
3
+ "version": "3.14.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.13.0",
71
- "@platformatic/foundation": "3.13.0",
72
- "@platformatic/generators": "3.13.0",
73
- "@platformatic/metrics": "3.13.0",
74
- "@platformatic/scalar-theme": "3.13.0",
75
- "@platformatic/telemetry": "3.13.0"
70
+ "@platformatic/basic": "3.14.0",
71
+ "@platformatic/foundation": "3.14.0",
72
+ "@platformatic/generators": "3.14.0",
73
+ "@platformatic/metrics": "3.14.0",
74
+ "@platformatic/telemetry": "3.14.0",
75
+ "@platformatic/scalar-theme": "3.14.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.13.0.json",
3
- "version": "3.13.0",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/service/3.14.0.json",
3
+ "version": "3.14.0",
4
4
  "title": "Platformatic Service Config",
5
5
  "type": "object",
6
6
  "properties": {
@@ -1057,11 +1057,27 @@
1057
1057
  "workers": {
1058
1058
  "anyOf": [
1059
1059
  {
1060
- "type": "number",
1061
- "minimum": 1
1060
+ "type": "number"
1062
1061
  },
1063
1062
  {
1064
1063
  "type": "string"
1064
+ },
1065
+ {
1066
+ "type": "object",
1067
+ "properties": {
1068
+ "static": {
1069
+ "type": "number",
1070
+ "minimum": 1
1071
+ },
1072
+ "minimum": {
1073
+ "type": "number",
1074
+ "minimum": 1
1075
+ },
1076
+ "maximum": {
1077
+ "type": "number",
1078
+ "minimum": 0
1079
+ }
1080
+ }
1065
1081
  }
1066
1082
  ]
1067
1083
  },
@@ -1282,6 +1298,43 @@
1282
1298
  },
1283
1299
  {
1284
1300
  "type": "string"
1301
+ },
1302
+ {
1303
+ "type": "object",
1304
+ "properties": {
1305
+ "static": {
1306
+ "type": "number",
1307
+ "minimum": 1
1308
+ },
1309
+ "dynamic": {
1310
+ "type": "boolean",
1311
+ "default": false
1312
+ },
1313
+ "minimum": {
1314
+ "type": "number",
1315
+ "minimum": 1
1316
+ },
1317
+ "maximum": {
1318
+ "type": "number",
1319
+ "minimum": 0
1320
+ },
1321
+ "total": {
1322
+ "type": "number",
1323
+ "minimum": 1
1324
+ },
1325
+ "maxMemory": {
1326
+ "type": "number",
1327
+ "minimum": 0
1328
+ },
1329
+ "cooldown": {
1330
+ "type": "number",
1331
+ "minimum": 0
1332
+ },
1333
+ "gracePeriod": {
1334
+ "type": "number",
1335
+ "minimum": 0
1336
+ }
1337
+ }
1285
1338
  }
1286
1339
  ]
1287
1340
  },
@@ -2058,6 +2111,58 @@
2058
2111
  }
2059
2112
  ],
2060
2113
  "default": 10000
2114
+ },
2115
+ "otlpExporter": {
2116
+ "type": "object",
2117
+ "description": "Configuration for exporting metrics to an OTLP endpoint",
2118
+ "properties": {
2119
+ "enabled": {
2120
+ "anyOf": [
2121
+ {
2122
+ "type": "boolean"
2123
+ },
2124
+ {
2125
+ "type": "string"
2126
+ }
2127
+ ],
2128
+ "description": "Enable or disable OTLP metrics export"
2129
+ },
2130
+ "endpoint": {
2131
+ "type": "string",
2132
+ "description": "OTLP endpoint URL (e.g., http://collector:4318/v1/metrics)"
2133
+ },
2134
+ "interval": {
2135
+ "anyOf": [
2136
+ {
2137
+ "type": "integer"
2138
+ },
2139
+ {
2140
+ "type": "string"
2141
+ }
2142
+ ],
2143
+ "default": 60000,
2144
+ "description": "Interval in milliseconds between metric pushes"
2145
+ },
2146
+ "headers": {
2147
+ "type": "object",
2148
+ "additionalProperties": {
2149
+ "type": "string"
2150
+ },
2151
+ "description": "Additional HTTP headers for authentication"
2152
+ },
2153
+ "serviceName": {
2154
+ "type": "string",
2155
+ "description": "Service name for OTLP resource attributes"
2156
+ },
2157
+ "serviceVersion": {
2158
+ "type": "string",
2159
+ "description": "Service version for OTLP resource attributes"
2160
+ }
2161
+ },
2162
+ "required": [
2163
+ "endpoint"
2164
+ ],
2165
+ "additionalProperties": false
2061
2166
  }
2062
2167
  },
2063
2168
  "additionalProperties": false
@@ -2217,35 +2322,40 @@
2217
2322
  "type": "number",
2218
2323
  "minimum": 1
2219
2324
  },
2325
+ "cooldownSec": {
2326
+ "type": "number",
2327
+ "minimum": 0
2328
+ },
2329
+ "gracePeriod": {
2330
+ "type": "number",
2331
+ "minimum": 0
2332
+ },
2220
2333
  "scaleUpELU": {
2221
2334
  "type": "number",
2222
2335
  "minimum": 0,
2223
- "maximum": 1
2336
+ "maximum": 1,
2337
+ "deprecated": true
2224
2338
  },
2225
2339
  "scaleDownELU": {
2226
2340
  "type": "number",
2227
2341
  "minimum": 0,
2228
- "maximum": 1
2342
+ "maximum": 1,
2343
+ "deprecated": true
2229
2344
  },
2230
2345
  "timeWindowSec": {
2231
2346
  "type": "number",
2232
- "minimum": 0
2347
+ "minimum": 0,
2348
+ "deprecated": true
2233
2349
  },
2234
2350
  "scaleDownTimeWindowSec": {
2235
2351
  "type": "number",
2236
- "minimum": 0
2237
- },
2238
- "cooldownSec": {
2239
- "type": "number",
2240
- "minimum": 0
2352
+ "minimum": 0,
2353
+ "deprecated": true
2241
2354
  },
2242
2355
  "scaleIntervalSec": {
2243
2356
  "type": "number",
2244
- "minimum": 0
2245
- },
2246
- "gracePeriod": {
2247
- "type": "number",
2248
- "minimum": 0
2357
+ "minimum": 0,
2358
+ "deprecated": true
2249
2359
  }
2250
2360
  },
2251
2361
  "additionalProperties": false