ruby_llm-monitoring 0.3.2 → 0.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +23 -0
- data/lib/ruby_llm/monitoring/event_subscriber.rb +14 -1
- data/lib/ruby_llm/monitoring/version.rb +1 -1
- data/lib/ruby_llm/monitoring.rb +0 -1
- metadata +4 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eddb4eebd89f93624b6db25247f32a964b0489990bf534a05748f1e43931b808
|
|
4
|
+
data.tar.gz: fcfee70fb200b3356880c6a1a2b11185efcd7e2d6930dcad1a08be39b010c7b9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f87e5d756fbfab8d3c06a71e43d618e4fae9f6f381903fd792e40cf3947cf7ac864c268464f843ff9bcf2cdb5b005d97781bed3122199f6660c0e59a0f02af44
|
|
7
|
+
data.tar.gz: 81b5902bf327691822278f22521ee787a0c95882d78b4378e6e8e0e5d7c52759c4b5f74b09d9f1e6da49480bd7574215da2580f409b9216f305a5b6ce643df6c
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.4.0] - 2026-06-09
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Drop `ruby_llm-instrumentation` dependency in favor of the built-in instrumentation available in `ruby_llm >= 1.16`. [#87](https://github.com/sinaptia/ruby_llm-monitoring/pull/87) [@patriciomacadden](https://github.com/patriciomacadden)
|
|
13
|
+
|
|
8
14
|
## [0.3.2] - 2026-04-07
|
|
9
15
|
|
|
10
16
|
### Fixed
|
data/README.md
CHANGED
|
@@ -250,6 +250,29 @@ RubyLLM::Monitoring.channels = {
|
|
|
250
250
|
}
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
+
|
|
254
|
+
## Data retention
|
|
255
|
+
|
|
256
|
+
RubyLLM::Monitoring records an event for every instrumented LLM call. Those events are kept indefinitely, the engine does not automatically prune them. If you need a retention policy, add it in your application using whatever cadence and storage requirements fit your deployment.
|
|
257
|
+
|
|
258
|
+
For example, to keep 90 days of monitoring data:
|
|
259
|
+
|
|
260
|
+
```ruby
|
|
261
|
+
# app/jobs/prune_ruby_llm_monitoring_events_job.rb
|
|
262
|
+
class PruneRubyLLMMonitoringEventsJob < ApplicationJob
|
|
263
|
+
queue_as :default
|
|
264
|
+
|
|
265
|
+
def perform(retention_period = 90.days)
|
|
266
|
+
RubyLLM::Monitoring::Event
|
|
267
|
+
.where(created_at: ...retention_period.ago)
|
|
268
|
+
.in_batches(of: 1_000)
|
|
269
|
+
.delete_all
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Then schedule the job with your application's scheduler of choice, such as cron, Solid Queue recurring tasks, or GoodJob cron.
|
|
275
|
+
|
|
253
276
|
## Contributing
|
|
254
277
|
|
|
255
278
|
You can open an issue or a PR in GitHub.
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
module RubyLLM
|
|
2
2
|
module Monitoring
|
|
3
3
|
class EventSubscriber
|
|
4
|
+
FILTERED_PAYLOAD_KEYS = %i[
|
|
5
|
+
chat
|
|
6
|
+
input_messages
|
|
7
|
+
messages_after
|
|
8
|
+
model_info
|
|
9
|
+
response
|
|
10
|
+
result
|
|
11
|
+
schema
|
|
12
|
+
tool
|
|
13
|
+
tool_call
|
|
14
|
+
tool_calls
|
|
15
|
+
].freeze
|
|
16
|
+
|
|
4
17
|
def call(event)
|
|
5
18
|
Event.create(
|
|
6
19
|
allocations: event.allocations,
|
|
@@ -10,7 +23,7 @@ module RubyLLM
|
|
|
10
23
|
gc_time: event.gc_time,
|
|
11
24
|
idle_time: event.idle_time,
|
|
12
25
|
name: event.name,
|
|
13
|
-
payload: event.payload.except(
|
|
26
|
+
payload: event.payload.except(*FILTERED_PAYLOAD_KEYS).compact,
|
|
14
27
|
time: event.time,
|
|
15
28
|
transaction_id: event.transaction_id
|
|
16
29
|
)
|
data/lib/ruby_llm/monitoring.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_llm-monitoring
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Patricio Mac Adden
|
|
@@ -57,28 +57,14 @@ dependencies:
|
|
|
57
57
|
requirements:
|
|
58
58
|
- - ">="
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '
|
|
61
|
-
type: :runtime
|
|
62
|
-
prerelease: false
|
|
63
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
-
requirements:
|
|
65
|
-
- - ">="
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: '0'
|
|
68
|
-
- !ruby/object:Gem::Dependency
|
|
69
|
-
name: ruby_llm-instrumentation
|
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - ">="
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '0.1'
|
|
60
|
+
version: '1.16'
|
|
75
61
|
type: :runtime
|
|
76
62
|
prerelease: false
|
|
77
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
64
|
requirements:
|
|
79
65
|
- - ">="
|
|
80
66
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '
|
|
67
|
+
version: '1.16'
|
|
82
68
|
- !ruby/object:Gem::Dependency
|
|
83
69
|
name: stimulus-rails
|
|
84
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -195,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
195
181
|
- !ruby/object:Gem::Version
|
|
196
182
|
version: '0'
|
|
197
183
|
requirements: []
|
|
198
|
-
rubygems_version:
|
|
184
|
+
rubygems_version: 4.0.10
|
|
199
185
|
specification_version: 4
|
|
200
186
|
summary: Monitoring engine for RubyLLM
|
|
201
187
|
test_files: []
|