Class: HystrixMetrics::Metric

Inherits:
HystrixCommand
  • Object
show all
Defined in:
lib/hystrix_metrics/metric.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, work, group = "Default") ⇒ Metric

Returns a new instance of Metric.



12
13
14
15
16
17
# File 'lib/hystrix_metrics/metric.rb', line 12

def initialize(name, work, group="Default")
    @work = work
    super(HystrixCommand::Setter
        .withGroupKey(HystrixCommandGroupKey::Factory.asKey(group))
        .andCommandKey(HystrixCommandKey::Factory.asKey(name)))
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



10
11
12
# File 'lib/hystrix_metrics/metric.rb', line 10

def command
  @command
end

Instance Method Details

#runObject



19
20
21
# File 'lib/hystrix_metrics/metric.rb', line 19

def run
    @work.call
end