logister-ruby 0.2.3 → 0.2.6

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: fd9ec67090820ac7b825afcbfd87a6a75f26033b0153daf8ee60b44a6d6fbbf3
4
- data.tar.gz: 2175055728eb9dcc9bc9ed0acf4b3640f52900bcd35933fdd92db6ebbc1dfc3a
3
+ metadata.gz: 63dccd6fdb12e5417bcca918c033a19e421087e188eac57f994939aa2eb4732f
4
+ data.tar.gz: 825d77d1304622efc28380e3e26167df40b411be97aa23219cce9d7f89944e6c
5
5
  SHA512:
6
- metadata.gz: cc1412c538be57e39a12e3f7c6939d1e710aa387490575ddf9af7df8ccda96cae3faafd9256348e18208ce63ebc0922f1696ae6b6d22aaeaf279c2b555960eee
7
- data.tar.gz: 92276f407d774dc3010447cba8b5f0aea0c878ad8d30ba428b46585da3afbdf1dd9f0eb11b6cc62e89afa72e6433292eab19898551c5749a378d11a66aa9e646
6
+ metadata.gz: 663bc90bcba5cfd300d1875536350131a5c1c2c540269168f910b648aa9a93ef98a301579389900cec0cbf135471c6078261a9a045b7be14b23987c9eef477c2
7
+ data.tar.gz: e0f8d74a0eff0434b7884ba945ffe96f752724c18cc3bc9b332651c02cde83e8e36a9f619e1dfe356116c6c63ef154bb79c667188cd23cf74f62b28e7d5a8361
data/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ ## v0.2.6 - 2026-05-22
4
+
5
+ - Added README guidance for using Ruby reports with the Logister project Insights beta, including practical metric, transaction, log, check-in, and custom attribute examples.
6
+ - Added a tag-based release workflow that publishes the gem to RubyGems with trusted publishing and then creates or updates the matching GitHub release.
7
+
8
+ ## v0.2.5 - 2026-05-21
9
+
10
+ - Added metric value/unit options to `Logister.report_metric` while keeping the existing context/tags API.
11
+ - Added per-check-in environment, release, occurred-at, trace ID, and request ID options to `Logister.report_check_in`.
12
+
13
+ ## v0.2.4 - 2026-05-21
14
+
15
+ - Enriched every Ruby error report with shared runtime, deployment, breadcrumb, and dependency context, including manual `Logister.report_error` calls.
16
+ - Added structured nested exception cause data to Ruby error payloads.
17
+
18
+ ## v0.2.3 - 2026-04-22
19
+
20
+ - Refined the Ruby and Rails client for Logister event delivery.
21
+ - Added richer reporting support for logs, transactions, check-ins, ActiveJob failures, breadcrumbs, and dependency context.
22
+ - Improved package metadata and docs linkage for the canonical Logister docs and self-hosted backend.
23
+ - Documented the gem as the Ruby client for the Logister backend instead of only the hosted `logister.org` service.
data/README.md CHANGED
@@ -1,6 +1,34 @@
1
1
  # logister-ruby
2
2
 
3
- `logister-ruby` sends application errors and custom metrics to `logister.org`.
3
+ `logister-ruby` is the Ruby and Rails client for sending errors, logs, metrics, transactions, and check-ins to Logister.
4
+
5
+ Install it from RubyGems as `logister-ruby`.
6
+
7
+ ## Table Of Contents
8
+
9
+ - [What this gem is for](#what-this-gem-is-for)
10
+ - [Self-hosted backend](#self-hosted-backend)
11
+ - [Install From RubyGems](#install-from-rubygems)
12
+ - [Configuration](#configuration)
13
+ - [Reliability options](#reliability-options)
14
+ - [Filtering and redaction](#filtering-and-redaction)
15
+ - [Rails auto-reporting](#rails-auto-reporting)
16
+ - [Database load metrics (ActiveRecord)](#database-load-metrics-activerecord)
17
+ - [Breadcrumbs and dependencies](#breadcrumbs-and-dependencies)
18
+ - [ActiveJob error context](#activejob-error-context)
19
+ - [Manual reporting](#manual-reporting)
20
+ - [Using project Insights beta](#using-project-insights-beta)
21
+ - [Documentation](#documentation)
22
+ - [Release](#release)
23
+
24
+ ## What this gem is for
25
+
26
+ Use this gem when you want a Ruby or Rails app to send telemetry into the Logister backend.
27
+
28
+ - Main Logister app: https://github.com/taimoorq/logister
29
+ - Ruby integration docs: https://docs.logister.org/integrations/ruby/
30
+ - Product docs: https://docs.logister.org/
31
+ - RubyGems package: https://rubygems.org/gems/logister-ruby
4
32
 
5
33
  ## Self-hosted backend
6
34
 
@@ -8,12 +36,26 @@ Use the open source Logister app repository to self-host the ingestion UI/API ba
8
36
 
9
37
  - App source: https://github.com/taimoorq/logister
10
38
 
11
- ## Install
39
+ ## Install From RubyGems
40
+
41
+ With Bundler in a Rails or Ruby app:
12
42
 
13
43
  ```ruby
14
44
  gem "logister-ruby"
15
45
  ```
16
46
 
47
+ Then install:
48
+
49
+ ```bash
50
+ bundle install
51
+ ```
52
+
53
+ Or install the gem directly from RubyGems:
54
+
55
+ ```bash
56
+ gem install logister-ruby
57
+ ```
58
+
17
59
  Then generate an initializer in Rails:
18
60
 
19
61
  ```bash
@@ -47,6 +89,8 @@ Logister.configure do |config|
47
89
  end
48
90
  ```
49
91
 
92
+ If you are using a self-hosted Logister install, point `config.endpoint` at your own Logister host instead of `logister.org`.
93
+
50
94
  ## Reliability options
51
95
 
52
96
  ```ruby
@@ -76,7 +120,8 @@ end
76
120
  ## Rails auto-reporting
77
121
 
78
122
  If Rails is present, the gem installs middleware that reports unhandled exceptions automatically.
79
- It also attaches richer context (trace IDs, route/response/performance info, breadcrumbs, dependency calls, and user metadata when available).
123
+ It also attaches richer context such as trace IDs, route/response/performance info, breadcrumbs, dependency calls, and user metadata when available.
124
+ Manual `Logister.report_error` calls use the same shared enrichment path, so Ruby apps get runtime, deployment, breadcrumb, dependency, user, and nested exception cause context even when an error is reported outside the Rails middleware.
80
125
 
81
126
  ## Database load metrics (ActiveRecord)
82
127
 
@@ -130,6 +175,8 @@ Logister.report_error(StandardError.new("Something failed"), tags: { area: "chec
130
175
 
131
176
  Logister.report_metric(
132
177
  message: "checkout.completed",
178
+ value: 1,
179
+ unit: "count",
133
180
  level: "info",
134
181
  context: { duration_ms: 123 },
135
182
  tags: { region: "us-east-1" }
@@ -151,18 +198,115 @@ Logister.report_log(
151
198
  Logister.report_check_in(
152
199
  slug: "nightly-reconcile",
153
200
  status: "ok",
154
- expected_interval_seconds: 900
201
+ expected_interval_seconds: 900,
202
+ duration_ms: 248.3,
203
+ trace_id: "trace-123",
204
+ request_id: "req-123"
155
205
  )
156
206
  ```
157
207
 
208
+ ## Using project Insights beta
209
+
210
+ The Logister project Insights tab combines Inbox, Activity, and Performance signals into live dashboard views. Ruby apps get the most useful Insights experience when every event carries stable deployment context plus a few low-cardinality custom attributes.
211
+
212
+ Use `config.environment`, `config.release`, and top-level scalar `context` values for the dimensions you want to filter by:
213
+
214
+ ```ruby
215
+ Logister.configure do |config|
216
+ config.environment = Rails.env
217
+ config.release = ENV["RELEASE_SHA"]
218
+ config.service = "billing-web"
219
+ end
220
+
221
+ Logister.report_metric(
222
+ message: "queue.depth",
223
+ value: Sidekiq::Queue.new("billing").size,
224
+ unit: "jobs",
225
+ context: {
226
+ service: "billing-worker",
227
+ queue: "billing",
228
+ region: "us-east-1",
229
+ tenant_tier: "enterprise"
230
+ }
231
+ )
232
+
233
+ Logister.report_transaction(
234
+ name: "POST /checkout",
235
+ duration_ms: 184.7,
236
+ status: 200,
237
+ context: {
238
+ service: "billing-web",
239
+ route: "POST /checkout",
240
+ feature_flag: "new_checkout",
241
+ tenant_tier: "enterprise"
242
+ }
243
+ )
244
+
245
+ Logister.report_log(
246
+ message: "payment provider retry",
247
+ level: "warn",
248
+ context: {
249
+ service: "billing-worker",
250
+ provider: "stripe",
251
+ queue: "billing"
252
+ }
253
+ )
254
+
255
+ Logister.report_check_in(
256
+ slug: "nightly-reconcile",
257
+ status: "ok",
258
+ expected_interval_seconds: 3600,
259
+ duration_ms: 842.7,
260
+ context: {
261
+ service: "billing-worker",
262
+ queue: "reconcile"
263
+ }
264
+ )
265
+ ```
266
+
267
+ Practical Insights recipes:
268
+
269
+ - Release validation: send `release`, then filter the Insights tab to the new release and compare errors, transaction P95, database query timing, and custom metrics.
270
+ - Queue monitoring: report metrics such as `queue.depth`, `queue.latency`, and `jobs.retry_count` with a stable `queue` context key.
271
+ - Performance triage: send transaction events with `route`, `service`, and `tenant_tier` so slow routes can be filtered beside errors and logs.
272
+ - Instrumentation audit: open Insights after deploy and confirm errors, logs, metrics, transactions, and check-ins all appear in the recent stream.
273
+
274
+ Keep dashboard dimensions stable and low-cardinality. Good custom attribute keys include `service`, `region`, `queue`, `route`, `tenant_tier`, `provider`, and `feature_flag`. Avoid raw IDs, emails, request bodies, SQL text, and per-user values as top-level Insights dimensions.
275
+
276
+ ## Documentation
277
+
278
+ - Ruby integration docs: https://docs.logister.org/integrations/ruby/
279
+ - Insights beta guide: https://docs.logister.org/product/#insights-beta
280
+ - Main Logister docs: https://docs.logister.org/
281
+ - [Contributing](CONTRIBUTING.md)
282
+ - [Code of Conduct](CODE_OF_CONDUCT.md)
283
+ - [Security Policy](SECURITY.md)
284
+ - [Pull Request Template](.github/PULL_REQUEST_TEMPLATE.md)
285
+
158
286
  ## Release
159
287
 
160
- Use Bundler's built-in release flow:
288
+ This repo runs CI on commits and pull requests. Version tags run the release workflow so RubyGems and GitHub Releases stay aligned:
161
289
 
162
290
  ```bash
163
291
  # 1) bump version in lib/logister/version.rb
164
- # 2) commit changes
165
- bundle exec rake release
292
+ # 2) update CHANGELOG.md
293
+ # 3) commit changes
294
+ # 4) push a matching tag, for example:
295
+ git tag -a v0.2.6 -m "Release logister-ruby v0.2.6"
296
+ git push origin main v0.2.6
166
297
  ```
167
298
 
168
- `rake release` will build the gem, create a git tag, push commits/tags, and push to RubyGems.
299
+ The `.github/workflows/release.yml` workflow verifies the tag matches `Logister::VERSION`, runs tests, builds the gem, publishes to RubyGems with trusted publishing, and then creates or updates the matching GitHub release from `CHANGELOG.md`.
300
+
301
+ Before tag releases can publish the gem, configure a RubyGems trusted publisher for:
302
+
303
+ - GitHub owner: `taimoorq`
304
+ - Repository: `logister-ruby`
305
+ - Workflow file: `.github/workflows/release.yml`
306
+ - Environment: leave blank unless you also add a GitHub release environment to the workflow
307
+
308
+ Manual publishing is still possible with Bundler's built-in release flow when needed:
309
+
310
+ ```bash
311
+ bundle exec rake release
312
+ ```
@@ -3,6 +3,8 @@
3
3
  require 'digest'
4
4
  require 'time'
5
5
  require 'set'
6
+ require_relative 'context_helpers'
7
+ require_relative 'context_store'
6
8
 
7
9
  module Logister
8
10
  class Reporter
@@ -41,7 +43,7 @@ module Logister
41
43
  return false if ignored_exception?(exception)
42
44
  return false if ignored_path?(context)
43
45
 
44
- merged_context = context.dup
46
+ merged_context = default_error_context.merge(context)
45
47
  user = current_user_context
46
48
  merged_context[:user] = user if user
47
49
 
@@ -51,11 +53,7 @@ module Logister
51
53
  message: "#{exception.class}: #{exception.message}",
52
54
  fingerprint: fingerprint || default_fingerprint(exception),
53
55
  context: merged_context.merge(
54
- exception: {
55
- class: exception.class.to_s,
56
- message: exception.message.to_s,
57
- backtrace: Array(exception.backtrace).first(50)
58
- },
56
+ exception: exception_context(exception),
59
57
  tags: tags
60
58
  )
61
59
  )
@@ -66,16 +64,29 @@ module Logister
66
64
  @client.publish(payload)
67
65
  end
68
66
 
69
- def report_metric(message:, level: 'info', context: {}, tags: {}, fingerprint: nil)
67
+ def report_metric(message:, value: nil, unit: nil, level: 'info', context: {}, tags: {}, fingerprint: nil)
70
68
  return false if ignored_environment?
71
69
  return false if ignored_path?(context)
72
70
 
71
+ metric_context = context.merge(tags: tags)
72
+ if value
73
+ metric_context = metric_context.merge(
74
+ metric: {
75
+ name: message,
76
+ value: value,
77
+ unit: unit
78
+ }.compact,
79
+ value: value,
80
+ unit: unit
81
+ ).compact
82
+ end
83
+
73
84
  payload = build_payload(
74
85
  event_type: 'metric',
75
86
  level: level,
76
87
  message: message,
77
88
  fingerprint: fingerprint || metric_fingerprint(message),
78
- context: context.merge(tags: tags)
89
+ context: metric_context
79
90
  )
80
91
 
81
92
  payload = apply_before_notify(payload)
@@ -125,7 +136,19 @@ module Logister
125
136
  @client.publish(payload)
126
137
  end
127
138
 
128
- def report_check_in(slug:, status: 'ok', expected_interval_seconds: 300, duration_ms: nil, context: {}, level: nil)
139
+ def report_check_in(
140
+ slug:,
141
+ status: 'ok',
142
+ expected_interval_seconds: 300,
143
+ duration_ms: nil,
144
+ context: {},
145
+ level: nil,
146
+ environment: nil,
147
+ release: nil,
148
+ occurred_at: nil,
149
+ trace_id: nil,
150
+ request_id: nil
151
+ )
129
152
  return false if ignored_environment?
130
153
 
131
154
  payload = build_payload(
@@ -137,9 +160,14 @@ module Logister
137
160
  check_in_slug: slug,
138
161
  check_in_status: status,
139
162
  expected_interval_seconds: expected_interval_seconds,
140
- duration_ms: duration_ms
163
+ duration_ms: duration_ms,
164
+ environment: environment,
165
+ release: release,
166
+ trace_id: trace_id,
167
+ request_id: request_id
141
168
  ).compact
142
169
  )
170
+ payload[:occurred_at] = normalize_timestamp(occurred_at) if occurred_at
143
171
 
144
172
  payload = apply_before_notify(payload)
145
173
  return false unless payload
@@ -185,6 +213,31 @@ module Logister
185
213
  Thread.current[:logister_user]
186
214
  end
187
215
 
216
+ def default_error_context
217
+ Logister::ContextHelpers.compact_deep(
218
+ {
219
+ breadcrumbs: Logister::ContextStore.breadcrumbs.presence,
220
+ dependencyCalls: Logister::ContextStore.dependencies.presence
221
+ }
222
+ .merge(Logister::ContextHelpers.runtime_context)
223
+ .merge(Logister::ContextHelpers.deployment_context)
224
+ )
225
+ rescue StandardError => e
226
+ @configuration.logger.warn("logister default error context failed: #{e.class} #{e.message}")
227
+ {}
228
+ end
229
+
230
+ def exception_context(exception, depth = 0)
231
+ return nil unless exception
232
+
233
+ {
234
+ class: exception.class.to_s,
235
+ message: exception.message.to_s,
236
+ backtrace: Array(exception.backtrace).first(50),
237
+ cause: depth < 5 ? exception_context(exception.cause, depth + 1) : nil
238
+ }.compact
239
+ end
240
+
188
241
  def build_payload(event_type:, level:, message:, fingerprint:, context:)
189
242
  {
190
243
  event_type: event_type,
@@ -199,6 +252,10 @@ module Logister
199
252
  }
200
253
  end
201
254
 
255
+ def normalize_timestamp(timestamp)
256
+ timestamp.respond_to?(:utc) ? timestamp.utc.iso8601 : timestamp.to_s
257
+ end
258
+
202
259
  def apply_before_notify(payload)
203
260
  hook = @configuration.before_notify
204
261
  return payload unless hook.respond_to?(:call)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Logister
4
- VERSION = '0.2.3'
4
+ VERSION = '0.2.6'
5
5
  end
@@ -6,21 +6,25 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ['Logister']
7
7
  spec.email = ['support@logister.org']
8
8
 
9
- spec.summary = 'Send Rails errors and metrics to logister.org'
10
- spec.description = 'Client gem for reporting errors and custom metrics from Ruby and Rails apps to logister.org'
9
+ spec.summary = 'Ruby and Rails client for sending events to Logister'
10
+ spec.description = 'Ruby and Rails client for reporting errors, logs, metrics, transactions, and check-ins to the Logister backend, including self-hosted installs.'
11
11
  spec.homepage = 'https://github.com/taimoorq/logister-ruby'
12
12
  spec.license = 'MIT'
13
13
  spec.required_ruby_version = '>= 3.1.0'
14
14
 
15
15
  spec.metadata['homepage_uri'] = spec.homepage
16
16
  spec.metadata['source_code_uri'] = 'https://github.com/taimoorq/logister-ruby'
17
+ spec.metadata['documentation_uri'] = 'https://docs.logister.org/integrations/ruby/'
18
+ spec.metadata['changelog_uri'] = 'https://github.com/taimoorq/logister-ruby/blob/main/CHANGELOG.md'
19
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/taimoorq/logister-ruby/issues'
17
20
 
18
21
  spec.files = Dir.chdir(__dir__) do
19
- Dir.glob('lib/**/*') + ['README.md', 'LICENSE', 'logister-ruby.gemspec']
22
+ Dir.glob('lib/**/*') + ['README.md', 'CHANGELOG.md', 'LICENSE', 'logister-ruby.gemspec']
20
23
  end
21
24
 
22
25
  spec.require_paths = ['lib']
23
26
 
24
27
  spec.add_dependency 'activesupport', '>= 6.1'
28
+ spec.add_development_dependency 'actionpack', '>= 6.1'
25
29
  spec.add_development_dependency 'rake', '>= 13.0'
26
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logister-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logister
@@ -23,6 +23,20 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '6.1'
26
+ - !ruby/object:Gem::Dependency
27
+ name: actionpack
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '6.1'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '6.1'
26
40
  - !ruby/object:Gem::Dependency
27
41
  name: rake
28
42
  requirement: !ruby/object:Gem::Requirement
@@ -37,14 +51,15 @@ dependencies:
37
51
  - - ">="
38
52
  - !ruby/object:Gem::Version
39
53
  version: '13.0'
40
- description: Client gem for reporting errors and custom metrics from Ruby and Rails
41
- apps to logister.org
54
+ description: Ruby and Rails client for reporting errors, logs, metrics, transactions,
55
+ and check-ins to the Logister backend, including self-hosted installs.
42
56
  email:
43
57
  - support@logister.org
44
58
  executables: []
45
59
  extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
62
+ - CHANGELOG.md
48
63
  - LICENSE
49
64
  - README.md
50
65
  - lib/generators/logister/install_generator.rb
@@ -69,6 +84,9 @@ licenses:
69
84
  metadata:
70
85
  homepage_uri: https://github.com/taimoorq/logister-ruby
71
86
  source_code_uri: https://github.com/taimoorq/logister-ruby
87
+ documentation_uri: https://docs.logister.org/integrations/ruby/
88
+ changelog_uri: https://github.com/taimoorq/logister-ruby/blob/main/CHANGELOG.md
89
+ bug_tracker_uri: https://github.com/taimoorq/logister-ruby/issues
72
90
  rdoc_options: []
73
91
  require_paths:
74
92
  - lib
@@ -83,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
101
  - !ruby/object:Gem::Version
84
102
  version: '0'
85
103
  requirements: []
86
- rubygems_version: 4.0.3
104
+ rubygems_version: 4.0.6
87
105
  specification_version: 4
88
- summary: Send Rails errors and metrics to logister.org
106
+ summary: Ruby and Rails client for sending events to Logister
89
107
  test_files: []