Class: TCellAgent::SensorEvents::AppSensorMetaEvent
- Inherits:
-
TCellSensorEvent
- Object
- Hash
- TCellSensorEvent
- TCellAgent::SensorEvents::AppSensorMetaEvent
- Defined in:
- lib/tcell_agent/sensor_events/appsensor_meta_event.rb
Instance Attribute Summary collapse
-
#body_dict ⇒ Object
Returns the value of attribute body_dict.
-
#cookie_dict ⇒ Object
Returns the value of attribute cookie_dict.
-
#get_dict ⇒ Object
Returns the value of attribute get_dict.
-
#location ⇒ Object
Returns the value of attribute location.
-
#method ⇒ Object
Returns the value of attribute method.
-
#path_parameters ⇒ Object
Returns the value of attribute path_parameters.
-
#post_dict ⇒ Object
Returns the value of attribute post_dict.
-
#remote_address ⇒ Object
Returns the value of attribute remote_address.
-
#request_content_len ⇒ Object
Returns the value of attribute request_content_len.
-
#request_headers ⇒ Object
Returns the value of attribute request_headers.
-
#response_code ⇒ Object
Returns the value of attribute response_code.
-
#response_content_len ⇒ Object
Returns the value of attribute response_content_len.
-
#response_headers ⇒ Object
Returns the value of attribute response_headers.
-
#route_id ⇒ Object
Returns the value of attribute route_id.
-
#session_id ⇒ Object
Returns the value of attribute session_id.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Attributes inherited from TCellSensorEvent
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ AppSensorMetaEvent
constructor
A new instance of AppSensorMetaEvent.
- #post_process ⇒ Object
- #set_body_dict(request_content_len, request_content_type, request_body) ⇒ Object
Methods inherited from TCellSensorEvent
Constructor Details
#initialize ⇒ AppSensorMetaEvent
Returns a new instance of AppSensorMetaEvent.
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 60 def initialize @request_content_len = 0 @response_content_len = 0 @send = false @body_dict = {} @get_dict = {} @post_dict = {} = {} @user_agent = nil @path_parameters = {} end |
Instance Attribute Details
#body_dict ⇒ Object
Returns the value of attribute body_dict.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def body_dict @body_dict end |
#cookie_dict ⇒ Object
Returns the value of attribute cookie_dict.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def end |
#get_dict ⇒ Object
Returns the value of attribute get_dict.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def get_dict @get_dict end |
#location ⇒ Object
Returns the value of attribute location.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def location @location end |
#method ⇒ Object
Returns the value of attribute method.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def method @method end |
#path_parameters ⇒ Object
Returns the value of attribute path_parameters.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def path_parameters @path_parameters end |
#post_dict ⇒ Object
Returns the value of attribute post_dict.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def post_dict @post_dict end |
#remote_address ⇒ Object
Returns the value of attribute remote_address.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def remote_address @remote_address end |
#request_content_len ⇒ Object
Returns the value of attribute request_content_len.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def request_content_len @request_content_len end |
#request_headers ⇒ Object
Returns the value of attribute request_headers.
58 59 60 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 58 def request_headers @request_headers end |
#response_code ⇒ Object
Returns the value of attribute response_code.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def response_code @response_code end |
#response_content_len ⇒ Object
Returns the value of attribute response_content_len.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def response_content_len @response_content_len end |
#response_headers ⇒ Object
Returns the value of attribute response_headers.
58 59 60 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 58 def response_headers @response_headers end |
#route_id ⇒ Object
Returns the value of attribute route_id.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def route_id @route_id end |
#session_id ⇒ Object
Returns the value of attribute session_id.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def session_id @session_id end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def transaction_id @transaction_id end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def user_agent @user_agent end |
#user_id ⇒ Object
Returns the value of attribute user_id.
54 55 56 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 54 def user_id @user_id end |
Class Method Details
.build(request, rack_response, response_code, response_headers) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 20 def build(request, rack_response, response_code, response_headers) = AppSensorMetaEvent.new .remote_address = TCellAgent::Utils::Rails.better_ip(request) .method = request.request_method .location = "#{request.base_url}#{request.fullpath}" .request_headers = request.env .user_agent = request.env['HTTP_USER_AGENT'] .request_content_len = (request.content_length || "0").to_i .response_content_len = (rack_response.length || "0").to_i .get_dict = request.GET .post_dict = request.POST . = request. .response_code = response_code .response_headers = response_headers .path_parameters = request.env[TCellAgent::Instrumentation::TCELL_ID].path_parameters .route_id = request.env[TCellAgent::Instrumentation::TCELL_ID].route_id .transaction_id = request.env[TCellAgent::Instrumentation::TCELL_ID].transaction_id .session_id = request.env[TCellAgent::Instrumentation::TCELL_ID].hmac_session_id .user_id = request.env[TCellAgent::Instrumentation::TCELL_ID].user_id .set_body_dict( .request_content_len, request.content_type, request.body.gets ) end |
Instance Method Details
#post_process ⇒ Object
90 91 92 93 94 95 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 90 def post_process appsensor_policy = TCellAgent.policy(TCellAgent::PolicyTypes::AppSensor) return unless appsensor_policy appsensor_policy.(self) end |
#set_body_dict(request_content_len, request_content_type, request_body) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/tcell_agent/sensor_events/appsensor_meta_event.rb', line 72 def set_body_dict(request_content_len, request_content_type, request_body) if request_content_len > 2000000 @body_dict = {} else if request_content_type =~ %r{application/json}i && request_body begin @body_dict = JSON.parse(request_body) rescue TCellAgent.logger.debug("JSON body parameter parsing failed") @body_dict = {} end else @body_dict = {} end end end |