@platformatic/runtime 1.51.8 → 1.52.1

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,33 @@
1
+ {
2
+ "$schema": "https://platformatic.dev/schemas/v0.20.0/runtime",
3
+ "entrypoint": "serviceApp",
4
+ "allowCycles": true,
5
+ "hotReload": false,
6
+ "managementApi": false,
7
+ "autoload": {
8
+ "path": "../monorepo",
9
+ "exclude": [
10
+ "docs",
11
+ "composerApp"
12
+ ],
13
+ "mappings": {
14
+ "serviceAppWithLogger": {
15
+ "id": "with-logger",
16
+ "config": "platformatic.service.json"
17
+ },
18
+ "serviceAppWithMultiplePlugins": {
19
+ "id": "multi-plugin-service",
20
+ "config": "platformatic.service.json"
21
+ },
22
+ "dbApp": {
23
+ "id": "db-app",
24
+ "config": "platformatic.db.json"
25
+ }
26
+ }
27
+ },
28
+ "metrics": {
29
+ "labels": {
30
+ "app": "serviceApp"
31
+ }
32
+ }
33
+ }
package/lib/api-client.js CHANGED
@@ -170,10 +170,6 @@ class RuntimeApiClient extends EventEmitter {
170
170
 
171
171
  if (metrics === null) return null
172
172
 
173
- const entrypointDetails = await this.getEntrypointDetails()
174
- const entrypointConfig = await this.getServiceConfig(entrypointDetails.id)
175
- const entrypointMetricsPrefix = entrypointConfig.metrics?.prefix
176
-
177
173
  const cpuMetric = metrics.find(
178
174
  (metric) => metric.name === 'process_cpu_percent_usage'
179
175
  )
@@ -204,28 +200,27 @@ class RuntimeApiClient extends EventEmitter {
204
200
  let p95Value = 0
205
201
  let p99Value = 0
206
202
 
207
- if (entrypointMetricsPrefix) {
208
- const metricName = entrypointMetricsPrefix + 'http_request_all_summary_seconds'
209
- const httpLatencyMetrics = metrics.find((metric) => metric.name === metricName)
210
-
211
- p50Value = httpLatencyMetrics.values.find(
212
- (value) => value.labels.quantile === 0.5
213
- ).value || 0
214
- p90Value = httpLatencyMetrics.values.find(
215
- (value) => value.labels.quantile === 0.9
216
- ).value || 0
217
- p95Value = httpLatencyMetrics.values.find(
218
- (value) => value.labels.quantile === 0.95
219
- ).value || 0
220
- p99Value = httpLatencyMetrics.values.find(
221
- (value) => value.labels.quantile === 0.99
222
- ).value || 0
223
-
224
- p50Value = Math.round(p50Value * 1000)
225
- p90Value = Math.round(p90Value * 1000)
226
- p95Value = Math.round(p95Value * 1000)
227
- p99Value = Math.round(p99Value * 1000)
228
- }
203
+ const metricName = 'http_request_all_summary_seconds'
204
+ const httpLatencyMetrics =
205
+ metrics.find((metric) => metric.name === metricName)
206
+
207
+ p50Value = httpLatencyMetrics.values.find(
208
+ (value) => value.labels.quantile === 0.5
209
+ ).value || 0
210
+ p90Value = httpLatencyMetrics.values.find(
211
+ (value) => value.labels.quantile === 0.9
212
+ ).value || 0
213
+ p95Value = httpLatencyMetrics.values.find(
214
+ (value) => value.labels.quantile === 0.95
215
+ ).value || 0
216
+ p99Value = httpLatencyMetrics.values.find(
217
+ (value) => value.labels.quantile === 0.99
218
+ ).value || 0
219
+
220
+ p50Value = Math.round(p50Value * 1000)
221
+ p90Value = Math.round(p90Value * 1000)
222
+ p95Value = Math.round(p95Value * 1000)
223
+ p99Value = Math.round(p99Value * 1000)
229
224
 
230
225
  const cpu = cpuMetric.values[0].value
231
226
  const rss = rssMetric.values[0].value
package/lib/app.js CHANGED
@@ -4,7 +4,6 @@ const { dirname } = require('node:path')
4
4
  const { EventEmitter, once } = require('node:events')
5
5
  const { FileWatcher } = require('@platformatic/utils')
6
6
  const debounce = require('debounce')
7
- const { snakeCase } = require('change-case-all')
8
7
  const { buildServer } = require('./build-server')
9
8
  const { loadConfig } = require('./load-config')
10
9
  const errors = require('./errors')
@@ -275,13 +274,18 @@ class PlatformaticApp extends EventEmitter {
275
274
  (this.#hasManagementApi && configManager.current.metrics === undefined) ||
276
275
  configManager.current.metrics
277
276
  ) {
277
+ const labels = configManager.current.metrics?.labels || {}
278
+ const serviceId = this.appConfig.id
278
279
  configManager.update({
279
280
  ...configManager.current,
280
281
  metrics: {
281
282
  server: 'hide',
282
283
  defaultMetrics: { enabled: this.appConfig.entrypoint },
283
- prefix: snakeCase(this.appConfig.id) + '_',
284
- ...configManager.current.metrics
284
+ ...configManager.current.metrics,
285
+ labels: {
286
+ serviceId,
287
+ ...labels
288
+ }
285
289
  }
286
290
  })
287
291
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/runtime",
3
- "version": "1.51.8",
3
+ "version": "1.52.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -34,8 +34,8 @@
34
34
  "typescript": "^5.4.2",
35
35
  "undici-oidc-interceptor": "^0.5.0",
36
36
  "why-is-node-running": "^2.2.2",
37
- "@platformatic/sql-graphql": "1.51.8",
38
- "@platformatic/sql-mapper": "1.51.8"
37
+ "@platformatic/sql-graphql": "1.52.1",
38
+ "@platformatic/sql-mapper": "1.52.1"
39
39
  },
40
40
  "dependencies": {
41
41
  "@fastify/error": "^3.4.1",
@@ -63,14 +63,14 @@
63
63
  "undici": "^6.9.0",
64
64
  "why-is-node-running": "^2.2.2",
65
65
  "ws": "^8.16.0",
66
- "@platformatic/bus": "1.51.8",
67
- "@platformatic/composer": "1.51.8",
68
- "@platformatic/config": "1.51.8",
69
- "@platformatic/db": "1.51.8",
70
- "@platformatic/generators": "1.51.8",
71
- "@platformatic/service": "1.51.8",
72
- "@platformatic/telemetry": "1.51.8",
73
- "@platformatic/utils": "1.51.8"
66
+ "@platformatic/bus": "1.52.1",
67
+ "@platformatic/config": "1.52.1",
68
+ "@platformatic/composer": "1.52.1",
69
+ "@platformatic/generators": "1.52.1",
70
+ "@platformatic/service": "1.52.1",
71
+ "@platformatic/telemetry": "1.52.1",
72
+ "@platformatic/db": "1.52.1",
73
+ "@platformatic/utils": "1.52.1"
74
74
  },
75
75
  "standard": {
76
76
  "ignore": [