@platformatic/runtime 2.11.0 → 2.13.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
@@ -5,7 +5,7 @@
5
5
  * and run json-schema-to-typescript to regenerate this file.
6
6
  */
7
7
 
8
- export type HttpsSchemasPlatformaticDevPlatformaticRuntime2110Json = {
8
+ export type HttpsSchemasPlatformaticDevPlatformaticRuntime2130Json = {
9
9
  [k: string]: unknown;
10
10
  } & {
11
11
  $schema?: string;
@@ -164,6 +164,7 @@ export type HttpsSchemasPlatformaticDevPlatformaticRuntime2110Json = {
164
164
  watchDisabled?: boolean;
165
165
  [k: string]: unknown;
166
166
  };
167
+ serviceTimeout?: number | string;
167
168
  };
168
169
 
169
170
  export interface UndiciInterceptor {
@@ -198,7 +199,7 @@ export interface OpenTelemetry {
198
199
  }[];
199
200
  exporter?:
200
201
  | {
201
- type?: "console" | "otlp" | "zipkin" | "memory";
202
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
202
203
  /**
203
204
  * Options for the exporter. These are passed directly to the exporter.
204
205
  */
@@ -213,13 +214,17 @@ export interface OpenTelemetry {
213
214
  headers?: {
214
215
  [k: string]: unknown;
215
216
  };
217
+ /**
218
+ * The path to write the traces to. Only for file exporter.
219
+ */
220
+ path?: string;
216
221
  [k: string]: unknown;
217
222
  };
218
223
  additionalProperties?: never;
219
224
  [k: string]: unknown;
220
225
  }[]
221
226
  | {
222
- type?: "console" | "otlp" | "zipkin" | "memory";
227
+ type?: "console" | "otlp" | "zipkin" | "memory" | "file";
223
228
  /**
224
229
  * Options for the exporter. These are passed directly to the exporter.
225
230
  */
@@ -234,6 +239,10 @@ export interface OpenTelemetry {
234
239
  headers?: {
235
240
  [k: string]: unknown;
236
241
  };
242
+ /**
243
+ * The path to write the traces to. Only for file exporter.
244
+ */
245
+ path?: string;
237
246
  [k: string]: unknown;
238
247
  };
239
248
  additionalProperties?: never;
package/lib/runtime.js CHANGED
@@ -79,7 +79,10 @@ class Runtime extends EventEmitter {
79
79
  this.#servicesIds = []
80
80
  this.#url = undefined
81
81
  // Note: nothing hits the main thread so there is no reason to set the globalDispatcher here
82
- this.#interceptor = createThreadInterceptor({ domain: '.plt.local', timeout: true })
82
+ this.#interceptor = createThreadInterceptor({
83
+ domain: '.plt.local',
84
+ timeout: this.#configManager.current.serviceTimeout
85
+ })
83
86
  this.#status = undefined
84
87
  this.#restartingWorkers = new Map()
85
88
  }
package/lib/schema.js CHANGED
@@ -274,6 +274,16 @@ const platformaticRuntimeSchema = {
274
274
  type: 'boolean'
275
275
  }
276
276
  }
277
+ },
278
+ serviceTimeout: {
279
+ anyOf: [
280
+ {
281
+ type: 'number',
282
+ minimum: 1
283
+ },
284
+ { type: 'string' }
285
+ ],
286
+ default: 300000 // 5 minutes
277
287
  }
278
288
  },
279
289
  anyOf: [{ required: ['autoload'] }, { required: ['services'] }, { required: ['web'] }],
