Class: TCellAgent::AppSensor::MetaData

Inherits:
SensorEvents::TCellSensorEvent show all
Defined in:
lib/tcell_agent/appsensor/meta_data.rb

Instance Attribute Summary collapse

Attributes inherited from SensorEvents::TCellSensorEvent

#ensure, #flush, #send

Instance Method Summary collapse

Methods inherited from SensorEvents::TCellSensorEvent

#bucket_key, #calculateOffset, #post_process

Constructor Details

#initializeMetaData

Returns a new instance of MetaData.



12
13
14
15
16
17
18
19
20
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 12

def initialize
  @send = false

  @body_dict = {}
  @get_dict = {}
  @post_dict = {}
  @cookie_dict = {}
  @path_parameters = {}
end

Instance Attribute Details

#body_dictObject

Returns the value of attribute body_dict.



10
11
12
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 10

def body_dict
  @body_dict
end

Returns the value of attribute cookie_dict.



10
11
12
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 10

def cookie_dict
  @cookie_dict
end

#get_dictObject

Returns the value of attribute get_dict.



10
11
12
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 10

def get_dict
  @get_dict
end

#path_parametersObject

Returns the value of attribute path_parameters.



10
11
12
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 10

def path_parameters
  @path_parameters
end

#post_dictObject

Returns the value of attribute post_dict.



10
11
12
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 10

def post_dict
  @post_dict
end

Instance Method Details

#flattened_body_dictObject



40
41
42
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 40

def flattened_body_dict
  @body_dict
end


44
45
46
47
48
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 44

def flattened_cookie_dict
  @flattened_cookie_dict ||= TCellAgent::Utils::Params.flatten(@cookie_dict)

  @flattened_cookie_dict
end

#flattened_get_dictObject



28
29
30
31
32
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 28

def flattened_get_dict
  @flattened_get_dict ||= TCellAgent::Utils::Params.flatten(@get_dict)

  @flattened_get_dict
end

#flattened_path_parametersObject



22
23
24
25
26
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 22

def flattened_path_parameters
  @flattened_path_parameters ||= TCellAgent::Utils::Params.flatten(@path_parameters)

  @flattened_path_parameters
end

#flattened_post_dictObject



34
35
36
37
38
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 34

def flattened_post_dict
  @flattened_post_dict ||= TCellAgent::Utils::Params.flatten(@post_dict)

  @flattened_post_dict
end

#set_body_dict(request_content_bytes_len, request_content_type, request_body) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/tcell_agent/appsensor/meta_data.rb', line 50

def set_body_dict(request_content_bytes_len, request_content_type, request_body)
  if request_content_bytes_len > 2000000
    @body_dict = {}

  else
    if request_content_type =~ %r{application/json}i && request_body
      begin
        # don't enqueue parameter values of unknown type to avoid any serialization issues
        @body_dict = TCellAgent::Utils::Params.flatten(JSON.parse(request_body))
      rescue
        TCellAgent.logger.debug("JSON body parameter parsing failed")
        @body_dict = {}
      end
    else
      @body_dict = {}
    end
  end
end