request_trail 0.7.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46f0f0b5ac13bf9ea151c441b9de780076a0350c34a4268258701bd4bc9e2bd6
4
- data.tar.gz: 0d1823f675d5074c2b1ee8664970737b81ac9a3b3535a58a1f56bdf029f5089e
3
+ metadata.gz: a446bfe8d8211a6734786f850bfa5bcab17904331b3e3699b193781daacb19c5
4
+ data.tar.gz: 86a20769cd6933ae4c9b9577db5bf0ae688297276f1ab214b30f2ca187abb03e
5
5
  SHA512:
6
- metadata.gz: 2d1bf8caea4104913b8a4ef9c1b1c4aa517d4aaeb96f83f5fa49242ceee598cbdb6c118191e6bd0eecacd4ee3bdbaf77293f6725750768dff5dd4a182bfae6ee
7
- data.tar.gz: c412309dd55a91d2eeec4c9cbed03999a1dc4e317638873ccb7662a384e146ee3af8d3a0f783fa9288047eca475d8cfc578048c54d556354e8fcf66d51a70575
6
+ metadata.gz: 50e1534e4ac2d05a93c5c82227be357db5b45fe390866a454fa34aa31199db8adb25ac096b8349dbc00e0bc332ed2f8c9c6111e1dd523917e70c6d6da3d98c9d
7
+ data.tar.gz: 7f7b5d6a59e57ac1409bd62090820b6fc7a8a1f85299837ebec0ecb03abaecd1a1b1497a20dbbdd877324a388e61dc34a4d81128133dd5a678d5fb6b18d5a447
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.0.0] - 2026-06-14
4
+
5
+ ### Added
6
+
7
+ - Overhead benchmark suite (`benchmarks/overhead.rb`) — measures per-request latency added by the middleware; target < 1ms (actual: ~0.003ms)
8
+ - Stable API documentation — README lists all public interfaces frozen for the 1.x series
9
+
10
+ ### Changed
11
+
12
+ - Gemspec summary and description updated to reflect the full feature set
13
+
3
14
  ## [0.7.0] - 2026-06-14
4
15
 
5
16
  ### Added
@@ -66,7 +77,8 @@
66
77
  - `RequestTrail::Subscriber` — attach/detach API for notification subscriptions
67
78
  - `RequestTrail::Collector` — thread-safe per-request event accumulator
68
79
 
69
- [Unreleased]: https://github.com/eclectic-coding/request-trail/compare/v0.7.0...HEAD
80
+ [Unreleased]: https://github.com/eclectic-coding/request-trail/compare/v1.0.0...HEAD
81
+ [1.0.0]: https://github.com/eclectic-coding/request-trail/compare/v0.7.0...v1.0.0
70
82
  [0.7.0]: https://github.com/eclectic-coding/request-trail/compare/v0.6.0...v0.7.0
71
83
  [0.6.0]: https://github.com/eclectic-coding/request-trail/compare/v0.5.0...v0.6.0
72
84
  [0.5.0]: https://github.com/eclectic-coding/request-trail/releases/tag/v0.5.0
