logister-ruby 0.3.0 → 0.3.1

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: 29c7ec6cb1f296ce54ef6081b360d8d3db79781fa70a6d4357ce746602e2ee97
4
- data.tar.gz: 076efade8b179ad87615b28271fd3679ebae34f6b41d9cc8cfbcadc347b1f3d0
3
+ metadata.gz: 7d1ca80fe29bc17af3e645e1a07ac8f4d68bd5c7f60b01d238ef9e875e8d60c3
4
+ data.tar.gz: 73418842ba1d3a221374a87313e2147b70473a85fb6509132a1213832a1c79c3
5
5
  SHA512:
6
- metadata.gz: fdd41ab4607104b7b2f53a6233a4b9d600411796ee6b2c709ba8743f08a65565159f3d0eaae366621f01a4c0d0f6b4f0ef9934c99728d493e1303c2f0b9a9726
7
- data.tar.gz: c3b81b538e0d434d8bcf681c786e3787b42d130992a40e95f8be367902096bdf84508259ac0a54d313cd5063aefd9438fe192bb9851954694ee7011063edfb97
6
+ metadata.gz: 4f99665d9daa0761f7a761470c07174b8f181791caa1639a40324650b615f84932a440e9f037133221047389b64e1ffa1747c7c6dc3e661c2626e4f9978aac38
7
+ data.tar.gz: 767b7c876a8d8a05ed0dbbf106de09ccd474d2b1796ff5ec82e6194f9da27e1aa4abdd765f17fd3c20c71a0478ba10460250829f5e056415c98da495a8049dc1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.3.1 - 2026-07-26
4
+
5
+ - Added `Logister.suppress_reporting` and `Logister.reporting_suppressed?` for recursion-safe telemetry processing, including early exits in automatic SQL and request subscribers.
6
+
3
7
  ## v0.3.0 - 2026-07-25
4
8
 
5
9
  - Raised the supported runtime floor to Ruby 3.3 and refreshed the development runtime to Ruby 4.0.6, which includes current interpreter security fixes.
data/README.md CHANGED
@@ -1,11 +1,47 @@
1
1
  # logister-ruby
2
2
 
3
- `logister-ruby` is the Ruby and Rails client for sending errors, logs, metrics, transactions, spans, and check-ins to Logister.
3
+ `logister-ruby` sends Ruby and Rails errors, logs, metrics, transactions, spans, and scheduled-job check-ins to Logister. Rails apps also get automatic reporting for unhandled requests and failed Active Job executions.
4
4
 
5
5
  Install it from RubyGems as `logister-ruby`.
6
6
 
