Class: Gitlab::HealthChecks::Probes::Collection
- Inherits:
-
Object
- Object
- Gitlab::HealthChecks::Probes::Collection
- Defined in:
- lib/gitlab/health_checks/probes/collection.rb
Instance Attribute Summary collapse
-
#checks ⇒ Object
readonly
Returns the value of attribute checks.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(*checks) ⇒ Collection
constructor
This accepts an array of objects implementing ‘:readiness` that returns `::Gitlab::HealthChecks::Result`.
Constructor Details
#initialize(*checks) ⇒ Collection
This accepts an array of objects implementing ‘:readiness` that returns `::Gitlab::HealthChecks::Result`
11 12 13 |
# File 'lib/gitlab/health_checks/probes/collection.rb', line 11 def initialize(*checks) @checks = checks end |
Instance Attribute Details
#checks ⇒ Object (readonly)
Returns the value of attribute checks.
7 8 9 |
# File 'lib/gitlab/health_checks/probes/collection.rb', line 7 def checks @checks end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gitlab/health_checks/probes/collection.rb', line 15 def execute readiness = probe_readiness success = all_succeeded?(readiness) Probes::Status.new( success ? 200 : 503, status(success).merge(payload(readiness)) ) rescue StandardError => e exception_payload = { message: "#{e.class} : #{e.}" } Probes::Status.new( 500, status(false).merge(exception_payload)) end |