railwatch 0.5.0 → 0.5.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: 538efe4f9ba268dd88e694a7052542638a86d64f34978bffd45e5edb9e71dd18
4
- data.tar.gz: 3f5d5b22228381e4f9d6657544c44fb3e337c754c9b7a9d683dada967d1592af
3
+ metadata.gz: 6f70fd1ff6ba5db7cfb11bff9fd076b480d6ac899c0a65694b9fbb7ce4753a10
4
+ data.tar.gz: da7db6bc23129be7120f38405d522b1be212b76dd7d30435088fbd462e795028
5
5
  SHA512:
6
- metadata.gz: 923dc66f9d7e94815affc41d5d0df65db1891a6e46b9462ab6dd2931989f60786149fe70142de5f451a1b1d3ff13a8c551fb8b2487b8bd93aade6e95d0ce3600
7
- data.tar.gz: 5f1fc6b7a9e2afade92562883b6467b1ace633c1dcd85ef2d6cde7c6b72f53328922f6e4c7e8c47eb596af2662dcb5b4d09103d061dd4a718484d512ff766913
6
+ metadata.gz: 7c042d82399b79a4aeefaefd0b6a9d9af3d6868af5b4656d215115b46d84c233bbbe185c6e4692170c36c057431328f66d01ad2b4885d8b470e3cc534dbc17b1
7
+ data.tar.gz: 8eb054b07c1e559362647bd125e030add13ee7b4d84d03bdd72dd1bfe3b89cdb26d98f961d01c20c682cf320570700abd6d61baca1c7263c5b3b44004d71926b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.1 (2026-09-21)
4
+
5
+ Three small seams for a host that runs these models on its own routes and
6
+ migration history, found while Railwatch Cloud deleted its fork of them.
7
+
8
+ - `Railwatch.url_helpers` is where the models resolve the links they build
9
+ (a trace from an execution page, a saved view's page). It is the engine's
10
+ routes unless the host sets it to its own.
11
+ - `FilterQuery.filter_routes` narrows grouped route rows by `method:`,
12
+ `route:`, and `status:`; it lived in the requests controller.
13
+ - The export queue migration is renumbered to 20260919000100. A host with
14
+ a telemetry migration of its own at the old number would otherwise fail
15
+ to run either.
16
+
3
17
  ## 0.5.0 (2026-09-21)
4
18
 
5
19
  The telemetry layer the hosted platform runs is this gem's, not a copy. Everything
@@ -4,7 +4,7 @@ module Railwatch
4
4
  class RequestsController < DashboardController
5
5
  def index
6
6
  routes = grouped("request", limit: 200, order: params[:sort], dir: params[:dir])
7
- routes = apply_filters(routes, FilterQuery.parse(params[:q]).fetch(:fields))
7
+ routes = FilterQuery.filter_routes(routes, params[:q])
8
8
  render inertia: { routes: routes, series: series("request"), deploys: deploys_in_window,
9
9
  sort: params[:sort] || "count", dir: params[:dir] || "desc", q: params[:q].to_s }
10
10
  end
@@ -28,24 +28,6 @@ module Railwatch
28
28
 
29
29
  private
30
30
 
31
- # Rollup rows for "request" carry no raw status codes, only aggregated
32
- # count/errors/client_errors, so status:5xx etc. is a family match against
33
- # those buckets rather than an exact code lookup.
34
- def apply_filters(routes, fields)
35
- routes = routes.select { |r| r[:name].start_with?("#{fields['method'].upcase} ") } if fields["method"].present?
36
- routes = routes.select { |r| r[:name].include?(fields["route"]) } if fields["route"].present?
37
- if (range = FilterQuery.status_range(fields["status"]))
38
- routes = routes.select do |r|
39
- case range.begin
40
- when 500..599 then r[:errors].positive?
41
- when 400..499 then r[:client_errors].positive?
42
- else (r[:count] - r[:errors] - r[:client_errors]).positive?
43
- end
44
- end
45
- end
46
- routes
47
- end
48
-
49
31
  def execution_row(r)
50
32
  { execution_id: r.execution_id, name: r.name, status: r.status, duration: r.duration_ms.round(2), occurred_at: r.occurred_at,
51
33
  user_ref: r.user_ref, tenant: r.app_tenant, exception_preview: r.exception_preview, inertia_component: r.inertia_component,
@@ -168,7 +168,7 @@ module Railwatch
168
168
  # is not the whole trace.
169
169
  def trace_url
170
170
  return nil unless @exe.trace_id && trace.size > 1
171
- Railwatch::Engine.routes.url_helpers.application_environment_trace_path(@environment.application, @environment, @exe.trace_id)
171
+ Railwatch.url_helpers.application_environment_trace_path(@environment.application, @environment, @exe.trace_id)
172
172
  end
173
173
 
174
174
  def issues
@@ -38,6 +38,26 @@ module Railwatch
38
38
  end
39
39
  end
40
40
 
41
+ # Narrows grouped route rows (Telemetry::Aggregations.grouped for "request")
42
+ # by method:, route:, and status:. Rollup rows carry no raw status codes,
43
+ # only aggregated count/errors/client_errors, so status:5xx and friends are
44
+ # a family match against those buckets rather than an exact code lookup.
45
+ def self.filter_routes(routes, query)
46
+ fields = parse(query).fetch(:fields)
47
+ routes = routes.select { |r| r[:name].start_with?("#{fields['method'].upcase} ") } if fields["method"].present?
48
+ routes = routes.select { |r| r[:name].include?(fields["route"]) } if fields["route"].present?
49
+ if (range = status_range(fields["status"]))
50
+ routes = routes.select do |r|
51
+ case range.begin
52
+ when 500..599 then r[:errors].positive?
53
+ when 400..499 then r[:client_errors].positive?
54
+ else (r[:count] - r[:errors] - r[:client_errors]).positive?
55
+ end
56
+ end
57
+ end
58
+ routes
59
+ end
60
+
41
61
  def self.fields_for(resource)
42
62
  COMMON_FIELDS + RESOURCE_FIELDS.fetch(resource.to_sym)
43
63
  end
@@ -56,7 +56,7 @@ module Railwatch
56
56
  # This page's index path with the view's window, query, and extra params
57
57
  # (sort/dir) applied -- the shareable URL.
58
58
  def path_for(environment)
59
- Railwatch::Engine.routes.url_helpers.public_send(PAGE_PATHS.fetch(page), environment.application_id, environment.id,
59
+ Railwatch.url_helpers.public_send(PAGE_PATHS.fetch(page), environment.application_id, environment.id,
60
60
  { window: window.presence, q: query.presence, **params.to_h.symbolize_keys }.compact)
61
61
  end
62
62
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Railwatch
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.1"
5
5
  end
data/lib/railwatch.rb CHANGED
@@ -599,6 +599,18 @@ module Railwatch
599
599
  File.expand_path("../db/#{database}_migrate", __dir__)
600
600
  end
601
601
 
602
+ # Where links the models build (a trace from an execution page, a saved
603
+ # view's page) resolve. The engine's own routes serve the embedded
604
+ # dashboard; a host that mounts these pages on its own routes, as
605
+ # Railwatch Cloud does, points this at them.
606
+ def self.url_helpers
607
+ @url_helpers || Engine.routes.url_helpers
608
+ end
609
+
610
+ def self.url_helpers=(helpers)
611
+ @url_helpers = helpers
612
+ end
613
+
602
614
  # The one browser client, relative to the gem root. The dashboard bundle
603
615
  # is built from it, the install generator copies it, the gem ships it (the
604
616
  # only app/frontend file it does), and a host with its own frontend build
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railwatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cole Robertson
@@ -235,7 +235,7 @@ files:
235
235
  - db/railwatch_telemetry_migrate/20260915200000_add_explained_index_to_queries.rb
236
236
  - db/railwatch_telemetry_migrate/20260915210000_add_slowest_index_to_queries.rb
237
237
  - db/railwatch_telemetry_migrate/20260917010000_add_batch_ledger_to_ingest_batches.rb
238
- - db/railwatch_telemetry_migrate/20260919000000_create_export_queue.rb
238
+ - db/railwatch_telemetry_migrate/20260919000100_create_export_queue.rb
239
239
  - docs/ai-and-mcp.md
240
240
  - docs/configuration.md
241
241
  - docs/embedded.md