@platformatic/service 2.26.0-alpha.1 → 2.26.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/lib/stackable.js CHANGED
@@ -195,6 +195,7 @@ class ServiceStackable {
195
195
  )
196
196
 
197
197
  this.#setHttpMetrics()
198
+ this.#setHttpCacheMetrics()
198
199
  }
199
200
  }
200
201
 
@@ -283,6 +284,25 @@ class ServiceStackable {
283
284
  })
284
285
  }
285
286
 
287
+ #setHttpCacheMetrics () {
288
+ const { client, registry } = globalThis.platformatic.prometheus
289
+
290
+ const cacheHitMetric = new client.Counter({
291
+ name: 'http_cache_hit_count',
292
+ help: 'Number of http cache hits',
293
+ registers: [registry]
294
+ })
295
+
296
+ const cacheMissMetric = new client.Counter({
297
+ name: 'http_cache_miss_count',
298
+ help: 'Number of http cache misses',
299
+ registers: [registry]
300
+ })
301
+
302
+ globalThis.platformatic.onHttpCacheHit = () => { cacheHitMetric.inc() }
303
+ globalThis.platformatic.onHttpCacheMiss = () => { cacheMissMetric.inc() }
304
+ }
305
+
286
306
  #updateConfig () {
287
307
  if (!this.context) return
288
308
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/service",
3
- "version": "2.26.0-alpha.1",
3
+ "version": "2.26.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -76,14 +76,14 @@
76
76
  "rfdc": "^1.3.1",
77
77
  "semgrator": "^0.3.0",
78
78
  "undici": "^7.0.0",
79
- "@platformatic/client": "2.26.0-alpha.1",
80
- "@platformatic/metrics": "2.26.0-alpha.1",
81
- "@platformatic/scalar-theme": "2.26.0-alpha.1",
82
- "@platformatic/telemetry": "2.26.0-alpha.1",
83
- "@platformatic/config": "2.26.0-alpha.1",
84
- "@platformatic/generators": "2.26.0-alpha.1",
85
- "@platformatic/ts-compiler": "2.26.0-alpha.1",
86
- "@platformatic/utils": "2.26.0-alpha.1"
79
+ "@platformatic/metrics": "2.26.0",
80
+ "@platformatic/config": "2.26.0",
81
+ "@platformatic/client": "2.26.0",
82
+ "@platformatic/generators": "2.26.0",
83
+ "@platformatic/scalar-theme": "2.26.0",
84
+ "@platformatic/telemetry": "2.26.0",
85
+ "@platformatic/ts-compiler": "2.26.0",
86
+ "@platformatic/utils": "2.26.0"
87
87
  },
88
88
  "scripts": {
89
89
  "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.26.0-alpha.1.json",
3
- "version": "2.26.0-alpha.1",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/service/2.26.0.json",
3
+ "version": "2.26.0",
4
4
  "title": "Platformatic Service",
5
5
  "type": "object",
6
6
  "properties": {