Class: SlateDb::Metrics

Inherits:
Object
  • Object
show all
Defined in:
lib/slatedb/metrics.rb

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Integer?

Get a metric value by name.

Parameters:

  • name (String)

    Metric name

Returns:

  • (Integer, nil)

    Current value or nil if not found



9
10
11
# File 'lib/slatedb/metrics.rb', line 9

def [](name)
  get(name)
end

#to_hHash

Convert all metrics to a hash.

Returns:

  • (Hash)

    Map of metric name to value



16
17
18
# File 'lib/slatedb/metrics.rb', line 16

def to_h
  names.to_h { |metric_name| [metric_name, get(metric_name)] }
end