@platformatic/runtime 3.30.0 → 3.32.0-alpha.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
@@ -42,6 +42,7 @@ export type PlatformaticRuntimeConfig = {
42
42
  maxHeapTotal?: number | string;
43
43
  maxYoungGeneration?: number | string;
44
44
  codeRangeSize?: number | string;
45
+ noHeapCheck?: boolean | string;
45
46
  };
46
47
  dependencies?: string[];
47
48
  arguments?: string[];
@@ -212,6 +213,7 @@ export type PlatformaticRuntimeConfig = {
212
213
  maxHeapTotal?: number | string;
213
214
  maxYoungGeneration?: number | string;
214
215
  codeRangeSize?: number | string;
216
+ noHeapCheck?: boolean | string;
215
217
  };
216
218
  undici?: {
217
219
  agentOptions?: {
package/lib/runtime.js CHANGED
@@ -1349,7 +1349,7 @@ export class Runtime extends EventEmitter {
1349
1349
  elu = worker.performance.eventLoopUtilization(elu, previousELU)
1350
1350
  }
1351
1351
 
1352
- if (!features.node.worker.getHeapStatistics) {
1352
+ if (!features.node.worker.getHeapStatistics || options.noHeapCheck) {
1353
1353
  return { elu: elu.utilization, currentELU }
1354
1354
  }
1355
1355
 
@@ -1753,7 +1753,8 @@ export class Runtime extends EventEmitter {
1753
1753
  let health = null
1754
1754
  try {
1755
1755
  health = await this.getWorkerHealth(worker, {
1756
- previousELU: worker[kLastHealthCheckELU]
1756
+ previousELU: worker[kLastHealthCheckELU],
1757
+ noHeapCheck: worker[kConfig]?.health?.noHeapCheck
1757
1758
  })
1758
1759
  } catch (err) {
1759
1760
  this.logger.error({ err }, `Failed to get health for ${errorLabel}.`)
@@ -1797,7 +1798,7 @@ export class Runtime extends EventEmitter {
1797
1798
 
1798
1799
  const healthConfig = worker[kConfig].health
1799
1800
 
1800
- let { maxELU, maxHeapUsed, maxHeapTotal, maxUnhealthyChecks, interval } = worker[kConfig].health
1801
+ let { maxELU, maxHeapUsed, maxHeapTotal, maxUnhealthyChecks, interval, noHeapCheck } = worker[kConfig].health
1801
1802
 
1802
1803
  if (typeof maxHeapTotal === 'string') {
1803
1804
  maxHeapTotal = parseMemorySize(maxHeapTotal)
@@ -1828,8 +1829,8 @@ export class Runtime extends EventEmitter {
1828
1829
 
1829
1830
  if (lastHealthMetrics) {
1830
1831
  const health = lastHealthMetrics.currentHealth
1831
- const memoryUsage = health.heapUsed / maxHeapTotal
1832
- const unhealthy = health.elu > maxELU || memoryUsage > maxHeapUsed
1832
+ const memoryUsage = noHeapCheck ? 0 : health.heapUsed / maxHeapTotal
1833
+ const unhealthy = health.elu > maxELU || (!noHeapCheck && memoryUsage > maxHeapUsed)
1833
1834
 
1834
1835
  this.emit('application:worker:health', {
1835
1836
  id: worker[kId],
@@ -1847,7 +1848,7 @@ export class Runtime extends EventEmitter {
1847
1848
  )
1848
1849
  }
1849
1850
 
1850
- if (memoryUsage > maxHeapUsed) {
1851
+ if (!noHeapCheck && memoryUsage > maxHeapUsed) {
1851
1852
  this.logger.error(
1852
1853
  `The ${errorLabel} is using ${(memoryUsage * 100).toFixed(2)} % of the memory, ` +
1853
1854
  `above the maximum allowed usage of ${(maxHeapUsed * 100).toFixed(2)} %.`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/runtime",
3
- "version": "3.30.0",
3
+ "version": "3.32.0-alpha.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -35,14 +35,14 @@
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": "3.30.0",
39
- "@platformatic/db": "3.30.0",
40
- "@platformatic/gateway": "3.30.0",
41
- "@platformatic/node": "3.30.0",
42
- "@platformatic/sql-graphql": "3.30.0",
43
- "@platformatic/sql-mapper": "3.30.0",
44
- "@platformatic/service": "3.30.0",
45
- "@platformatic/wattpm-pprof-capture": "3.30.0"
38
+ "@platformatic/composer": "3.32.0-alpha.0",
39
+ "@platformatic/db": "3.32.0-alpha.0",
40
+ "@platformatic/node": "3.32.0-alpha.0",
41
+ "@platformatic/service": "3.32.0-alpha.0",
42
+ "@platformatic/gateway": "3.32.0-alpha.0",
43
+ "@platformatic/sql-graphql": "3.32.0-alpha.0",
44
+ "@platformatic/wattpm-pprof-capture": "3.32.0-alpha.0",
45
+ "@platformatic/sql-mapper": "3.32.0-alpha.0"
46
46
  },
47
47
  "dependencies": {
48
48
  "@fastify/accepts": "^5.0.0",
@@ -71,12 +71,12 @@
71
71
  "undici": "^7.0.0",
72
72
  "undici-thread-interceptor": "^1.0.0",
73
73
  "ws": "^8.16.0",
74
- "@platformatic/foundation": "3.30.0",
75
- "@platformatic/basic": "3.30.0",
76
- "@platformatic/generators": "3.30.0",
77
- "@platformatic/itc": "3.30.0",
78
- "@platformatic/telemetry": "3.30.0",
79
- "@platformatic/metrics": "3.30.0"
74
+ "@platformatic/basic": "3.32.0-alpha.0",
75
+ "@platformatic/foundation": "3.32.0-alpha.0",
76
+ "@platformatic/generators": "3.32.0-alpha.0",
77
+ "@platformatic/itc": "3.32.0-alpha.0",
78
+ "@platformatic/metrics": "3.32.0-alpha.0",
79
+ "@platformatic/telemetry": "3.32.0-alpha.0"
80
80
  },
81
81
  "engines": {
82
82
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.30.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/runtime/3.32.0-alpha.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Runtime Config",
5
5
  "type": "object",
@@ -208,6 +208,16 @@
208
208
  "type": "string"
209
209
  }
210
210
  ]
211
+ },
212
+ "noHeapCheck": {
213
+ "anyOf": [
214
+ {
215
+ "type": "boolean"
216
+ },
217
+ {
218
+ "type": "string"
219
+ }
220
+ ]
211
221
  }
212
222
  },
213
223
  "additionalProperties": false
@@ -522,6 +532,16 @@
522
532
  "type": "string"
523
533
  }
524
534
  ]
535
+ },
536
+ "noHeapCheck": {
537
+ "anyOf": [
538
+ {
539
+ "type": "boolean"
540
+ },
541
+ {
542
+ "type": "string"
543
+ }
544
+ ]
525
545
  }
526
546
  },
527
547
  "additionalProperties": false
@@ -834,6 +854,16 @@
834
854
  "type": "string"
835
855
  }
836
856
  ]
857
+ },
858
+ "noHeapCheck": {
859
+ "anyOf": [
860
+ {
861
+ "type": "boolean"
862
+ },
863
+ {
864
+ "type": "string"
865
+ }
866
+ ]
837
867
  }
838
868
  },
839
869
  "additionalProperties": false
@@ -1146,6 +1176,16 @@
1146
1176
  "type": "string"
1147
1177
  }
1148
1178
  ]
1179
+ },
1180
+ "noHeapCheck": {
1181
+ "anyOf": [
1182
+ {
1183
+ "type": "boolean"
1184
+ },
1185
+ {
1186
+ "type": "string"
1187
+ }
1188
+ ]
1149
1189
  }
1150
1190
  },
1151
1191
  "additionalProperties": false
@@ -1794,6 +1834,17 @@
1794
1834
  }
1795
1835
  ],
1796
1836
  "default": 268435456
1837
+ },
1838
+ "noHeapCheck": {
1839
+ "anyOf": [
1840
+ {
1841
+ "type": "boolean"
1842
+ },
1843
+ {
1844
+ "type": "string"
1845
+ }
1846
+ ],
1847
+ "default": false
1797
1848
  }
1798
1849
  },
1799
1850
  "additionalProperties": false