Class: TCellAgent::Rust::AgentConfig

Inherits:
Hash
  • Object
show all
Defined in:
lib/tcell_agent/rust/agent_config.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ AgentConfig

Returns a new instance of AgentConfig.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tcell_agent/rust/agent_config.rb', line 9

def initialize(configuration)
  self['agent_type'] = 'Ruby'
  self['agent_version'] = TCellAgent::VERSION
  self['default_cache_dir'] = File.join(Dir.getwd, 'tcell/cache')
  self['default_config_file_dir'] = File.join(Dir.getwd, 'config')
  self['default_log_dir'] = File.join(Dir.getwd, 'tcell/logs')
  self['default_preload_policy_file_dir'] = Dir.getwd

  if defined?(ConfigInitializer)
    overrides = Models.clean_nils(AgentConfigOverrides.new(configuration))
    self['overrides'] = overrides
  else
    self['overrides'] = { 'applications' => [{ :enable_json_body_inspection => true }],
                          'config_file_path' => configuration.get_config_file_path }
  end

  set_agent_details
end

Instance Method Details

#set_agent_detailsObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tcell_agent/rust/agent_config.rb', line 28

def set_agent_details
  framework_details = if defined?(Rails)
                        TCellAgent::Instrumentation::Rails.framework_details
                      else
                        {}
                      end

  self['agent_details'] = { 'language' => 'Ruby',
                            'language_version' => RUBY_VERSION,
                            'app_framework' => framework_details['app_framework'],
                            'app_framework_version' => framework_details['app_framework_version'] }
end