Class: TCellAgent::SensorEvents::TCellAppSensorEvent

Inherits:
TCellSensorEvent show all
Defined in:
lib/tcell_agent/sensor_events/appsensor_event.rb

Instance Attribute Summary

Attributes inherited from TCellSensorEvent

#ensure, #flush, #send

Instance Method Summary collapse

Methods inherited from TCellSensorEvent

#bucket_key, #calculateOffset

Constructor Details

#initialize(location, detection_point, method, remote_addr, param, route_id, data = nil, session_id = nil, user_id = nil, payload = nil, pattern = nil) ⇒ TCellAppSensorEvent

Returns a new instance of TCellAppSensorEvent.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/tcell_agent/sensor_events/appsensor_event.rb', line 9

def initialize(location,
               detection_point,
               method,
               remote_addr,
               param,
               route_id,
               data=nil,
               session_id=nil,
               user_id=nil,
               payload=nil,
               pattern=nil)
  super("as")
  self["dp"] = detection_point
  self["param"] = param
  self["remote_addr"] = remote_addr
  if (route_id)
    self["rou"] = route_id
  end
  self["m"] = method
  @raw_location = location
  @user_id = user_id
  @raw_session_id = session_id
  @payload = payload
  if pattern
    self["pattern"] = pattern
  end
end

Instance Method Details

#post_processObject



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/tcell_agent/sensor_events/appsensor_event.rb', line 37

def post_process
  self["loc"] = Util.strip_uri_values(@raw_location)
  if @user_id
    self["uid"] = @user_id.to_s
  end
  if @raw_session_id
    hmac_key = Util.getHmacKey()
    self["sid"] = Util.hmac(@raw_session_id, hmac_key)
  end
  if @payload
    self["payload"] = @payload[0..150]
  end
end