@platformatic/service 2.69.0 → 2.70.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
@@ -435,7 +435,7 @@ export interface PlatformaticService {
435
435
  maxELU?: number | string;
436
436
  maxHeapUsed?: number | string;
437
437
  maxHeapTotal?: number | string;
438
- maxYoungGeneration?: number;
438
+ maxYoungGeneration?: number | string;
439
439
  };
440
440
  undici?: {
441
441
  agentOptions?: {
package/lib/stackable.js CHANGED
@@ -7,7 +7,6 @@ const { workerData } = require('node:worker_threads')
7
7
  const { printSchema } = require('graphql')
8
8
  const pino = require('pino')
9
9
  const { client, collectMetrics } = require('@platformatic/metrics')
10
- const httpMetrics = require('@platformatic/fastify-http-metrics')
11
10
  const { extractTypeScriptCompileOptionsFromConfig } = require('./compile')
12
11
  const { compile } = require('@platformatic/ts-compiler')
13
12
  const { deepmerge, buildPinoFormatters, buildPinoTimestamp } = require('@platformatic/utils')
@@ -214,18 +213,18 @@ class ServiceStackable {
214
213
  this.workerId,
215
214
  {
216
215
  defaultMetrics: true,
217
- httpMetrics: false,
216
+ httpMetrics: true,
218
217
  ...metricsConfig
219
218
  },
220
219
  this.metricsRegistry
221
220
  )
222
221
 
223
- this.#setHttpMetrics()
224
222
  this.#setHttpCacheMetrics()
225
223
  }
226
224
  }
227
225
 
228
- async getMetrics ({ format }) {
226
+ async getMetrics (opts) {
227
+ const format = opts?.format
229
228
  return format === 'json' ? await this.metricsRegistry.getMetricsAsJSON() : await this.metricsRegistry.metrics()
230
229
  }
231
230
 
@@ -276,42 +275,6 @@ class ServiceStackable {
276
275
  await globalThis[kITC].send('invalidateHttpCache', opts)
277
276
  }
278
277
 
279
- #setHttpMetrics () {
280
- this.app.register(httpMetrics, {
281
- registry: this.metricsRegistry,
282
- customLabels: ['telemetry_id'],
283
- getCustomLabels: req => {
284
- const telemetryId = req.headers['x-plt-telemetry-id'] ?? 'unknown'
285
- return { telemetry_id: telemetryId }
286
- },
287
- zeroFill: true
288
- })
289
-
290
- this.app.register(httpMetrics, {
291
- registry: this.metricsRegistry,
292
- customLabels: ['telemetry_id'],
293
- getCustomLabels: req => {
294
- const telemetryId = req.headers['x-plt-telemetry-id'] ?? 'unknown'
295
- return { telemetry_id: telemetryId }
296
- },
297
- histogram: {
298
- name: 'http_request_all_duration_seconds',
299
- help: 'request duration in seconds summary for all requests',
300
- collect: function () {
301
- process.nextTick(() => this.reset())
302
- }
303
- },
304
- summary: {
305
- name: 'http_request_all_summary_seconds',
306
- help: 'request duration in seconds histogram for all requests',
307
- collect: function () {
308
- process.nextTick(() => this.reset())
309
- }
310
- },
311
- zeroFill: true
312
- })
313
- }
314
-
315
278
  #setHttpCacheMetrics () {
316
279
  const { client, registry } = globalThis.platformatic.prometheus
317
280
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/service",
3
- "version": "2.69.0",
3
+ "version": "2.70.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -46,8 +46,7 @@
46
46
  "@fastify/static": "^8.0.0",
47
47
  "@fastify/swagger": "^9.0.0",
48
48
  "@fastify/under-pressure": "^9.0.0",
49
- "@platformatic/fastify-http-metrics": "^0.3.0",
50
- "@scalar/fastify-api-reference": "1.31.2",
49
+ "@scalar/fastify-api-reference": "1.31.8",
51
50
  "@types/ws": "^8.5.10",
52
51
  "ajv": "^8.12.0",
53
52
  "cli-progress": "^3.12.0",
@@ -76,14 +75,14 @@
76
75
  "rfdc": "^1.3.1",
77
76
  "semgrator": "^0.3.0",
78
77
  "undici": "^7.0.0",
