Class: InformantCommon::Event::AgentInfo
- Defined in:
- lib/informant-common/event/agent_info.rb
Instance Attribute Summary collapse
-
#agent_identifier ⇒ Object
Returns the value of attribute agent_identifier.
-
#framework_version ⇒ Object
Returns the value of attribute framework_version.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(*_args) ⇒ Object
-
#initialize(agent_identifier: nil, framework_version: nil) ⇒ AgentInfo
constructor
A new instance of AgentInfo.
- #to_json(*_args) ⇒ Object
Methods inherited from Base
#authorization_header_value, authorization_header_value, #endpoint, net_http_start_arguments, #net_http_start_arguments, #post_request
Constructor Details
#initialize(agent_identifier: nil, framework_version: nil) ⇒ AgentInfo
Returns a new instance of AgentInfo.
6 7 8 9 |
# File 'lib/informant-common/event/agent_info.rb', line 6 def initialize(agent_identifier: nil, framework_version: nil) self.agent_identifier = agent_identifier self.framework_version = framework_version end |
Instance Attribute Details
#agent_identifier ⇒ Object
Returns the value of attribute agent_identifier.
4 5 6 |
# File 'lib/informant-common/event/agent_info.rb', line 4 def agent_identifier @agent_identifier end |
#framework_version ⇒ Object
Returns the value of attribute framework_version.
4 5 6 |
# File 'lib/informant-common/event/agent_info.rb', line 4 def framework_version @framework_version end |
Class Method Details
.endpoint ⇒ Object
24 25 26 |
# File 'lib/informant-common/event/agent_info.rb', line 24 def self.endpoint @endpoint ||= URI("#{InformantCommon::Config.collector_host}/v2/client-info") end |
Instance Method Details
#as_json(*_args) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/informant-common/event/agent_info.rb', line 11 def as_json(*_args) { agent_identifier: agent_identifier, framework_version: framework_version, runtime_version: "ruby-#{RUBY_VERSION}", mongoid_version: defined?(Mongoid) ? Mongoid::VERSION : nil } end |
#to_json(*_args) ⇒ Object
20 21 22 |
# File 'lib/informant-common/event/agent_info.rb', line 20 def to_json(*_args) as_json.to_json end |