@platformatic/watt-extra 1.2.0 → 1.2.1-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/.github/workflows/test.yml +1 -1
- package/lib/watt.js +51 -38
- package/package.json +2 -2
package/lib/watt.js
CHANGED
|
@@ -63,6 +63,16 @@ class Watt {
|
|
|
63
63
|
)
|
|
64
64
|
throw err
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
const { eventLoopUtilization } = require('node:perf_hooks').performance
|
|
68
|
+
// Print eventloop utilization every second
|
|
69
|
+
let elu1 = eventLoopUtilization()
|
|
70
|
+
setInterval(() => {
|
|
71
|
+
const elu2 = eventLoopUtilization()
|
|
72
|
+
const current = eventLoopUtilization(elu1)
|
|
73
|
+
console.log('Watt-extra event loop utilization:', current)
|
|
74
|
+
elu1 = elu2
|
|
75
|
+
}, 1000)
|
|
66
76
|
}
|
|
67
77
|
|
|
68
78
|
async close () {
|
|
@@ -151,25 +161,28 @@ class Watt {
|
|
|
151
161
|
config.server = {
|
|
152
162
|
...serverConfig,
|
|
153
163
|
hostname: this.#env.PLT_APP_HOSTNAME || serverConfig.hostname,
|
|
154
|
-
port: this.#env.PLT_APP_PORT || serverConfig.port
|
|
164
|
+
port: this.#env.PLT_APP_PORT || serverConfig.port
|
|
155
165
|
}
|
|
156
166
|
|
|
157
167
|
config.hotReload = false
|
|
158
168
|
config.restartOnError = 1000
|
|
159
169
|
config.metrics = {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
enabled: false
|
|
171
|
+
}
|
|
172
|
+
// config.metrics = {
|
|
173
|
+
// server: 'hide',
|
|
174
|
+
// defaultMetrics: {
|
|
175
|
+
// enabled: true
|
|
176
|
+
// },
|
|
177
|
+
// hostname: this.#env.PLT_APP_HOSTNAME || '0.0.0.0',
|
|
178
|
+
// port: this.#env.PLT_METRICS_PORT || 9090,
|
|
179
|
+
// labels: {
|
|
180
|
+
// serviceId: 'main',
|
|
181
|
+
// applicationId: this.#instanceConfig?.applicationId,
|
|
182
|
+
// instanceId: this.#instanceId
|
|
183
|
+
// },
|
|
184
|
+
// applicationLabel: this.#instanceConfig?.applicationMetricsLabel ?? 'serviceId'
|
|
185
|
+
// }
|
|
173
186
|
|
|
174
187
|
if (this.#env.PLT_DISABLE_FLAMEGRAPHS !== true) {
|
|
175
188
|
if (config.preload === undefined) {
|
|
@@ -231,20 +244,20 @@ class Watt {
|
|
|
231
244
|
),
|
|
232
245
|
options: {
|
|
233
246
|
labels: {
|
|
234
|
-
applicationId: this.#instanceConfig.applicationId
|
|
247
|
+
applicationId: this.#instanceConfig.applicationId
|
|
235
248
|
},
|
|
236
249
|
bloomFilter: {
|
|
237
250
|
size: 100000,
|
|
238
|
-
errorRate: 0.01
|
|
251
|
+
errorRate: 0.01
|
|
239
252
|
},
|
|
240
253
|
maxResponseSize: 5 * 1024 * 1024, // 5MB
|
|
241
254
|
trafficInspectorOptions: {
|
|
242
255
|
url: trafficInspectorOrigin,
|
|
243
256
|
pathSendBody: join(trafficInspectorPath, '/requests'),
|
|
244
|
-
pathSendMeta: join(trafficInspectorPath, '/requests/hash')
|
|
257
|
+
pathSendMeta: join(trafficInspectorPath, '/requests/hash')
|
|
245
258
|
},
|
|
246
|
-
matchingDomains: [this.#env.PLT_APP_INTERNAL_SUB_DOMAIN]
|
|
247
|
-
}
|
|
259
|
+
matchingDomains: [this.#env.PLT_APP_INTERNAL_SUB_DOMAIN]
|
|
260
|
+
}
|
|
248
261
|
}
|
|
249
262
|
}
|
|
250
263
|
|
|
@@ -255,9 +268,9 @@ class Watt {
|
|
|
255
268
|
rules: [
|
|
256
269
|
{
|
|
257
270
|
routeToMatch: 'http://plt.slicer.default/',
|
|
258
|
-
headers: {}
|
|
259
|
-
}
|
|
260
|
-
]
|
|
271
|
+
headers: {}
|
|
272
|
+
}
|
|
273
|
+
]
|
|
261
274
|
}
|
|
262
275
|
|
|
263
276
|
// This is the cache config from ICC
|
|
@@ -309,7 +322,7 @@ class Watt {
|
|
|
309
322
|
|
|
310
323
|
return {
|
|
311
324
|
module: require.resolve('undici-slicer-interceptor'),
|
|
312
|
-
options: cacheConfig
|
|
325
|
+
options: cacheConfig
|
|
313
326
|
}
|
|
314
327
|
}
|
|
315
328
|
|
|
@@ -341,7 +354,7 @@ class Watt {
|
|
|
341
354
|
applicationName: `${this.#applicationName}`,
|
|
342
355
|
skip: [
|
|
343
356
|
{ method: 'GET', path: '/documentation' },
|
|
344
|
-
{ method: 'GET', path: '/documentation/json' }
|
|
357
|
+
{ method: 'GET', path: '/documentation/json' }
|
|
345
358
|
],
|
|
346
359
|
exporter: {
|
|
347
360
|
type: 'otlp',
|
|
@@ -349,14 +362,14 @@ class Watt {
|
|
|
349
362
|
url:
|
|
350
363
|
this.#instanceConfig?.iccServices?.riskEngine?.url + '/v1/traces',
|
|
351
364
|
headers: {
|
|
352
|
-
'x-platformatic-application-id': this.#instanceConfig?.applicationId
|
|
365
|
+
'x-platformatic-application-id': this.#instanceConfig?.applicationId
|
|
353
366
|
},
|
|
354
367
|
keepAlive: true,
|
|
355
368
|
httpAgentOptions: {
|
|
356
|
-
rejectUnauthorized: false
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
369
|
+
rejectUnauthorized: false
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
360
373
|
}
|
|
361
374
|
}
|
|
362
375
|
|
|
@@ -375,16 +388,16 @@ class Watt {
|
|
|
375
388
|
...config.httpCache,
|
|
376
389
|
cacheTagsHeader,
|
|
377
390
|
store: require.resolve('undici-cache-redis'),
|
|
378
|
-
clientOpts: httpCache
|
|
391
|
+
clientOpts: httpCache
|
|
379
392
|
}
|
|
380
393
|
}
|
|
381
394
|
|
|
382
395
|
#configureHealth (config) {
|
|
383
396
|
config.health = {
|
|
384
|
-
...config.health,
|
|
385
|
-
enabled:
|
|
386
|
-
interval: 1000,
|
|
387
|
-
maxUnhealthyChecks: 30
|
|
397
|
+
// ...config.health,
|
|
398
|
+
enabled: false
|
|
399
|
+
// interval: 1000,
|
|
400
|
+
// maxUnhealthyChecks: 30
|
|
388
401
|
}
|
|
389
402
|
}
|
|
390
403
|
|
|
@@ -394,7 +407,7 @@ class Watt {
|
|
|
394
407
|
if (config.scheduler) {
|
|
395
408
|
config.scheduler = config.scheduler.map((scheduler) => ({
|
|
396
409
|
...scheduler,
|
|
397
|
-
enabled: false
|
|
410
|
+
enabled: false
|
|
398
411
|
}))
|
|
399
412
|
}
|
|
400
413
|
}
|
|
@@ -413,7 +426,7 @@ class Watt {
|
|
|
413
426
|
[
|
|
414
427
|
'@platformatic/service',
|
|
415
428
|
'@platformatic/composer',
|
|
416
|
-
'@platformatic/db'
|
|
429
|
+
'@platformatic/db'
|
|
417
430
|
].includes(app.type)
|
|
418
431
|
) {
|
|
419
432
|
await this.#configurePlatformaticServices(runtime, app)
|
|
@@ -457,8 +470,8 @@ class Watt {
|
|
|
457
470
|
adapter: 'valkey',
|
|
458
471
|
url: `valkey://${username}:${password}@${host}:${port}`,
|
|
459
472
|
prefix: keyPrefix,
|
|
460
|
-
maxTTL: 604800
|
|
461
|
-
}
|
|
473
|
+
maxTTL: 604800 // 86400 * 7
|
|
474
|
+
}
|
|
462
475
|
})
|
|
463
476
|
}
|
|
464
477
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/watt-extra",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1-alpha.1",
|
|
4
4
|
"description": "The Platformatic runtime manager",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"execa": "^9.6.0",
|
|
46
46
|
"help-me": "^5.0.0",
|
|
47
47
|
"minimist": "^1.2.8",
|
|
48
|
-
"pino": "^
|
|
48
|
+
"pino": "^10.0.0",
|
|
49
49
|
"pino-pretty": "^13.0.0",
|
|
50
50
|
"undici": "^7.11.0",
|
|
51
51
|
"undici-cache-redis": "^1.0.0",
|