Class: SourceMonitor::Configuration
- Inherits:
-
Object
- Object
- SourceMonitor::Configuration
- Defined in:
- lib/source_monitor/configuration.rb,
lib/source_monitor/configuration/events.rb,
lib/source_monitor/configuration/models.rb,
lib/source_monitor/configuration/http_settings.rb,
lib/source_monitor/configuration/health_settings.rb,
lib/source_monitor/configuration/images_settings.rb,
lib/source_monitor/configuration/model_definition.rb,
lib/source_monitor/configuration/scraper_registry.rb,
lib/source_monitor/configuration/favicons_settings.rb,
lib/source_monitor/configuration/fetching_settings.rb,
lib/source_monitor/configuration/realtime_settings.rb,
lib/source_monitor/configuration/scraping_settings.rb,
lib/source_monitor/configuration/retention_settings.rb,
lib/source_monitor/configuration/deprecation_registry.rb,
lib/source_monitor/configuration/deprecation_registry.rb,
lib/source_monitor/configuration/validation_definition.rb,
lib/source_monitor/configuration/authentication_settings.rb
Defined Under Namespace
Classes: AuthenticationSettings, DeprecationRegistry, Events, FaviconsSettings, FetchingSettings, HTTPSettings, HealthSettings, ImagesSettings, ModelDefinition, Models, RealtimeSettings, RetentionSettings, ScraperRegistry, ScrapingSettings, ValidationDefinition
Constant Summary collapse
- DEFAULT_QUEUE_NAMESPACE =
"source_monitor"
Instance Attribute Summary collapse
-
#authentication ⇒ Object
readonly
Returns the value of attribute authentication.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#favicons ⇒ Object
readonly
Returns the value of attribute favicons.
-
#fetch_queue_concurrency ⇒ Object
Returns the value of attribute fetch_queue_concurrency.
-
#fetch_queue_name ⇒ Object
Returns the value of attribute fetch_queue_name.
-
#fetching ⇒ Object
readonly
Returns the value of attribute fetching.
-
#health ⇒ Object
readonly
Returns the value of attribute health.
-
#http ⇒ Object
readonly
Returns the value of attribute http.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#job_metrics_enabled ⇒ Object
Returns the value of attribute job_metrics_enabled.
-
#maintenance_queue_concurrency ⇒ Object
Returns the value of attribute maintenance_queue_concurrency.
-
#maintenance_queue_name ⇒ Object
Returns the value of attribute maintenance_queue_name.
-
#mission_control_dashboard_path ⇒ Object
Returns the value of attribute mission_control_dashboard_path.
-
#mission_control_enabled ⇒ Object
Returns the value of attribute mission_control_enabled.
-
#models ⇒ Object
readonly
Returns the value of attribute models.
-
#queue_namespace ⇒ Object
Returns the value of attribute queue_namespace.
-
#realtime ⇒ Object
readonly
Returns the value of attribute realtime.
-
#recurring_command_job_class ⇒ Object
Returns the value of attribute recurring_command_job_class.
-
#retention ⇒ Object
readonly
Returns the value of attribute retention.
-
#scrape_queue_concurrency ⇒ Object
Returns the value of attribute scrape_queue_concurrency.
-
#scrape_queue_name ⇒ Object
Returns the value of attribute scrape_queue_name.
-
#scrapers ⇒ Object
readonly
Returns the value of attribute scrapers.
-
#scraping ⇒ Object
readonly
Returns the value of attribute scraping.
Instance Method Summary collapse
-
#check_deprecations! ⇒ Object
Post-configure hook for deprecation validation.
- #concurrency_for(role) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #queue_name_for(role) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/source_monitor/configuration.rb', line 38 def initialize @queue_namespace = DEFAULT_QUEUE_NAMESPACE @fetch_queue_name = "#{DEFAULT_QUEUE_NAMESPACE}_fetch" @scrape_queue_name = "#{DEFAULT_QUEUE_NAMESPACE}_scrape" @maintenance_queue_name = "#{DEFAULT_QUEUE_NAMESPACE}_maintenance" @fetch_queue_concurrency = 2 @scrape_queue_concurrency = 2 @maintenance_queue_concurrency = 1 @recurring_command_job_class = nil @job_metrics_enabled = true @mission_control_enabled = false @mission_control_dashboard_path = nil @http = HTTPSettings.new @scrapers = ScraperRegistry.new @retention = RetentionSettings.new @events = Events.new @models = Models.new @realtime = RealtimeSettings.new @fetching = FetchingSettings.new @health = HealthSettings.new @authentication = AuthenticationSettings.new @scraping = ScrapingSettings.new @images = ImagesSettings.new @favicons = FaviconsSettings.new end |
Instance Attribute Details
#authentication ⇒ Object (readonly)
Returns the value of attribute authentication.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def authentication @authentication end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def events @events end |
#favicons ⇒ Object (readonly)
Returns the value of attribute favicons.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def favicons @favicons end |
#fetch_queue_concurrency ⇒ Object
Returns the value of attribute fetch_queue_concurrency.
22 23 24 |
# File 'lib/source_monitor/configuration.rb', line 22 def fetch_queue_concurrency @fetch_queue_concurrency end |
#fetch_queue_name ⇒ Object
Returns the value of attribute fetch_queue_name.
22 23 24 |
# File 'lib/source_monitor/configuration.rb', line 22 def fetch_queue_name @fetch_queue_name end |
#fetching ⇒ Object (readonly)
Returns the value of attribute fetching.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def fetching @fetching end |
#health ⇒ Object (readonly)
Returns the value of attribute health.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def health @health end |
#http ⇒ Object (readonly)
Returns the value of attribute http.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def http @http end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def images @images end |
#job_metrics_enabled ⇒ Object
Returns the value of attribute job_metrics_enabled.
22 23 24 |
# File 'lib/source_monitor/configuration.rb', line 22 def job_metrics_enabled @job_metrics_enabled end |
#maintenance_queue_concurrency ⇒ Object
Returns the value of attribute maintenance_queue_concurrency.
22 23 24 |
# File 'lib/source_monitor/configuration.rb', line 22 def maintenance_queue_concurrency @maintenance_queue_concurrency end |
#maintenance_queue_name ⇒ Object
Returns the value of attribute maintenance_queue_name.
22 23 24 |
# File 'lib/source_monitor/configuration.rb', line 22 def maintenance_queue_name @maintenance_queue_name end |
#mission_control_dashboard_path ⇒ Object
Returns the value of attribute mission_control_dashboard_path.
22 23 24 |
# File 'lib/source_monitor/configuration.rb', line 22 def mission_control_dashboard_path @mission_control_dashboard_path end |
#mission_control_enabled ⇒ Object
Returns the value of attribute mission_control_enabled.
22 23 24 |
# File 'lib/source_monitor/configuration.rb', line 22 def mission_control_enabled @mission_control_enabled end |
#models ⇒ Object (readonly)
Returns the value of attribute models.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def models @models end |
#queue_namespace ⇒ Object
Returns the value of attribute queue_namespace.
22 23 24 |
# File 'lib/source_monitor/configuration.rb', line 22 def queue_namespace @queue_namespace end |
#realtime ⇒ Object (readonly)
Returns the value of attribute realtime.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def realtime @realtime end |
#recurring_command_job_class ⇒ Object
Returns the value of attribute recurring_command_job_class.
22 23 24 |
# File 'lib/source_monitor/configuration.rb', line 22 def recurring_command_job_class @recurring_command_job_class end |
#retention ⇒ Object (readonly)
Returns the value of attribute retention.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def retention @retention end |
#scrape_queue_concurrency ⇒ Object
Returns the value of attribute scrape_queue_concurrency.
22 23 24 |
# File 'lib/source_monitor/configuration.rb', line 22 def scrape_queue_concurrency @scrape_queue_concurrency end |
#scrape_queue_name ⇒ Object
Returns the value of attribute scrape_queue_name.
22 23 24 |
# File 'lib/source_monitor/configuration.rb', line 22 def scrape_queue_name @scrape_queue_name end |
#scrapers ⇒ Object (readonly)
Returns the value of attribute scrapers.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def scrapers @scrapers end |
#scraping ⇒ Object (readonly)
Returns the value of attribute scraping.
34 35 36 |
# File 'lib/source_monitor/configuration.rb', line 34 def scraping @scraping end |
Instance Method Details
#check_deprecations! ⇒ Object
Post-configure hook for deprecation validation. Delegates to DeprecationRegistry.check_defaults! for future “default changed” checks. Currently a no-op.
103 104 105 |
# File 'lib/source_monitor/configuration.rb', line 103 def check_deprecations! DeprecationRegistry.check_defaults!(self) end |
#concurrency_for(role) ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/source_monitor/configuration.rb', line 87 def concurrency_for(role) case role.to_sym when :fetch fetch_queue_concurrency when :scrape scrape_queue_concurrency when :maintenance maintenance_queue_concurrency else raise ArgumentError, "unknown queue role #{role.inspect}" end end |
#queue_name_for(role) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/source_monitor/configuration.rb', line 64 def queue_name_for(role) explicit_name = case role.to_sym when :fetch fetch_queue_name when :scrape scrape_queue_name when :maintenance maintenance_queue_name else raise ArgumentError, "unknown queue role #{role.inspect}" end prefix = ActiveJob::Base.queue_name_prefix delimiter = ActiveJob::Base.queue_name_delimiter if prefix && !prefix.empty? [ prefix, explicit_name ].join(delimiter) else explicit_name end end |