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 +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/ask/observability/version.rb +1 -1
- data/lib/ask/observability.rb +24 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 549f5d104e27f6371900acc3579f940a6bc3ec1fbf933445cd911ffab5ebf801
|
|
4
|
+
data.tar.gz: 9811767916dda5c42acf250cb5b075c4ef9308aea13e8ab93399743cf1ae1c82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
data/lib/ask/observability.rb
CHANGED
|
@@ -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
|