7
+ Requires Ruby 3.3 or newer and Active Support 8.x.
8
+
9
+ ## Quick start
10
+
11
+ Before you start, create a project in Logister and generate a project API key under **Project settings → API keys**.
12
+
13
+ Add the gem and generate a Rails initializer:
14
+
15
+ ```bash
16
+ bundle add logister-ruby
17
+ bin/rails generate logister:install
18
+ ```
19
+
20
+ Store configuration in environment variables:
21
+
22
+ ```bash
23
+ export LOGISTER_API_KEY="<project-api-key>"
24
+ export LOGISTER_ENDPOINT="https://logister.example.com/api/v1/ingest_events"
25
+ export LOGISTER_SERVICE="checkout-web"
26
+ export LOGISTER_RELEASE="$(git rev-parse --short HEAD)"
27
+ ```
28
+
29
+ Start Rails, then send a safe test event from `bin/rails console`:
30
+
31
+ ```ruby
32
+ Logister.report_error(
33
+ RuntimeError.new("README test error"),
34
+ context: { component: "checkout" },
35
+ fingerprint: "readme-test-error"
36
+ )
37
+ Logister.flush
38
+ ```
39
+
40
+ Open the project inbox and confirm that **README test error** appears. A `401` response usually means the API key or endpoint is wrong; see the [Ruby integration guide](https://logister.org/docs/integrations/ruby/) for troubleshooting.
41
+
7
42
  ## Table Of Contents
8
43
 
44
+ - [Quick start](#quick-start)
9
45
  - [What this gem is for](#what-this-gem-is-for)
10
46
  - [Package Links](#package-links)
11
47
  - [Self-hosted backend](#self-hosted-backend)
@@ -18,17 +54,19 @@ Install it from RubyGems as `logister-ruby`.
18
54
  - [Breadcrumbs and dependencies](#breadcrumbs-and-dependencies)
19
55
  - [ActiveJob error context](#activejob-error-context)
20
56
  - [Manual reporting](#manual-reporting)
21
- - [Using project Insights beta](#using-project-insights-beta)
57
+ - [Using project Insights](#using-project-insights)
58
+ - [GitHub source context and deployments](#github-source-context-and-deployments)
22
59
  - [Documentation](#documentation)
60
+ - [Development](#development)
23
61
  - [Release](#release)
24
62
 
25
63
  ## What this gem is for
26
64
 
27
- Use this gem when you want a Ruby or Rails app to send telemetry into the Logister backend.
65
+ Use this gem when a Ruby process should send telemetry to a hosted or self-hosted Logister server. It is an ingest client, not the Logister server itself.
28
66
 
29
67
  - Main Logister app: https://github.com/taimoorq/logister
30
- - Ruby integration docs: https://docs.logister.org/integrations/ruby/
31
- - Product docs: https://docs.logister.org/
68
+ - Ruby integration docs: https://logister.org/docs/integrations/ruby/
69
+ - Product docs: https://logister.org/docs/
32
70
  - RubyGems package: https://rubygems.org/gems/logister-ruby
33
71
 
34
72
  ## Package Links
@@ -36,7 +74,7 @@ Use this gem when you want a Ruby or Rails app to send telemetry into the Logist
36
74
  - RubyGems package: https://rubygems.org/gems/logister-ruby
37
75
  - GitHub releases: https://github.com/taimoorq/logister-ruby/releases
38
76
  - Source repository: https://github.com/taimoorq/logister-ruby
39
- - Integration docs: https://docs.logister.org/integrations/ruby/
77
+ - Integration docs: https://logister.org/docs/integrations/ruby/
40
78
 
41
79
  ## Self-hosted backend
42
80
 
@@ -100,6 +138,8 @@ end
100
138
 
101
139
  If you are using a self-hosted Logister install, point `config.endpoint` at your own Logister host instead of `logister.org`.
102
140
 
141
+ Keep `LOGISTER_API_KEY` in your deployment secret store. Project API keys are write-only ingest credentials, but exposing one still lets another party submit unwanted telemetry to the project.
142
+
103
143
  ## Reliability options
104
144
 
105
145
  ```ruby
@@ -126,12 +166,21 @@ Logister.configure do |config|
126
166
  end
127
167
  ```
128
168
 
169
+ Use scoped suppression around work that handles or forwards telemetry. Every manual reporter and automatic Rails subscriber returns without publishing while the scope is active, and nested scopes restore the previous state even when the block raises:
170
+
171
+ ```ruby
172
+ Logister.suppress_reporting do
173
+ TelemetryMirror.call(event)
174
+ end
175
+ ```
176
+
177
+ This is especially important when a Rails application reports into a Logister project hosted by that same application. Keep suppression narrow so failures outside the telemetry-processing boundary remain observable.
178
+
129
179
  ## Rails auto-reporting
130
180
 
131
- If Rails is present, the gem installs middleware that reports unhandled exceptions automatically.
132
- It also attaches richer context such as trace IDs, route/response/performance info, breadcrumbs, dependency calls, and user metadata when available.
133
- Set `config.capture_request_spans = true` to emit root `server` spans for request load waterfall charts while keeping existing transaction events.
134
- 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.
181
+ If Rails is present, the gem installs middleware that reports unhandled exceptions automatically. It attaches trace IDs, route and response data, performance context, breadcrumbs, dependency calls, and user metadata when available.
182
+
183
+ Set `config.capture_request_spans = true` to emit root `server` spans for request-load waterfall charts while keeping the existing transaction events. Manual `Logister.report_error` calls use the same enrichment path, including runtime, deployment, breadcrumb, dependency, user, and nested-exception context.
135
184
 
136
185
  ## Database load metrics (ActiveRecord)
137
186
 
@@ -225,7 +274,7 @@ Logister.report_check_in(
225
274
  )
226
275
  ```
227
276
 
228
- ## Using project Insights beta
277
+ ## Using project Insights
229
278
 
230
279
  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.
231
280
 
@@ -322,28 +371,33 @@ Logister.record_deployment(
322
371
 
323
372
  ## Documentation
324
373
 
325
- - Ruby integration docs: https://docs.logister.org/integrations/ruby/
326
- - Insights beta guide: https://docs.logister.org/product/#insights-beta
327
- - Main Logister docs: https://docs.logister.org/
374
+ - Ruby integration docs: https://logister.org/docs/integrations/ruby/
375
+ - Insights guide: https://logister.org/docs/product/#insights
376
+ - Main Logister docs: https://logister.org/docs/
328
377
  - [Contributing](CONTRIBUTING.md)
329
378
  - [Code of Conduct](CODE_OF_CONDUCT.md)
330
379
  - [Security Policy](SECURITY.md)
331
380
  - [Pull Request Template](.github/PULL_REQUEST_TEMPLATE.md)
332
381
 
382
+ ## Development
383
+
384
+ ```bash
385
+ bundle install
386
+ bundle-audit check --update
387
+ bundle exec rake test
388
+ bundle exec rake build
389
+ ```
390
+
333
391
  ## Release
334
392
 
335
- This repo runs CI on commits and pull requests. After CI passes on `main`, the release-from-main workflow creates the matching version tag. Version tags run the release workflow so RubyGems and GitHub Releases stay aligned:
393
+ `lib/logister/version.rb` is the package version source of truth. Update it and `CHANGELOG.md` together. After CI passes on `main`, the release-from-main workflow creates a matching `vX.Y.Z` tag and dispatches the release workflow.
336
394
 
337
395
  ```bash
338
- # 1) bump version in lib/logister/version.rb
339
- # 2) update CHANGELOG.md
340
- # 3) commit changes
341
- # 4) merge to main, or push a matching tag manually:
342
- git tag -a v0.2.8 -m "Release logister-ruby v0.2.8"
343
- git push origin main v0.2.8
396
+ git tag -a vX.Y.Z -m "Release logister-ruby vX.Y.Z"
397
+ git push origin vX.Y.Z
344
398
  ```
345
399
 
346
- 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`.
400
+ The release workflow verifies tag/version parity, audits and tests the package, builds the gem, publishes to RubyGems with trusted publishing, and only then creates the GitHub Release. RubyGems versions are immutable; corrections need a new patch version.
347
401
 
348
402
  Before tag releases can publish the gem, configure a RubyGems trusted publisher for:
349
403
 
@@ -352,8 +406,9 @@ Before tag releases can publish the gem, configure a RubyGems trusted publisher
352
406
  - Workflow file: `.github/workflows/release.yml`
353
407
  - Environment: leave blank unless you also add a GitHub release environment to the workflow
354
408
 
355
- Manual publishing is still possible with Bundler's built-in release flow when needed:
409
+ Verify both release surfaces before calling a release complete:
356
410
 
357
411
  ```bash
358
- bundle exec rake release
412
+ curl -fsSL https://rubygems.org/api/v2/rubygems/logister-ruby/versions/X.Y.Z.json | jq '{number,ruby_version,sha}'
413
+ gh release view vX.Y.Z
359
414
  ```
@@ -44,6 +44,7 @@ module Logister
44
44
  end
45
45
 
46
46
  def report_error(exception, context: {}, tags: {}, level: 'error', fingerprint: nil)
47
+ return false if Logister.reporting_suppressed?
47
48
  return false if ignored_exception?(exception)
48
49
  return false if ignored_path?(context)
49
50
 
@@ -69,6 +70,7 @@ module Logister
69
70
  end
70
71
 
71
72
  def report_metric(message:, value: nil, unit: nil, level: 'info', context: {}, tags: {}, fingerprint: nil)
73
+ return false if Logister.reporting_suppressed?
72
74
  return false if ignored_environment?
73
75
  return false if ignored_path?(context)
74
76
 
@@ -100,6 +102,7 @@ module Logister
100
102
  end
101
103
 
102
104
  def report_transaction(name:, duration_ms:, level: 'info', context: {}, tags: {}, fingerprint: nil, status: nil)
105
+ return false if Logister.reporting_suppressed?
103
106
  return false if ignored_environment?
104
107
  return false if ignored_path?(context)
105
108
 
@@ -137,6 +140,7 @@ module Logister
137
140
  tags: {},
138
141
  fingerprint: nil
139
142
  )
143
+ return false if Logister.reporting_suppressed?
140
144
  return false if ignored_environment?
141
145
  return false if ignored_path?(context)
142
146
 
@@ -182,6 +186,7 @@ module Logister
182
186
  end
183
187
 
184
188
  def report_log(message:, level: 'info', context: {}, tags: {}, fingerprint: nil)
189
+ return false if Logister.reporting_suppressed?
185
190
  return false if ignored_environment?
186
191
  return false if ignored_path?(context)
187
192
 
@@ -212,6 +217,7 @@ module Logister
212
217
  trace_id: nil,
213
218
  request_id: nil
214
219
  )
220
+ return false if Logister.reporting_suppressed?
215
221
  return false if ignored_environment?
216
222
 
217
223
  payload = build_payload(
@@ -253,6 +259,8 @@ module Logister
253
259
  workflow_run_url: nil,
254
260
  deployment_url: nil
255
261
  )
262
+ return false if Logister.reporting_suppressed?
263
+
256
264
  payload = {
257
265
  release: release || @configuration.release,
258
266
  environment: environment || @configuration.environment,
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Logister
4
+ module ReportingScope
5
+ STATE_KEY = :__logister_reporting_suppressed
6
+
7
+ module_function
8
+
9
+ def suppress
10
+ previous = state
11
+ self.state = true
12
+ yield
13
+ ensure
14
+ self.state = previous
15
+ end
16
+
17
+ def suppressed?
18
+ state == true
19
+ end
20
+
21
+ def state
22
+ if defined?(ActiveSupport::IsolatedExecutionState)
23
+ ActiveSupport::IsolatedExecutionState[STATE_KEY]
24
+ else
25
+ Thread.current[STATE_KEY]
26
+ end
27
+ end
28
+ private_class_method :state
29
+
30
+ def state=(value)
31
+ if defined?(ActiveSupport::IsolatedExecutionState)
32
+ ActiveSupport::IsolatedExecutionState[STATE_KEY] = value
33
+ else
34
+ Thread.current[STATE_KEY] = value
35
+ end
36
+ end
37
+ private_class_method :state=
38
+ end
39
+ end
@@ -22,6 +22,7 @@ module Logister
22
22
  private
23
23
 
24
24
  def handle_process_action(payload)
25
+ return if Logister.reporting_suppressed?
25
26
  return unless payload.is_a?(Hash)
26
27
 
27
28
  request_id = payload[:request_id].to_s.presence
@@ -89,6 +90,8 @@ module Logister
89
90
  end
90
91
 
91
92
  def handle_sql_breadcrumb(started, finished, payload)
93
+ return if Logister.reporting_suppressed?
94
+
92
95
  config = configuration
93
96
  return unless config&.capture_sql_breadcrumbs
94
97
  return unless payload.is_a?(Hash)
@@ -29,6 +29,8 @@ module Logister
29
29
  private
30
30
 
31
31
  def handle_sql_event(started, finished, payload)
32
+ return if Logister.reporting_suppressed?
33
+
32
34
  config = Logister.configuration
33
35
 
34
36
  # Short-circuit as cheaply as possible when metrics are disabled so
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Logister
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
data/lib/logister.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require_relative 'logister/version'
2
2
  require_relative 'logister/configuration'
3
+ require_relative 'logister/reporting_scope'
3
4
  require_relative 'logister/client'
4
5
  require_relative 'logister/reporter'
5
6
  require_relative 'logister/context_helpers'
@@ -23,6 +24,14 @@ module Logister
23
24
  @reporter ||= Reporter.new(configuration)
24
25
  end
25
26
 
27
+ def suppress_reporting(&block)
28
+ ReportingScope.suppress(&block)
29
+ end
30
+
31
+ def reporting_suppressed?
32
+ ReportingScope.suppressed?
33
+ end
34
+
26
35
  def report_error(exception, **kwargs)
27
36
  reporter.report_error(exception, **kwargs)
28
37
  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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logister
@@ -86,6 +86,7 @@ files:
86
86
  - lib/logister/middleware.rb
87
87
  - lib/logister/railtie.rb
88
88
  - lib/logister/reporter.rb
89
+ - lib/logister/reporting_scope.rb
89
90
  - lib/logister/request_subscriber.rb
90
91
  - lib/logister/sql_subscriber.rb
91
92
  - lib/logister/version.rb