79
- "@platformatic/client": "2.69.0",
80
- "@platformatic/generators": "2.69.0",
81
- "@platformatic/config": "2.69.0",
82
- "@platformatic/metrics": "2.69.0",
83
- "@platformatic/scalar-theme": "2.69.0",
84
- "@platformatic/telemetry": "2.69.0",
85
- "@platformatic/ts-compiler": "2.69.0",
86
- "@platformatic/utils": "2.69.0"
78
+ "@platformatic/client": "2.70.0",
79
+ "@platformatic/config": "2.70.0",
80
+ "@platformatic/metrics": "2.70.0",
81
+ "@platformatic/scalar-theme": "2.70.0",
82
+ "@platformatic/generators": "2.70.0",
83
+ "@platformatic/telemetry": "2.70.0",
84
+ "@platformatic/ts-compiler": "2.70.0",
85
+ "@platformatic/utils": "2.70.0"
87
86
  },
88
87
  "scripts": {
89
88
  "test": "pnpm run lint && borp -T --concurrency=1 --timeout=300000 && tsd",
package/schema.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/service/2.69.0.json",
3
- "version": "2.69.0",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/service/2.70.0.json",
3
+ "version": "2.70.0",
4
4
  "title": "Platformatic Service",
5
5
  "type": "object",
6
6
  "properties": {
@@ -1498,7 +1498,6 @@
1498
1498
  "default": {},
1499
1499
  "properties": {
1500
1500
  "enabled": {
1501
- "default": true,
1502
1501
  "anyOf": [
1503
1502
  {
1504
1503
  "type": "boolean"
@@ -1506,10 +1505,10 @@
1506
1505
  {
1507
1506
  "type": "string"
1508
1507
  }
1509
- ]
1508
+ ],
1509
+ "default": true
1510
1510
  },
1511
1511
  "interval": {
1512
- "default": 30000,
1513
1512
  "anyOf": [
1514
1513
  {
1515
1514
  "type": "number",
@@ -1518,10 +1517,10 @@
1518
1517
  {
1519
1518
  "type": "string"
1520
1519
  }
1521
- ]
1520
+ ],
1521
+ "default": 30000
1522
1522
  },
1523
1523
  "gracePeriod": {
1524
- "default": 30000,
1525
1524
  "anyOf": [
1526
1525
  {
1527
1526
  "type": "number",
@@ -1530,10 +1529,10 @@
1530
1529
  {
1531
1530
  "type": "string"
1532
1531
  }
1533
- ]
1532
+ ],
1533
+ "default": 30000
1534
1534
  },
1535
1535
  "maxUnhealthyChecks": {
1536
- "default": 10,
1537
1536
  "anyOf": [
1538
1537
  {
1539
1538
  "type": "number",
@@ -1542,10 +1541,10 @@
1542
1541
  {
1543
1542
  "type": "string"
1544
1543
  }
1545
- ]
1544
+ ],
1545
+ "default": 10
1546
1546
  },
1547
1547
  "maxELU": {
1548
- "default": 0.99,
1549
1548
  "anyOf": [
1550
1549
  {
1551
1550
  "type": "number",
@@ -1555,10 +1554,10 @@
1555
1554
  {
1556
1555
  "type": "string"
1557
1556
  }
1558
- ]
1557
+ ],
1558
+ "default": 0.99
1559
1559
  },
1560
1560
  "maxHeapUsed": {
1561
- "default": 0.99,
1562
1561
  "anyOf": [
1563
1562
  {
1564
1563
  "type": "number",
@@ -1568,10 +1567,10 @@
1568
1567
  {
1569
1568
  "type": "string"
1570
1569
  }
1571
- ]
1570
+ ],
1571
+ "default": 0.99
1572
1572
  },
1573
1573
  "maxHeapTotal": {
1574
- "default": 4294967296,
1575
1574
  "anyOf": [
1576
1575
  {
1577
1576
  "type": "number",
@@ -1580,11 +1579,19 @@
1580
1579
  {
1581
1580
  "type": "string"
1582
1581
  }
1583
- ]
1582
+ ],
1583
+ "default": 4294967296
1584
1584
  },
1585
1585
  "maxYoungGeneration": {
1586
- "type": "number",
1587
- "minimum": 0
1586
+ "anyOf": [
1587
+ {
1588
+ "type": "number",
1589
+ "minimum": 0
1590
+ },
1591
+ {
1592
+ "type": "string"
1593
+ }
1594
+ ]
1588
1595
  }
1589
1596
  },
1590
1597
  "additionalProperties": false