railsgauge 0.1.0 → 0.1.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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/railsgauge/configuration.rb +27 -2
- data/lib/railsgauge/railtie.rb +1 -1
- data/lib/railsgauge/version.rb +1 -1
- data/lib/railsgauge.rb +1 -1
- data/test/configuration_test.rb +18 -0
- data/test/test_helper.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7de4af7a6d306a88d203cde8c9b47d39607b02a5b7005cc89511fe2f68245dc1
|
|
4
|
+
data.tar.gz: 1629b98e9482fcc68a94149d857bf35b75f54fd7f4c471e2bbf03c17b21d36f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 991052244a921e3f99486d94c496a1177b3944c177acb36d0937ad14d9e8345d31864a2d99c15d203111ec15897f1a9c73539c328f5583e3bb2bf7c2789f46ca
|
|
7
|
+
data.tar.gz: 8e82b2c209882cde77f5153bc79e9c644d94f2eb2d0f04198222022ef36f786796c69fc446edc77e54ace05e90b5a2ad988f52fdfb2afd75076edfffbe53eb13
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.1.1] - 2026-12-05
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- load Railtie unconditionally and detect job engines early
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
8
17
|
## [0.1.0] - 2026-12-05
|
|
9
18
|
|
|
10
19
|
|
|
@@ -70,9 +70,13 @@ module Railsgauge
|
|
|
70
70
|
def resolved_job_backend
|
|
71
71
|
return @job_backend unless @job_backend == :auto
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
adapter = configured_queue_adapter
|
|
74
|
+
return :good_job if adapter == "good_job"
|
|
75
|
+
return :solid_queue if adapter == "solid_queue"
|
|
76
|
+
|
|
77
|
+
if Object.const_defined?("GoodJob::Engine") || Object.const_defined?("GoodJob::Job")
|
|
74
78
|
:good_job
|
|
75
|
-
elsif Object.const_defined?("SolidQueue::ReadyExecution")
|
|
79
|
+
elsif Object.const_defined?("SolidQueue::Engine") || Object.const_defined?("SolidQueue::ReadyExecution")
|
|
76
80
|
:solid_queue
|
|
77
81
|
else
|
|
78
82
|
:none
|
|
@@ -89,5 +93,26 @@ module Railsgauge
|
|
|
89
93
|
def production?
|
|
90
94
|
defined?(Rails) && Rails.respond_to?(:env) && Rails.env&.production? == true
|
|
91
95
|
end
|
|
96
|
+
|
|
97
|
+
private
|
|
98
|
+
|
|
99
|
+
def configured_queue_adapter
|
|
100
|
+
return nil unless defined?(Rails) && Rails.respond_to?(:application)
|
|
101
|
+
|
|
102
|
+
adapter = Rails.application&.config&.try(:active_job)&.try(:queue_adapter)
|
|
103
|
+
return nil unless adapter
|
|
104
|
+
|
|
105
|
+
case adapter
|
|
106
|
+
when Symbol, String
|
|
107
|
+
adapter.to_s
|
|
108
|
+
else
|
|
109
|
+
name = adapter.class.name.to_s
|
|
110
|
+
if name.include?("GoodJob")
|
|
111
|
+
"good_job"
|
|
112
|
+
elsif name.include?("SolidQueue")
|
|
113
|
+
"solid_queue"
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
92
117
|
end
|
|
93
118
|
end
|
data/lib/railsgauge/railtie.rb
CHANGED
data/lib/railsgauge/version.rb
CHANGED
data/lib/railsgauge.rb
CHANGED
|
@@ -10,7 +10,7 @@ require_relative "railsgauge/collectors/database"
|
|
|
10
10
|
require_relative "railsgauge/collectors/active_job"
|
|
11
11
|
require_relative "railsgauge/collectors/good_job"
|
|
12
12
|
require_relative "railsgauge/collectors/solid_queue"
|
|
13
|
-
require_relative "railsgauge/railtie"
|
|
13
|
+
require_relative "railsgauge/railtie"
|
|
14
14
|
|
|
15
15
|
module Railsgauge
|
|
16
16
|
class << self
|
data/test/configuration_test.rb
CHANGED
|
@@ -82,4 +82,22 @@ class ConfigurationTest < Minitest::Test
|
|
|
82
82
|
Railsgauge.enable_for_verification!
|
|
83
83
|
assert_predicate Railsgauge, :enabled?
|
|
84
84
|
end
|
|
85
|
+
|
|
86
|
+
def test_auto_detects_job_backend_from_engine_constants_before_eager_load
|
|
87
|
+
good_job = Module.new
|
|
88
|
+
good_job.const_set(:Engine, Class.new)
|
|
89
|
+
Object.const_set(:GoodJob, good_job)
|
|
90
|
+
assert_equal :good_job, Railsgauge.configuration.resolved_job_backend
|
|
91
|
+
ensure
|
|
92
|
+
Object.send(:remove_const, :GoodJob) if Object.const_defined?(:GoodJob)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def test_auto_detects_solid_queue_from_engine_constant_before_eager_load
|
|
96
|
+
solid_queue = Module.new
|
|
97
|
+
solid_queue.const_set(:Engine, Class.new)
|
|
98
|
+
Object.const_set(:SolidQueue, solid_queue)
|
|
99
|
+
assert_equal :solid_queue, Railsgauge.configuration.resolved_job_backend
|
|
100
|
+
ensure
|
|
101
|
+
Object.send(:remove_const, :SolidQueue) if Object.const_defined?(:SolidQueue)
|
|
102
|
+
end
|
|
85
103
|
end
|
data/test/test_helper.rb
CHANGED
|
@@ -15,6 +15,10 @@ require "socket"
|
|
|
15
15
|
require "tmpdir"
|
|
16
16
|
require "railsgauge"
|
|
17
17
|
|
|
18
|
+
if defined?(Rails) && Rails.root.nil?
|
|
19
|
+
Rails.define_singleton_method(:root) { Pathname.new(File.expand_path("..", __dir__)) }
|
|
20
|
+
end
|
|
21
|
+
|
|
18
22
|
module RailsgaugeTestSupport
|
|
19
23
|
def reset_observability!
|
|
20
24
|
Railsgauge.reset!
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: railsgauge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Paulo Fidalgo
|
|
@@ -174,7 +174,7 @@ metadata:
|
|
|
174
174
|
homepage_uri: https://www.ethos-link.com/opensource/railsgauge
|
|
175
175
|
source_code_uri: https://github.com/ethos-link/railsgauge
|
|
176
176
|
bug_tracker_uri: https://github.com/ethos-link/railsgauge/issues
|
|
177
|
-
changelog_uri: https://github.com/ethos-link/railsgauge/blob/v0.1.
|
|
177
|
+
changelog_uri: https://github.com/ethos-link/railsgauge/blob/v0.1.1/CHANGELOG.md
|
|
178
178
|
documentation_uri: https://www.ethos-link.com/opensource/railsgauge
|
|
179
179
|
funding_uri: https://www.reviato.com/
|
|
180
180
|
github_repo: ssh://github.com/ethos-link/railsgauge
|