Class: LogStash::Api::Commands::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/api/commands/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service = LogStash::Api::Service.instance) ⇒ Base

Returns a new instance of Base.



9
10
11
# File 'lib/logstash/api/commands/base.rb', line 9

def initialize(service = LogStash::Api::Service.instance)
  @service = service
end

Instance Attribute Details

#serviceObject (readonly)

Returns the value of attribute service.



7
8
9
# File 'lib/logstash/api/commands/base.rb', line 7

def service
  @service
end

Instance Method Details

#extract_metrics(path, *keys) ⇒ Object



21
22
23
# File 'lib/logstash/api/commands/base.rb', line 21

def extract_metrics(path, *keys)
  service.extract_metrics(path, *keys)
end

#started_atObject



17
18
19
# File 'lib/logstash/api/commands/base.rb', line 17

def started_at
  (LogStash::Agent::STARTED_AT.to_f * 1000.0).to_i
end

#uptimeObject



13
14
15
# File 'lib/logstash/api/commands/base.rb', line 13

def uptime
  service.agent.uptime
end