package/lib/start.js CHANGED
@@ -31,7 +31,7 @@ async function restartRuntime (runtime) {
31
31
  async function buildRuntime (configManager, env) {
32
32
  env = env || process.env
33
33
 
34
- if (inspector.url()) {
34
+ if (inspector.url() && !env.VSCODE_INSPECTOR_OPTIONS) {
35
35
  throw new errors.NodeInspectorFlagsNotSupportedError()
36
36
  }
37
37
 
@@ -16,6 +16,8 @@ const { wire } = require('undici-thread-interceptor')
16
16
  const { PlatformaticApp } = require('./app')
17
17
  const { setupITC } = require('./itc')
18
18
  const loadInterceptors = require('./interceptors')
19
+ const { createTelemetryThreadInterceptorHooks } = require('@platformatic/telemetry')
20
+
19
21
  const {
20
22
  MessagePortWritable,
21
23
  createPinoWritable,
@@ -97,10 +99,10 @@ async function main () {
97
99
 
98
100
  setGlobalDispatcher(globalDispatcher)
99
101
 
102
+ const { telemetry } = service
103
+ const hooks = telemetry ? createTelemetryThreadInterceptorHooks() : {}
100
104
  // Setup mesh networker
101
- // The timeout is set to 5 minutes to avoid long term memory leaks
102
- // TODO: make this configurable
103
- const threadDispatcher = wire({ port: parentPort, useNetwork: service.useHttp, timeout: 5 * 60 * 1000 })
105
+ const threadDispatcher = wire({ port: parentPort, useNetwork: service.useHttp, timeout: config.serviceTimeout, ...hooks })
104
106
 
105
107
  // If the service is an entrypoint and runtime server config is defined, use it.
106
108
  let serverConfig = null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/runtime",
3
- "version": "2.11.0",
3
+ "version": "2.13.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -35,12 +35,12 @@
35
35
  "typescript": "^5.5.4",
36
36
  "undici-oidc-interceptor": "^0.5.0",
37
37
  "why-is-node-running": "^2.2.2",
38
- "@platformatic/composer": "2.11.0",
39
- "@platformatic/db": "2.11.0",
40
- "@platformatic/service": "2.11.0",
41
- "@platformatic/node": "2.11.0",
42
- "@platformatic/sql-graphql": "2.11.0",
43
- "@platformatic/sql-mapper": "2.11.0"
38
+ "@platformatic/composer": "2.13.0",
39
+ "@platformatic/db": "2.13.0",
40
+ "@platformatic/node": "2.13.0",
41
+ "@platformatic/service": "2.13.0",
42
+ "@platformatic/sql-graphql": "2.13.0",
43
+ "@platformatic/sql-mapper": "2.13.0"
44
44
  },
45
45
  "dependencies": {
46
46
  "@fastify/error": "^4.0.0",
@@ -62,21 +62,21 @@
62
62
  "help-me": "^5.0.0",
63
63
  "minimist": "^1.2.8",
64
64
  "pino": "^8.19.0",
65
- "pino-pretty": "^12.0.0",
65
+ "pino-pretty": "^13.0.0",
66
66
  "pino-roll": "^2.0.0",
67
67
  "prom-client": "^15.1.2",
68
68
  "semgrator": "^0.3.0",
69
69
  "tail-file-stream": "^0.2.0",
70
70
  "undici": "^6.9.0",
71
- "undici-thread-interceptor": "^0.8.0",
71
+ "undici-thread-interceptor": "^0.9.0",
72
72
  "ws": "^8.16.0",
73
- "@platformatic/basic": "2.11.0",
74
- "@platformatic/config": "2.11.0",
75
- "@platformatic/itc": "2.11.0",
76
- "@platformatic/generators": "2.11.0",
77
- "@platformatic/telemetry": "2.11.0",
78
- "@platformatic/ts-compiler": "2.11.0",
79
- "@platformatic/utils": "2.11.0"
73
+ "@platformatic/basic": "2.13.0",
74
+ "@platformatic/generators": "2.13.0",
75
+ "@platformatic/itc": "2.13.0",
76
+ "@platformatic/config": "2.13.0",
77
+ "@platformatic/telemetry": "2.13.0",
78
+ "@platformatic/utils": "2.13.0",
79
+ "@platformatic/ts-compiler": "2.13.0"
80
80
  },
81
81
  "scripts": {
82
82
  "test": "npm run lint && borp --concurrency=1 --timeout=300000 && tsd",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/runtime/2.11.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/runtime/2.13.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "type": "object",
5
5
  "properties": {
@@ -980,7 +980,8 @@
980
980
  "console",
981
981
  "otlp",
982
982
  "zipkin",
983
- "memory"
983
+ "memory",
984
+ "file"
984
985
  ],
985
986
  "default": "console"
986
987
  },
@@ -995,6 +996,10 @@
995
996
  "headers": {
996
997
  "type": "object",
997
998
  "description": "Headers to send to the exporter. Not used for console or memory exporters."
999
+ },
1000
+ "path": {
1001
+ "type": "string",
1002
+ "description": "The path to write the traces to. Only for file exporter."
998
1003
  }
999
1004
  }
1000
1005
  },
@@ -1011,7 +1016,8 @@
1011
1016
  "console",
1012
1017
  "otlp",
1013
1018
  "zipkin",
1014
- "memory"
1019
+ "memory",
1020
+ "file"
1015
1021
  ],
1016
1022
  "default": "console"
1017
1023
  },
@@ -1026,6 +1032,10 @@
1026
1032
  "headers": {
1027
1033
  "type": "object",
1028
1034
  "description": "Headers to send to the exporter. Not used for console or memory exporters."
1035
+ },
1036
+ "path": {
1037
+ "type": "string",
1038
+ "description": "The path to write the traces to. Only for file exporter."
1029
1039
  }
1030
1040
  }
1031
1041
  },
@@ -1056,6 +1066,18 @@
1056
1066
  "type": "boolean"
1057
1067
  }
1058
1068
  }
1069
+ },
1070
+ "serviceTimeout": {
1071
+ "anyOf": [
1072
+ {
1073
+ "type": "number",
1074
+ "minimum": 1
1075
+ },
1076
+ {
1077
+ "type": "string"
1078
+ }
1079
+ ],
1080
+ "default": 300000
1059
1081
  }
1060
1082
  },
1061
1083
  "anyOf": [