@platformatic/watt-extra 1.11.1-alpha.0 → 1.11.2-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/package.json +1 -1
- package/plugins/env.js +5 -3
- package/plugins/health-signals.js +18 -2
package/package.json
CHANGED
package/plugins/env.js
CHANGED
|
@@ -25,11 +25,13 @@ const schema = {
|
|
|
25
25
|
PLT_FLAMEGRAPHS_CACHE_CLEANUP_INTERVAL: { type: 'number', default: 120000 },
|
|
26
26
|
PLT_JWT_EXPIRATION_OFFSET_SEC: { type: 'number', default: 60 },
|
|
27
27
|
PLT_UPDATES_RECONNECT_INTERVAL_SEC: { type: 'number', default: 1 },
|
|
28
|
-
PLT_ELU_HEALTH_SIGNAL_THRESHOLD: { type: 'number', default: 0.
|
|
29
|
-
PLT_HEAP_HEALTH_SIGNAL_THRESHOLD: { type: ['number', 'string'], default: '
|
|
28
|
+
PLT_ELU_HEALTH_SIGNAL_THRESHOLD: { type: 'number', default: 0.7 },
|
|
29
|
+
PLT_HEAP_HEALTH_SIGNAL_THRESHOLD: { type: ['number', 'string'], default: '400MB' },
|
|
30
30
|
PLT_ALERTS_GRACE_PERIOD_SEC: { type: 'number', default: 30 },
|
|
31
31
|
PLT_HEALTH_SIGNALS_SHORT_BATCH_TIMEOUT: { type: 'number', default: 5000 },
|
|
32
|
-
PLT_HEALTH_SIGNALS_LONG_BATCH_TIMEOUT: { type: 'number', default: 30000 }
|
|
32
|
+
PLT_HEALTH_SIGNALS_LONG_BATCH_TIMEOUT: { type: 'number', default: 30000 },
|
|
33
|
+
PLT_HEALTH_SIGNALS_ELU_BATCH_THRESHOLD: { type: 'number', default: 0.5 },
|
|
34
|
+
PLT_HEALTH_SIGNALS_HEAP_BATCH_THRESHOLD: { type: ['number', 'string'], default: '300MB' },
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -86,15 +86,31 @@ async function healthSignals (app, _opts) {
|
|
|
86
86
|
const runtime = app.watt.runtime
|
|
87
87
|
const batchShortTimeout = app.env.PLT_HEALTH_SIGNALS_SHORT_BATCH_TIMEOUT
|
|
88
88
|
const batchLongTimeout = app.env.PLT_HEALTH_SIGNALS_LONG_BATCH_TIMEOUT
|
|
89
|
+
|
|
89
90
|
eluThreshold = app.env.PLT_ELU_HEALTH_SIGNAL_THRESHOLD
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
let eluBatchThreshold = app.env.PLT_HEALTH_SIGNALS_ELU_BATCH_THRESHOLD
|
|
93
|
+
if (eluBatchThreshold > eluThreshold) {
|
|
94
|
+
eluBatchThreshold = eluThreshold
|
|
95
|
+
}
|
|
96
|
+
|
|
92
97
|
let heapThreshold = app.env.PLT_HEAP_HEALTH_SIGNAL_THRESHOLD
|
|
93
98
|
if (typeof heapThreshold === 'string') {
|
|
94
99
|
heapThreshold = parseMemorySize(heapThreshold)
|
|
95
100
|
}
|
|
101
|
+
|
|
102
|
+
let heapBatchThreshold = app.env.PLT_HEALTH_SIGNALS_HEAP_BATCH_THRESHOLD
|
|
103
|
+
if (typeof heapBatchThreshold === 'string') {
|
|
104
|
+
heapBatchThreshold = parseMemorySize(heapBatchThreshold)
|
|
105
|
+
}
|
|
106
|
+
|
|
96
107
|
heapThresholdMb = Math.round(heapThreshold / 1024 / 1024)
|
|
97
108
|
|
|
109
|
+
let heapBatchThresholdMb = Math.round(heapBatchThreshold / 1024 / 1024)
|
|
110
|
+
if (heapBatchThresholdMb > heapThresholdMb) {
|
|
111
|
+
heapBatchThresholdMb = heapThresholdMb
|
|
112
|
+
}
|
|
113
|
+
|
|
98
114
|
let batchHasHighValue = false
|
|
99
115
|
let batchStartedAt = null
|
|
100
116
|
|
|
@@ -157,7 +173,7 @@ async function healthSignals (app, _opts) {
|
|
|
157
173
|
heapTotalByService[serviceId] = heapTotal
|
|
158
174
|
signalsCache.addServiceSignals(serviceId, healthSignals)
|
|
159
175
|
|
|
160
|
-
if (elu >
|
|
176
|
+
if (elu > eluBatchThreshold || heapUsedMb > heapBatchThresholdMb) {
|
|
161
177
|
batchHasHighValue = true
|
|
162
178
|
}
|
|
163
179
|
}
|