Sha256: 7a67ee8aa3c5d2ce19f074387af1551b1a5bdf9cc84f23bc8864715fcfd08505

Contents?: true

Size: 542 Bytes

Versions: 6

Compression:

Stored size: 542 Bytes

Contents

# Encoding: utf-8

require 'json'

module Etcd
  # Support stats
  module Stats
    def stats_endpoint
      version_prefix + '/stats'
    end

    def stats(type)
      case type
      when :leader
        JSON.parse(api_execute(stats_endpoint + '/leader', :get).body)
      when :store
        JSON.parse(api_execute(stats_endpoint + '/store', :get).body)
      when :self
        JSON.parse(api_execute(stats_endpoint + '/self', :get).body)
      else
        fail ArgumentError, "Invalid stats type '#{type}'"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
etcd-0.3.0 lib/etcd/stats.rb
etcd-0.2.4 lib/etcd/stats.rb
etcd-0.2.3 lib/etcd/stats.rb
etcd-0.2.2 lib/etcd/stats.rb
etcd-0.2.1 lib/etcd/stats.rb
etcd-0.2.0.beta.1 lib/etcd/stats.rb