Class: Threatstack::Events::InstrumentationEvent

Inherits:
BaseEvent
  • Object
show all
Defined in:
lib/events/models/instrumentation_event.rb

Overview

Instrumentation event model that inherits the common attributes and adds its own specifics

Instance Attribute Summary collapse

Attributes inherited from BaseEvent

#agent_type, #event_id, #event_type, #timestamp

Instance Method Summary collapse

Methods inherited from BaseEvent

#to_core_hash, #to_json_string

Constructor Details

#initialize(args) ⇒ InstrumentationEvent

Returns a new instance of InstrumentationEvent.

Parameters:

  • args (Hash)
    String

    args.module_name

    String

    args.method_name

    String

    args.file_path

    Integer

    args.line_num

    Array

    args.arguments


22
23
24
25
26
27
28
29
30
# File 'lib/events/models/instrumentation_event.rb', line 22

def initialize(args)
  args[:event_type] = 'instrumentation'
  @module_name = args[:module_name]
  @method_name = args[:method_name]
  @file_path = args[:file_path]
  @line_num = args[:line_num]
  @arguments = args[:arguments]
  super args
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.


14
15
16
# File 'lib/events/models/instrumentation_event.rb', line 14

def arguments
  @arguments
end

#file_pathObject

Returns the value of attribute file_path.


12
13
14
# File 'lib/events/models/instrumentation_event.rb', line 12

def file_path
  @file_path
end

#line_numObject

Returns the value of attribute line_num.


13
14
15
# File 'lib/events/models/instrumentation_event.rb', line 13

def line_num
  @line_num
end

#method_nameObject

Returns the value of attribute method_name.


11
12
13
# File 'lib/events/models/instrumentation_event.rb', line 11

def method_name
  @method_name
end

#module_nameObject

Returns the value of attribute module_name.


10
11
12
# File 'lib/events/models/instrumentation_event.rb', line 10

def module_name
  @module_name
end

Instance Method Details

#to_hashObject


32
33
34
35
36
37
38
39
40
41
42
# File 'lib/events/models/instrumentation_event.rb', line 32

def to_hash
  hash = to_core_hash
  hash[:module_name] = @module_name
  hash[:method_name] = @method_name
  hash[:line_num] = @line_num
  hash[:file_path] = @file_path
  hash[:payload] = {
    :arguments => @arguments
  }
  hash
end