data/README.md CHANGED
@@ -24,6 +24,7 @@ Middleware that traces a request through all the layers (middleware, controller,
24
24
  - [Installation generator](#installation-generator)
25
25
  - [Configuration](#configuration)
26
26
  - [Non-Rails (plain Rack)](#non-rails-plain-rack)
27
+ - [Stable API](#stable-api)
27
28
  - [Development](#development)
28
29
  - [Contributing](#contributing)
29
30
  - [License](#license)
@@ -301,6 +302,26 @@ run MyApp
301
302
 
302
303
  [Back to top](#requesttrail)
303
304
 
305
+ ## Stable API
306
+
307
+ As of v1.0.0 the following interfaces are frozen and will not change in a breaking way within the 1.x series:
308
+
309
+ | Interface | Notes |
310
+ |-----------|-------|
311
+ | `RequestTrail.configure { \|c\| ... }` | Configuration DSL — all `config.*=` setters |
312
+ | `RequestTrail::Middleware` | Rack middleware; constructor signature `Middleware.new(app)` |
313
+ | `RequestTrail::Railtie` | Auto-inserted; no public API beyond being present |
314
+ | `RequestTrail::Subscriber.attach` / `.detach` | Notification subscription lifecycle |
315
+ | `RequestTrail::Collector` attr readers | `elapsed_ms`, `sql_count`, `sql_duration_ms`, `cache_hits`, `cache_misses`, `cache_writes`, `cache_duration_ms`, `action_duration_ms`, `view_duration_ms`, `http_count`, `http_duration_ms` |
316
+ | `RequestTrail::Formatters::Base` | Formatter duck-type contract: `#format(request, collector) -> String` |
317
+ | `RequestTrail::Formatters::FlameGraph` | Constructor: `FlameGraph.new(colorize:, colors:)` |
318
+ | `RequestTrail::Formatters::JSON` | Constructor: `JSON.new` |
319
+ | `RequestTrail::SidekiqMiddleware` | Sidekiq server middleware |
320
+ | `RequestTrail::ActiveJobSubscriber` | Module to include in `ApplicationJob` |
321
+ | `RequestTrail.log_tag` | Returns a proc suitable for `config.log_tags` |
322
+
323
+ [Back to top](#requesttrail)
324
+
304
325
  ## Development
305
326
 
306
327
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake` to run the full CI suite (audit + lint + tests). You can also run `bin/console` for an interactive prompt.
data/ROADMAP.md CHANGED
@@ -1,10 +1,3 @@
1
1
  # Roadmap
2
2
 
3
- `request_trail` traces a Rails request through every processing layer — middleware, controller, ActiveRecord, cache — and emits a flame-graph-style summary to the log. This roadmap describes the incremental path to a stable 1.0.0.
4
-
5
- ## 1.0.0 — Stable Release
6
-
7
- - Frozen public API (`Request::Trail.configure`, middleware interface, formatter interface)
8
- - 100% test coverage
9
- - Overhead benchmark suite (target: < 1ms added latency per request)
10
- - Full usage documentation with real-world examples
3
+ `request_trail` traces a Rails request through every processing layer — middleware, controller, ActiveRecord, cache — and emits a flame-graph-style summary to the log. The gem reached its stable 1.0.0 milestone; future work will be tracked via GitHub Issues.
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Measures the per-request overhead added by RequestTrail::Middleware.
4
+ #
5
+ # Run with:
6
+ # bundle exec ruby benchmarks/overhead.rb
7
+ #
8
+ # Target: < 1ms added latency per request.
9
+
10
+ require "benchmark/ips"
11
+ require "rack"
12
+ require "rack/mock"
13
+ require "active_support"
14
+ require "active_support/notifications"
15
+ require_relative "../lib/request_trail"
16
+
17
+ INNER_APP = ->(_env) { [200, { "content-type" => "text/plain" }, ["OK"]] }
18
+
19
+ RequestTrail.configure do |config|
20
+ config.enabled = true
21
+ config.log_level = :debug
22
+ config.logger = Logger.new(File::NULL)
23
+ config.threshold_ms = 0
24
+ end
25
+
26
+ RequestTrail::Subscriber.attach
27
+
28
+ TRACED_APP = RequestTrail::Middleware.new(INNER_APP)
29
+
30
+ ENV_TEMPLATE = Rack::MockRequest.env_for("/bench", method: "GET")
31
+
32
+ Benchmark.ips do |x|
33
+ x.config(time: 5, warmup: 2)
34
+
35
+ x.report("baseline (no middleware)") do
36
+ INNER_APP.call(ENV_TEMPLATE.dup)
37
+ end
38
+
39
+ x.report("with RequestTrail middleware") do
40
+ TRACED_APP.call(ENV_TEMPLATE.dup)
41
+ end
42
+
43
+ x.compare!
44
+ end
45
+
46
+ # Print overhead summary using monotonic clock (no benchmark gem required)
47
+ n = 50_000
48
+
49
+ t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
50
+ n.times { INNER_APP.call(ENV_TEMPLATE.dup) }
51
+ baseline_s = Process.clock_gettime(Process::CLOCK_MONOTONIC) - t0
52
+
53
+ t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
54
+ n.times { TRACED_APP.call(ENV_TEMPLATE.dup) }
55
+ traced_s = Process.clock_gettime(Process::CLOCK_MONOTONIC) - t0
56
+
57
+ overhead_ms = ((traced_s - baseline_s) / n) * 1000
58
+
59
+ puts format("\n-- Overhead summary (%d iterations) --", n)
60
+ puts format("Baseline: %.3f µs/req", (baseline_s / n) * 1_000_000)
61
+ puts format("Traced: %.3f µs/req", (traced_s / n) * 1_000_000)
62
+ puts format("Overhead: %.4f ms/req (target: < 1ms)", overhead_ms)
63
+ puts overhead_ms < 1.0 ? "PASS: overhead is under 1ms" : "FAIL: overhead exceeds 1ms"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RequestTrail
4
- VERSION = "0.7.0"
4
+ VERSION = "1.0.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request_trail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuck Smith
@@ -37,8 +37,11 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '2.0'
40
- description: Middleware that traces a request through middleware, controller, ActiveRecord,
41
- and cache layers, then dumps a flame-graph-style summary to the log.
40
+ description: Rack middleware that traces every request through all processing layers
41
+ controller, ActiveRecord, cache, ActiveJob, and outbound HTTP via Faraday then
42
+ emits a flame-graph-style summary to the Rails log. Supports plain-text, ASCII flame-graph,
43
+ and JSON output; N+1 detection; sampling; path filtering; Sidekiq and ActiveJob
44
+ adapters; and Rails log tags. Overhead under 1ms per request.
42
45
  email:
43
46
  - eclectic-coding@users.noreply.github.com
44
47
  executables: []
@@ -53,6 +56,7 @@ files:
53
56
  - README.md
54
57
  - ROADMAP.md
55
58
  - Rakefile
59
+ - benchmarks/overhead.rb
56
60
  - codecov.yml
57
61
  - lib/generators/request_trail/install/install_generator.rb
58
62
  - lib/generators/request_trail/install/templates/request_trail.rb.tt
@@ -106,6 +110,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
110
  requirements: []
107
111
  rubygems_version: 3.6.9
108
112
  specification_version: 4
109
- summary: Traces a Rails request through all layers and dumps a flame-graph summary
110
- to the log.
113
+ summary: 'Per-request flame-graph tracing for Rails: SQL, cache, controller, ActiveJob,
114
+ and outbound HTTP.'
111
115
  test_files: []