Class: CloudwatchQuery::Parsers::Sidekiq::SidekiqLog

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SidekiqLog

Returns a new instance of SidekiqLog.



11
12
13
14
15
16
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 11

def initialize(attributes = {})
  attributes.each do |key, value|
    instance_variable_set("@#{key}", value) if respond_to?(key)
  end
  @line_type ||= :unknown
end

Instance Attribute Details

#elapsed ⇒ Object (readonly)

Returns the value of attribute elapsed.



7
8
9
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 7

def elapsed
  @elapsed
end

#jid ⇒ Object (readonly)

Returns the value of attribute jid.



7
8
9
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 7

def jid
  @jid
end

#job_class ⇒ Object (readonly)

Returns the value of attribute job_class.



7
8
9
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 7

def job_class
  @job_class
end

#line_type ⇒ Object (readonly)

Returns the value of attribute line_type.



7
8
9
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 7

def line_type
  @line_type
end

#pid ⇒ Object (readonly)

Returns the value of attribute pid.



7
8
9
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 7

def pid
  @pid
end

#raw_message ⇒ Object (readonly)

Returns the value of attribute raw_message.



7
8
9
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 7

def raw_message
  @raw_message
end

#status ⇒ Object (readonly)

Returns the value of attribute status.



7
8
9
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 7

def status
  @status
end

#tid ⇒ Object (readonly)

Returns the value of attribute tid.



7
8
9
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 7

def tid
  @tid
end

#timestamp ⇒ Object (readonly)

Returns the value of attribute timestamp.



7
8
9
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 7

def timestamp
  @timestamp
end

Instance Method Details

#[](key) ⇒ Object



47
48
49
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 47

def [](key)
  instance_variable_get("@#{key}")
end

#done? ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 26

def done?
  line_type == :done
end

#duration ⇒ Object

Alias for elapsed



35
36
37
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 35

def duration
  elapsed
end

#fail? ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 30

def fail?
  line_type == :fail
end

#start? ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 22

def start?
  line_type == :start
end

#to_h ⇒ Object



39
40
41
42
43
44
45
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 39

def to_h
  instance_variables.each_with_object({}) do |var, hash|
    key = var.to_s.delete("@").to_sym
    value = instance_variable_get(var)
    hash[key] = value unless value.nil?
  end
end

#type ⇒ Object



18
19
20
# File 'lib/cloudwatch_query/parsers/sidekiq/sidekiq_log.rb', line 18

def type
  :sidekiq
end