ask-observability 0.1.1 → 0.1.2
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 +12 -0
- data/lib/ask/observability/subscriber.rb +6 -2
- data/lib/ask/observability/version.rb +1 -1
- 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: ffbf52d9051f77149044a23bff976f8e1fe9558a9915e4f48f5b2c0fbf6cbe52
|
|
4
|
+
data.tar.gz: ba7ea476ca3526ba574c653563e30d1fdeab6a61865345c54bf21205cd560053
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 60276bbf6712ffb8bf5fe68bcbc70fa22ef7f48667ace0e1de3c220b63bf35e7d6879a8b2d5d9dba6e8df1650c081f581b27778faf7807e1a9eb73fc158f40f0
|
|
7
|
+
data.tar.gz: 9b4ac302576e3fca200f30490c536dc854002d64dd20b787d9d556d27168e8022d17bab2415564f4567524c40d0f158ae8781c80eb9b099836f711f20eef58ca
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.2] - 2026-08-06
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **Token metrics read from the nested `usage` payload hash.** ask-agent now
|
|
15
|
+
enriches `chat.ask` events with a shared nested `usage` hash (tokens/cost
|
|
16
|
+
are only known after the LLM call returns, and the instrumenter
|
|
17
|
+
shallow-copies the top-level payload). The subscriber reads
|
|
18
|
+
`payload[:usage]` first and falls back to top-level
|
|
19
|
+
`input_tokens`/`output_tokens` for other emitters, so
|
|
20
|
+
`ask_llm_tokens_total` counts correctly again.
|
|
21
|
+
|
|
10
22
|
## [0.1.1] - 2026-08-06
|
|
11
23
|
|
|
12
24
|
### Added
|
|
@@ -51,8 +51,12 @@ module Ask
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def record_tokens(metrics, labels, payload)
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
# Chat events emitted by ask-agent enrich a shared nested +usage+
|
|
55
|
+
# hash after the call returns (tokens/cost are only known then);
|
|
56
|
+
# other emitters pass input/output tokens at the top level.
|
|
57
|
+
usage = payload[:usage] || payload
|
|
58
|
+
input = usage[:input_tokens].to_i
|
|
59
|
+
output = usage[:output_tokens].to_i
|
|
56
60
|
return if input.zero? && output.zero?
|
|
57
61
|
|
|
58
62
|
metrics.tokens_total.increment(by: input, labels: labels.merge(direction: 'input')) if input.positive?
|