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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 549f5d104e27f6371900acc3579f940a6bc3ec1fbf933445cd911ffab5ebf801
4
- data.tar.gz: 9811767916dda5c42acf250cb5b075c4ef9308aea13e8ab93399743cf1ae1c82
3
+ metadata.gz: ffbf52d9051f77149044a23bff976f8e1fe9558a9915e4f48f5b2c0fbf6cbe52
4
+ data.tar.gz: ba7ea476ca3526ba574c653563e30d1fdeab6a61865345c54bf21205cd560053
5
5
  SHA512:
6
- metadata.gz: 442df00b0cfcc90bc71b717bf057e724d7b4c4d71c82c699610be42a283ea883e08572ef76abc198c7cbaa294642849bc85ab587cae598d9eb937193394c4a54
7
- data.tar.gz: 3428f8eaf083148b2c62f7c506efb1893927670ee35d587bcbe55e18d91bc93cc28c42365c59025dde50fbae3c905409607cd3a1fbfa21e117ea7d6b3878eb19
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
- input = payload[:input_tokens].to_i
55
- output = payload[:output_tokens].to_i
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?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Observability
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto