logister-ruby 0.2.2 → 0.2.4

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: 0ffb0ff308c1a54f984e8c68088561c76a044e90766bee92a4ef23a51e0c5a78
4
- data.tar.gz: fd0a658239131bec7061a722ed45044c0a2c7aba2125242b766837d0fd8d5dc8
3
+ metadata.gz: '08b202068c5d0907d8c8d08b3490dfbc34af5863df48c2e7a491a9a4c18e5307'
4
+ data.tar.gz: ba465c7050af6b92e27a36ffd985b9eedbd667ab6be211dd9e1db457e501ff6d
5
5
  SHA512:
6
- metadata.gz: c89ea19d2cd68d4e7de0d85ff4b8c727fa0378d9a9e3b86e9a631fbb3e1a0df05d8cf7c9620636c9d7581011e53800cd57c9dffd7dabb9f83e52494c04d32c49
7
- data.tar.gz: 42e48cd2049ab3adf2c496209dd71734891db9134f621920c988c138fb31bd3af99d1a72f39cc2b85f624f8f61ae586b873a036302fe0d29ca767d725cac4e9c
6
+ metadata.gz: 55b1680278af20b4779519debd47e7f111348e5132323d07116a02cd7a26b27dd556094e479cdb871f1db64db74dc92b09fc7d52288c982048b9b084fa751b81
7
+ data.tar.gz: f05606399bc43607512dee0c332212f30f7d1d6352dd0c6ba3c6ce39f3fc91fb8fa61b107de1ae045736360dd026afe947cf3e3ef01fef49f353cc2d23e6e4bf
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## v0.2.4 - 2026-05-21
4
+
5
+ - Enriched every Ruby error report with shared runtime, deployment, breadcrumb, and dependency context, including manual `Logister.report_error` calls.
6
+ - Added structured nested exception cause data to Ruby error payloads.
7
+
8
+ ## v0.2.3 - 2026-04-22
9
+
10
+ - Refined the Ruby and Rails client for Logister event delivery.
11
+ - Added richer reporting support for logs, transactions, check-ins, ActiveJob failures, breadcrumbs, and dependency context.
12
+ - Improved package metadata and docs linkage for the canonical Logister docs and self-hosted backend.
13
+ - Documented the gem as the Ruby client for the Logister backend instead of only the hosted `logister.org` service.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Logister
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,13 +1,60 @@
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
4
 
5
- ## Install
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
+ - [Documentation](#documentation)
21
+ - [Release](#release)
22
+
23
+ ## What this gem is for
24
+
25
+ Use this gem when you want a Ruby or Rails app to send telemetry into the Logister backend.
26
+
27
+ - Main Logister app: https://github.com/taimoorq/logister
28
+ - Ruby integration docs: https://docs.logister.org/integrations/ruby/
29
+ - Product docs: https://docs.logister.org/
30
+ - RubyGems package: https://rubygems.org/gems/logister-ruby
31
+
32
+ ## Self-hosted backend
33
+
34
+ Use the open source Logister app repository to self-host the ingestion UI/API backend:
35
+
36
+ - App source: https://github.com/taimoorq/logister
37
+
38
+ ## Install From RubyGems
39
+
40
+ With Bundler in a Rails or Ruby app:
6
41
 
7
42
  ```ruby
8
43
  gem "logister-ruby"
9
44
  ```
10
45
 
46
+ Then install:
47
+
48
+ ```bash
49
+ bundle install
50
+ ```
51
+
52
+ Or install the gem directly from RubyGems:
53
+
54
+ ```bash
55
+ gem install logister-ruby
56
+ ```
57
+
11
58
  Then generate an initializer in Rails:
12
59
 
13
60
  ```bash
@@ -41,6 +88,8 @@ Logister.configure do |config|
41
88
  end
42
89
  ```
43
90
 
91
+ If you are using a self-hosted Logister install, point `config.endpoint` at your own Logister host instead of `logister.org`.
92
+
44
93
  ## Reliability options
45
94
 
46
95
  ```ruby
@@ -70,7 +119,8 @@ end
70
119
  ## Rails auto-reporting
71
120
 
72
121
  If Rails is present, the gem installs middleware that reports unhandled exceptions automatically.
73
- It also attaches richer context (trace IDs, route/response/performance info, breadcrumbs, dependency calls, and user metadata when available).
122
+ It also attaches richer context such as trace IDs, route/response/performance info, breadcrumbs, dependency calls, and user metadata when available.
123
+ 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.
74
124
 
75
125
  ## Database load metrics (ActiveRecord)
76
126
 
@@ -128,15 +178,44 @@ Logister.report_metric(
128
178
  context: { duration_ms: 123 },
129
179
  tags: { region: "us-east-1" }
130
180
  )
181
+
182
+ Logister.report_transaction(
183
+ name: "POST /checkout",
184
+ duration_ms: 184.7,
185
+ status: 200,
186
+ context: { trace_id: "trace-123", request_id: "req-123" }
187
+ )
188
+
189
+ Logister.report_log(
190
+ message: "payment provider timeout",
191
+ level: "warn",
192
+ context: { trace_id: "trace-123", request_id: "req-123", user_id: 42 }
193
+ )
194
+
195
+ Logister.report_check_in(
196
+ slug: "nightly-reconcile",
197
+ status: "ok",
198
+ expected_interval_seconds: 900
199
+ )
131
200
  ```
132
201
 
202
+ ## Documentation
203
+
204
+ - Ruby integration docs: https://docs.logister.org/integrations/ruby/
205
+ - Main Logister docs: https://docs.logister.org/
206
+ - [Contributing](CONTRIBUTING.md)
207
+ - [Code of Conduct](CODE_OF_CONDUCT.md)
208
+ - [Security Policy](SECURITY.md)
209
+ - [Pull Request Template](.github/PULL_REQUEST_TEMPLATE.md)
210
+
133
211
  ## Release
134
212
 
135
213
  Use Bundler's built-in release flow:
136
214
 
137
215
  ```bash
138
216
  # 1) bump version in lib/logister/version.rb
139
- # 2) commit changes
217
+ # 2) update CHANGELOG.md
218
+ # 3) commit changes
140
219
  bundle exec rake release
141
220
  ```
142
221
 
@@ -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
  )
@@ -84,6 +82,69 @@ module Logister
84
82
  @client.publish(payload)
85
83
  end
86
84
 
85
+ def report_transaction(name:, duration_ms:, level: 'info', context: {}, tags: {}, fingerprint: nil, status: nil)
86
+ return false if ignored_environment?
87
+ return false if ignored_path?(context)
88
+
89
+ payload = build_payload(
90
+ event_type: 'transaction',
91
+ level: level,
92
+ message: name,
93
+ fingerprint: fingerprint || metric_fingerprint("tx:#{name}"),
94
+ context: context.merge(
95
+ transaction_name: name,
96
+ duration_ms: duration_ms,
97
+ status: status,
98
+ tags: tags
99
+ ).compact
100
+ )
101
+
102
+ payload = apply_before_notify(payload)
103
+ return false unless payload
104
+
105
+ @client.publish(payload)
106
+ end
107
+
108
+ def report_log(message:, level: 'info', context: {}, tags: {}, fingerprint: nil)
109
+ return false if ignored_environment?
110
+ return false if ignored_path?(context)
111
+
112
+ payload = build_payload(
113
+ event_type: 'log',
114
+ level: level,
115
+ message: message,
116
+ fingerprint: fingerprint || metric_fingerprint("log:#{message.to_s.lines.first}"),
117
+ context: context.merge(tags: tags)
118
+ )
119
+
120
+ payload = apply_before_notify(payload)
121
+ return false unless payload
122
+
123
+ @client.publish(payload)
124
+ end
125
+
126
+ def report_check_in(slug:, status: 'ok', expected_interval_seconds: 300, duration_ms: nil, context: {}, level: nil)
127
+ return false if ignored_environment?
128
+
129
+ payload = build_payload(
130
+ event_type: 'check_in',
131
+ level: level || (status.to_s == 'error' ? 'error' : 'info'),
132
+ message: slug,
133
+ fingerprint: metric_fingerprint("checkin:#{slug}"),
134
+ context: context.merge(
135
+ check_in_slug: slug,
136
+ check_in_status: status,
137
+ expected_interval_seconds: expected_interval_seconds,
138
+ duration_ms: duration_ms
139
+ ).compact
140
+ )
141
+
142
+ payload = apply_before_notify(payload)
143
+ return false unless payload
144
+
145
+ @client.publish(payload)
146
+ end
147
+
87
148
  # Store user info for the current thread so it is automatically attached to
88
149
  # every error reported during this request.
89
150
  #
@@ -122,6 +183,31 @@ module Logister
122
183
  Thread.current[:logister_user]
123
184
  end
124
185
 
186
+ def default_error_context
187
+ Logister::ContextHelpers.compact_deep(
188
+ {
189
+ breadcrumbs: Logister::ContextStore.breadcrumbs.presence,
190
+ dependencyCalls: Logister::ContextStore.dependencies.presence
191
+ }
192
+ .merge(Logister::ContextHelpers.runtime_context)
193
+ .merge(Logister::ContextHelpers.deployment_context)
194
+ )
195
+ rescue StandardError => e
196
+ @configuration.logger.warn("logister default error context failed: #{e.class} #{e.message}")
197
+ {}
198
+ end
199
+
200
+ def exception_context(exception, depth = 0)
201
+ return nil unless exception
202
+
203
+ {
204
+ class: exception.class.to_s,
205
+ message: exception.message.to_s,
206
+ backtrace: Array(exception.backtrace).first(50),
207
+ cause: depth < 5 ? exception_context(exception.cause, depth + 1) : nil
208
+ }.compact
209
+ end
210
+
125
211
  def build_payload(event_type:, level:, message:, fingerprint:, context:)
126
212
  {
127
213
  event_type: event_type,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Logister
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.4'
5
5
  end
data/lib/logister.rb CHANGED
@@ -31,6 +31,18 @@ module Logister
31
31
  reporter.report_metric(**kwargs)
32
32
  end
33
33
 
34
+ def report_transaction(**kwargs)
35
+ reporter.report_transaction(**kwargs)
36
+ end
37
+
38
+ def report_log(**kwargs)
39
+ reporter.report_log(**kwargs)
40
+ end
41
+
42
+ def report_check_in(**kwargs)
43
+ reporter.report_check_in(**kwargs)
44
+ end
45
+
34
46
  def flush(timeout: 2)
35
47
  reporter.flush(timeout: timeout)
36
48
  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'
11
- spec.homepage = 'https://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
+ 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', '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.2
4
+ version: 0.2.4
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,16 @@ 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
63
+ - LICENSE
48
64
  - README.md
49
65
  - lib/generators/logister/install_generator.rb
50
66
  - lib/generators/logister/templates/logister.rb
@@ -62,12 +78,15 @@ files:
62
78
  - lib/logister/sql_subscriber.rb
63
79
  - lib/logister/version.rb
64
80
  - logister-ruby.gemspec
65
- homepage: https://logister.org
81
+ homepage: https://github.com/taimoorq/logister-ruby
66
82
  licenses:
67
83
  - MIT
68
84
  metadata:
69
- homepage_uri: https://logister.org
85
+ homepage_uri: https://github.com/taimoorq/logister-ruby
70
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
71
90
  rdoc_options: []
72
91
  require_paths:
73
92
  - lib
@@ -82,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
101
  - !ruby/object:Gem::Version
83
102
  version: '0'
84
103
  requirements: []
85
- rubygems_version: 4.0.3
104
+ rubygems_version: 4.0.6
86
105
  specification_version: 4
87
- summary: Send Rails errors and metrics to logister.org
106
+ summary: Ruby and Rails client for sending events to Logister
88
107
  test_files: []