@platformatic/watt-extra 1.5.2 → 1.5.3-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.
@@ -0,0 +1,11 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Read(//work/workspaces/workspace-platformatic/platformatic/**)",
5
+ "Bash(npx borp:*)",
6
+ "Bash(timeout 30 npx borp -c 1 --timeout=20000 ./test/trigger-flamegraphs.test.js)"
7
+ ],
8
+ "deny": [],
9
+ "ask": []
10
+ }
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/watt-extra",
3
- "version": "1.5.2",
3
+ "version": "1.5.3-alpha.0",
4
4
  "description": "The Platformatic runtime manager",
5
5
  "type": "module",
6
6
  "scripts": {
package/plugins/alerts.js CHANGED
@@ -75,7 +75,7 @@ async function alerts (app, _opts) {
75
75
  if (healthInfo.unhealthy) {
76
76
  const currentTime = Date.now()
77
77
 
78
- const serviceId = healthInfo.id
78
+ const serviceId = healthInfo.application
79
79
  const lastAlertTime = lastServicesAlertTime[serviceId]
80
80
 
81
81
  if (lastAlertTime && currentTime - lastAlertTime < alertRetentionWindow) {
@@ -63,7 +63,7 @@ test('should send alert when service becomes unhealthy', async (t) => {
63
63
  // Manually trigger health event with unhealthy state
64
64
  const healthInfo = {
65
65
  id: 'main:0',
66
- service: 'main',
66
+ application: 'main',
67
67
  currentHealth: {
68
68
  elu: 0.95,
69
69
  heapUsed: 76798040,
@@ -90,7 +90,7 @@ test('should send alert when service becomes unhealthy', async (t) => {
90
90
  assert.deepStrictEqual(alertReceived.alert, healthInfo)
91
91
  assert.ok(Array.isArray(alertReceived.healthHistory), 'Health history should be an array')
92
92
  assert.ok(alertReceived.healthHistory.length > 0, 'Health history should not be empty')
93
- assert.strictEqual(alertReceived.healthHistory[0].service, 'main')
93
+ assert.strictEqual(alertReceived.healthHistory[0].application, 'main')
94
94
 
95
95
  assert.ok(flamegraphReceived, 'Flamegraph should have been received')
96
96
 
@@ -98,7 +98,7 @@ test('should send alert when service becomes unhealthy', async (t) => {
98
98
  assert.ok(profile, 'Profile should be decoded')
99
99
  })
100
100
 
101
- test('should not send alert when service is healthy', async (t) => {
101
+ test('should not send alert when application is healthy', async (t) => {
102
102
  const applicationName = 'test-app'
103
103
  const applicationId = randomUUID()
104
104
  const applicationPath = join(__dirname, 'fixtures', 'service-1')
@@ -137,7 +137,7 @@ test('should not send alert when service is healthy', async (t) => {
137
137
  // Manually trigger health event with healthy state
138
138
  const healthInfo = {
139
139
  id: 'service-1',
140
- service: 'service-1',
140
+ application: 'service-1',
141
141
  currentHealth: {
142
142
  elu: 0.5,
143
143
  heapUsed: 76798040,
@@ -204,7 +204,7 @@ test('should cache health data and include it in alerts', async (t) => {
204
204
  for (let i = 0; i < 3; i++) {
205
205
  const healthyInfo = {
206
206
  id: 'service-1',
207
- service: 'service-1',
207
+ application: 'service-1',
208
208
  currentHealth: {
209
209
  elu: 0.5 + (i * 0.1), // Different values to distinguish them
210
210
  heapUsed: 76798040,
@@ -229,7 +229,7 @@ test('should cache health data and include it in alerts', async (t) => {
229
229
  // Now send an unhealthy event to trigger alert
230
230
  const unhealthyInfo = {
231
231
  id: 'service-1',
232
- service: 'service-1',
232
+ application: 'service-1',
233
233
  currentHealth: {
234
234
  elu: 0.95,
235
235
  heapUsed: 76798040,
@@ -363,9 +363,9 @@ test('should respect alert retention window', async (t) => {
363
363
  })
364
364
 
365
365
  // Create a health info template
366
- const createHealthInfo = (serviceId, unhealthy = true) => ({
367
- id: serviceId,
368
- service: serviceId,
366
+ const createHealthInfo = (applicationId, unhealthy = true) => ({
367
+ id: applicationId,
368
+ application: applicationId,
369
369
  currentHealth: {
370
370
  elu: unhealthy ? 0.95 : 0.5,
371
371
  heapUsed: 76798040,