@platformatic/watt-extra 1.2.0 → 1.2.1-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/.github/workflows/test.yml +1 -1
- package/lib/watt.js +34 -24
- 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,7 +161,7 @@ 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
|
|
@@ -159,14 +169,14 @@ class Watt {
|
|
|
159
169
|
config.metrics = {
|
|
160
170
|
server: 'hide',
|
|
161
171
|
defaultMetrics: {
|
|
162
|
-
enabled: true
|
|
172
|
+
enabled: true
|
|
163
173
|
},
|
|
164
174
|
hostname: this.#env.PLT_APP_HOSTNAME || '0.0.0.0',
|
|
165
175
|
port: this.#env.PLT_METRICS_PORT || 9090,
|
|
166
176
|
labels: {
|
|
167
177
|
serviceId: 'main',
|
|
168
178
|
applicationId: this.#instanceConfig?.applicationId,
|
|
169
|
-
instanceId: this.#instanceId
|
|
179
|
+
instanceId: this.#instanceId
|
|
170
180
|
},
|
|
171
181
|
applicationLabel: this.#instanceConfig?.applicationMetricsLabel ?? 'serviceId'
|
|
172
182
|
}
|
|
@@ -231,20 +241,20 @@ class Watt {
|
|
|
231
241
|
),
|
|
232
242
|
options: {
|
|
233
243
|
labels: {
|
|
234
|
-
applicationId: this.#instanceConfig.applicationId
|
|
244
|
+
applicationId: this.#instanceConfig.applicationId
|
|
235
245
|
},
|
|
236
246
|
bloomFilter: {
|
|
237
247
|
size: 100000,
|
|
238
|
-
errorRate: 0.01
|
|
248
|
+
errorRate: 0.01
|
|
239
249
|
},
|
|
240
250
|
maxResponseSize: 5 * 1024 * 1024, // 5MB
|
|
241
251
|
trafficInspectorOptions: {
|
|
242
252
|
url: trafficInspectorOrigin,
|
|
243
253
|
pathSendBody: join(trafficInspectorPath, '/requests'),
|
|
244
|
-
pathSendMeta: join(trafficInspectorPath, '/requests/hash')
|
|
254
|
+
pathSendMeta: join(trafficInspectorPath, '/requests/hash')
|
|
245
255
|
},
|
|
246
|
-
matchingDomains: [this.#env.PLT_APP_INTERNAL_SUB_DOMAIN]
|
|
247
|
-
}
|
|
256
|
+
matchingDomains: [this.#env.PLT_APP_INTERNAL_SUB_DOMAIN]
|
|
257
|
+
}
|
|
248
258
|
}
|
|
249
259
|
}
|
|
250
260
|
|
|
@@ -255,9 +265,9 @@ class Watt {
|
|
|
255
265
|
rules: [
|
|
256
266
|
{
|
|
257
267
|
routeToMatch: 'http://plt.slicer.default/',
|
|
258
|
-
headers: {}
|
|
259
|
-
}
|
|
260
|
-
]
|
|
268
|
+
headers: {}
|
|
269
|
+
}
|
|
270
|
+
]
|
|
261
271
|
}
|
|
262
272
|
|
|
263
273
|
// This is the cache config from ICC
|
|
@@ -309,7 +319,7 @@ class Watt {
|
|
|
309
319
|
|
|
310
320
|
return {
|
|
311
321
|
module: require.resolve('undici-slicer-interceptor'),
|
|
312
|
-
options: cacheConfig
|
|
322
|
+
options: cacheConfig
|
|
313
323
|
}
|
|
314
324
|
}
|
|
315
325
|
|
|
@@ -341,7 +351,7 @@ class Watt {
|
|
|
341
351
|
applicationName: `${this.#applicationName}`,
|
|
342
352
|
skip: [
|
|
343
353
|
{ method: 'GET', path: '/documentation' },
|
|
344
|
-
{ method: 'GET', path: '/documentation/json' }
|
|
354
|
+
{ method: 'GET', path: '/documentation/json' }
|
|
345
355
|
],
|
|
346
356
|
exporter: {
|
|
347
357
|
type: 'otlp',
|
|
@@ -349,14 +359,14 @@ class Watt {
|
|
|
349
359
|
url:
|
|
350
360
|
this.#instanceConfig?.iccServices?.riskEngine?.url + '/v1/traces',
|
|
351
361
|
headers: {
|
|
352
|
-
'x-platformatic-application-id': this.#instanceConfig?.applicationId
|
|
362
|
+
'x-platformatic-application-id': this.#instanceConfig?.applicationId
|
|
353
363
|
},
|
|
354
364
|
keepAlive: true,
|
|
355
365
|
httpAgentOptions: {
|
|
356
|
-
rejectUnauthorized: false
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
366
|
+
rejectUnauthorized: false
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
360
370
|
}
|
|
361
371
|
}
|
|
362
372
|
|
|
@@ -375,7 +385,7 @@ class Watt {
|
|
|
375
385
|
...config.httpCache,
|
|
376
386
|
cacheTagsHeader,
|
|
377
387
|
store: require.resolve('undici-cache-redis'),
|
|
378
|
-
clientOpts: httpCache
|
|
388
|
+
clientOpts: httpCache
|
|
379
389
|
}
|
|
380
390
|
}
|
|
381
391
|
|
|
@@ -384,7 +394,7 @@ class Watt {
|
|
|
384
394
|
...config.health,
|
|
385
395
|
enabled: true,
|
|
386
396
|
interval: 1000,
|
|
387
|
-
maxUnhealthyChecks: 30
|
|
397
|
+
maxUnhealthyChecks: 30
|
|
388
398
|
}
|
|
389
399
|
}
|
|
390
400
|
|
|
@@ -394,7 +404,7 @@ class Watt {
|
|
|
394
404
|
if (config.scheduler) {
|
|
395
405
|
config.scheduler = config.scheduler.map((scheduler) => ({
|
|
396
406
|
...scheduler,
|
|
397
|
-
enabled: false
|
|
407
|
+
enabled: false
|
|
398
408
|
}))
|
|
399
409
|
}
|
|
400
410
|
}
|
|
@@ -413,7 +423,7 @@ class Watt {
|
|
|
413
423
|
[
|
|
414
424
|
'@platformatic/service',
|
|
415
425
|
'@platformatic/composer',
|
|
416
|
-
'@platformatic/db'
|
|
426
|
+
'@platformatic/db'
|
|
417
427
|
].includes(app.type)
|
|
418
428
|
) {
|
|
419
429
|
await this.#configurePlatformaticServices(runtime, app)
|
|
@@ -457,8 +467,8 @@ class Watt {
|
|
|
457
467
|
adapter: 'valkey',
|
|
458
468
|
url: `valkey://${username}:${password}@${host}:${port}`,
|
|
459
469
|
prefix: keyPrefix,
|
|
460
|
-
maxTTL: 604800
|
|
461
|
-
}
|
|
470
|
+
maxTTL: 604800 // 86400 * 7
|
|
471
|
+
}
|
|
462
472
|
})
|
|
463
473
|
}
|
|
464
474
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/watt-extra",
|
|
3
|
-
"version": "1.2.0",
|
|
3
|
+
"version": "1.2.1-alpha.0",
|
|
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",
|