Class: SourceMonitor::Configuration

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

#authenticationObject (readonly)

Returns the value of attribute authentication.



34
35
36
# File 'lib/source_monitor/configuration.rb', line 34

def authentication
  @authentication
end

#eventsObject (readonly)

Returns the value of attribute events.



34
35
36
# File 'lib/source_monitor/configuration.rb', line 34

def events
  @events
end

#faviconsObject (readonly)

Returns the value of attribute favicons.



34
35
36
# File 'lib/source_monitor/configuration.rb', line 34

def favicons
  @favicons
end

#fetch_queue_concurrencyObject

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_nameObject

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

#fetchingObject (readonly)

Returns the value of attribute fetching.



34
35
36
# File 'lib/source_monitor/configuration.rb', line 34

def fetching
  @fetching
end

#healthObject (readonly)

Returns the value of attribute health.



34
35
36
# File 'lib/source_monitor/configuration.rb', line 34

def health
  @health
end

#httpObject (readonly)

Returns the value of attribute http.



34
35
36
# File 'lib/source_monitor/configuration.rb', line 34

def http
  @http
end

#imagesObject (readonly)

Returns the value of attribute images.



34
35
36
# File 'lib/source_monitor/configuration.rb', line 34

def images
  @images
end

#job_metrics_enabledObject

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_concurrencyObject

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_nameObject

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_pathObject

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_enabledObject

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

#modelsObject (readonly)

Returns the value of attribute models.



34
35
36
# File 'lib/source_monitor/configuration.rb', line 34

def models
  @models
end

#queue_namespaceObject

Returns the value of attribute queue_namespace.



22
23
24
# File 'lib/source_monitor/configuration.rb', line 22

def queue_namespace
  @queue_namespace
end

#realtimeObject (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_classObject

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

#retentionObject (readonly)

Returns the value of attribute retention.



34
35
36
# File 'lib/source_monitor/configuration.rb', line 34

def retention
  @retention
end

#scrape_queue_concurrencyObject

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_nameObject

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

#scrapersObject (readonly)

Returns the value of attribute scrapers.



34
35
36
# File 'lib/source_monitor/configuration.rb', line 34

def scrapers
  @scrapers
end

#scrapingObject (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