Module: Sbmt::KafkaConsumer::Probes::Probe
- Defined in:
- lib/sbmt/kafka_consumer/probes/probe.rb
Constant Summary collapse
- HEADERS =
{"Content-Type" => "application/json"}
Instance Method Summary collapse
- #call(env) ⇒ Object
- #meta ⇒ Object
- #probe_error(extra_meta = {}) ⇒ Object
- #probe_ok(extra_meta = {}) ⇒ Object
- #with_error_handler ⇒ Object
Instance Method Details
#call(env) ⇒ Object
9 10 11 |
# File 'lib/sbmt/kafka_consumer/probes/probe.rb', line 9 def call(env) with_error_handler { probe(env) } end |
#meta ⇒ Object
13 14 15 |
# File 'lib/sbmt/kafka_consumer/probes/probe.rb', line 13 def {} end |
#probe_error(extra_meta = {}) ⇒ Object
21 22 23 24 |
# File 'lib/sbmt/kafka_consumer/probes/probe.rb', line 21 def probe_error( = {}) KafkaConsumer.logger.error("probe error meta: #{.merge().inspect}") [500, HEADERS, [.merge().to_json]] end |
#probe_ok(extra_meta = {}) ⇒ Object
17 18 19 |
# File 'lib/sbmt/kafka_consumer/probes/probe.rb', line 17 def probe_ok( = {}) [200, HEADERS, [.merge().to_json]] end |
#with_error_handler ⇒ Object
26 27 28 29 30 |
# File 'lib/sbmt/kafka_consumer/probes/probe.rb', line 26 def with_error_handler yield rescue => error probe_error(error_class: error.class.name, error_message: error.) end |