@platformatic/metrics 3.23.0 → 3.24.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/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import collectHttpMetrics from '@platformatic/http-metrics'
2
2
  import os from 'node:os'
3
3
  import { performance } from 'node:perf_hooks'
4
- import client from 'prom-client'
4
+ import client from '@platformatic/prom-client'
5
5
 
6
- export * as client from 'prom-client'
6
+ export * as client from '@platformatic/prom-client'
7
7
 
8
8
  const { eventLoopUtilization } = performance
9
9
  const { Registry, Gauge, Counter, collectDefaultMetrics } = client
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/metrics",
3
- "version": "3.23.0",
3
+ "version": "3.24.0",
4
4
  "description": "Platformatic Capability Metrics",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -15,9 +15,9 @@
15
15
  },
16
16
  "homepage": "https://github.com/platformatic/platformatic#readme",
17
17
  "dependencies": {
18
- "@platformatic/http-metrics": "^0.2.1",
18
+ "@platformatic/http-metrics": "^0.3.0",
19
19
  "@platformatic/promotel": "^0.1.0",
20
- "prom-client": "^15.1.2"
20
+ "@platformatic/prom-client": "^1.0.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "cleaner-spec-reporter": "^0.5.0",
@@ -74,8 +74,9 @@ test('httpMetrics creates histogram and summary with collect functions', async (
74
74
  test('httpMetrics histogram resets after metric collection', async () => {
75
75
  const result = await collectMetrics('test-service', 1, { httpMetrics: true })
76
76
 
77
- const metricObjects = result.registry._metrics
78
- const histogramMetric = metricObjects.http_request_all_duration_seconds
77
+ // Get the histogram metric using the public API
78
+ const histogramMetric = result.registry.getSingleMetric('http_request_all_duration_seconds')
79
+ assert.ok(histogramMetric, 'histogram metric should exist')
79
80
 
80
81
  histogramMetric.observe({ method: 'GET', telemetry_id: 'test' }, 0.1)
81
82
  histogramMetric.observe({ method: 'GET', telemetry_id: 'test' }, 0.2)
@@ -101,8 +102,9 @@ test('httpMetrics histogram resets after metric collection', async () => {
101
102
  test('httpMetrics summary resets after metric collection', async () => {
102
103
  const result = await collectMetrics('test-service', 1, { httpMetrics: true })
103
104
 
104
- const metricObjects = result.registry._metrics
105
- const summaryMetric = metricObjects.http_request_all_summary_seconds
105
+ // Get the summary metric using the public API
106
+ const summaryMetric = result.registry.getSingleMetric('http_request_all_summary_seconds')
107
+ assert.ok(summaryMetric, 'summary metric should exist')
106
108
 
107
109
  summaryMetric.observe({ method: 'POST', telemetry_id: 'test' }, 0.15)
108
110
  summaryMetric.observe({ method: 'POST', telemetry_id: 'test' }, 0.25)