ask-observability 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0e28b911f472b83c6a7c93bcd632b9fe981fb39aa6a73e43dbeadc287199faa
4
- data.tar.gz: 8480c74048d04b7e9cf83bfe9614d5d927bdb31865f11a5e159db2ba3ccbce26
3
+ metadata.gz: 549f5d104e27f6371900acc3579f940a6bc3ec1fbf933445cd911ffab5ebf801
4
+ data.tar.gz: 9811767916dda5c42acf250cb5b075c4ef9308aea13e8ab93399743cf1ae1c82
5
5
  SHA512:
6
- metadata.gz: 49f733327ed7c5c5f3c53931919c41bb7234ec2b487f0dae8d85814cfa3eb3416009cc53e2deba9901d6bb00f1991db5e1ececfed726fe02c274628c031ee65e
7
- data.tar.gz: ac2fa10d43298f99c045c3136bc9c524b1f50f1c9251378907d9df69c9b8f4ee9144284faa5afa3bd6e041784f7253bdaba796232f751224901f5c28d6931baa
6
+ metadata.gz: 442df00b0cfcc90bc71b717bf057e724d7b4c4d71c82c699610be42a283ea883e08572ef76abc198c7cbaa294642849bc85ab587cae598d9eb937193394c4a54
7
+ data.tar.gz: 3428f8eaf083148b2c62f7c506efb1893927670ee35d587bcbe55e18d91bc93cc28c42365c59025dde50fbae3c905409607cd3a1fbfa21e117ea7d6b3878eb19
data/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.1] - 2026-08-06
11
+
12
+ ### Added
13
+
14
+ - `Ask::Observability.counter` / `Ask::Observability.histogram` — reload-safe
15
+ register-or-resolve accessors on the shared registry. App files that
16
+ register metrics are re-evaluated by Zeitwerk during development reloads,
17
+ which re-registered the same names against a registry that still held them
18
+ and raised `AlreadyRegisteredError` (surfacing as a 500 in the host app);
19
+ the accessors resolve the existing metric instead.
20
+
10
21
  ## [0.1.0] - 2026-08-06
11
22
 
12
23
  ### Added
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Observability
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
@@ -65,6 +65,30 @@ module Ask
65
65
 
66
66
  attr_writer :registry
67
67
 
68
+ # Register-or-resolve a counter on the shared registry. Reload-safe:
69
+ # in development, Zeitwerk re-evaluates app files that register
70
+ # metrics, which would re-register the same name against a registry
71
+ # that still holds it and raise AlreadyRegisteredError (surfacing as
72
+ # a 500 in the app). Resolving the existing metric keeps registrations
73
+ # idempotent instead.
74
+ #
75
+ # @param name [Symbol] metric name, e.g. :voice_turns_total
76
+ # @return [Prometheus::Client::Counter]
77
+ def counter(name, **kwargs)
78
+ registry.get(name) || registry.counter(name, **kwargs)
79
+ rescue Prometheus::Client::Registry::AlreadyRegisteredError
80
+ registry.get(name)
81
+ end
82
+
83
+ # Register-or-resolve a histogram (see #counter).
84
+ #
85
+ # @return [Prometheus::Client::Histogram]
86
+ def histogram(name, **kwargs)
87
+ registry.get(name) || registry.histogram(name, **kwargs)
88
+ rescue Prometheus::Client::Registry::AlreadyRegisteredError
89
+ registry.get(name)
90
+ end
91
+
68
92
  # Subscribe to every ask-instrumentation event and start maintaining
69
93
  # Prometheus metrics. Idempotent — subsequent calls are no-ops.
70
94
  def install
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-observability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto