Class: Datadog::Core::Environment::AgentInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/core/environment/agent_info.rb

Overview

Retrieves the agent’s ‘/info` endpoint data. This data can be used to determine the capabilities of the local Datadog agent.

Examples:

Example response payload

{
  "version" : "7.57.2",
  "git_commit" : "38ba0c7",
  "endpoints" : [ "/v0.4/traces", "/v0.4/services", "/v0.7/traces", "/v0.7/config" ],
  "client_drop_p0s" : true,
  "span_meta_structs" : true,
  "long_running_spans" : true,
  "evp_proxy_allowed_headers" : [ "Content-Type", "Accept-Encoding", "Content-Encoding", "User-Agent" ],
  "config" : {
    "default_env" : "none",
    "target_tps" : 10,
    "max_eps" : 200,
    "receiver_port" : 8126,
    "receiver_socket" : "/var/run/datadog/apm.socket",
    "connection_limit" : 0,
    "receiver_timeout" : 0,
    "max_request_bytes" : 26214400,
    "statsd_port" : 8125,
    "analyzed_spans_by_service" : { },
    "obfuscation" : {
      "elastic_search" : true,
      "mongo" : true,
      "sql_exec_plan" : false,
      "sql_exec_plan_normalize" : false,
      "http" : {
        "remove_query_string" : false,
        "remove_path_digits" : false
      },
      "remove_stack_traces" : false,
      "redis" : {
        "Enabled" : true,
        "RemoveAllArgs" : false
      },
      "memcached" : {
        "Enabled" : true,
        "KeepCommand" : false
      }
    }
  },
  "peer_tags" : null
}

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent_settings, logger: Datadog.logger) ⇒ AgentInfo

Returns a new instance of AgentInfo.



56
57
58
59
60
# File 'lib/datadog/core/environment/agent_info.rb', line 56

def initialize(agent_settings, logger: Datadog.logger)
  @agent_settings = agent_settings
  @logger = logger
  @client = Remote::Transport::HTTP.root(agent_settings: agent_settings, logger: logger)
end

Instance Attribute Details

#agent_settingsObject (readonly)

Returns the value of attribute agent_settings.



54
55
56
# File 'lib/datadog/core/environment/agent_info.rb', line 54

def agent_settings
  @agent_settings
end

#loggerObject (readonly)

Returns the value of attribute logger.



54
55
56
# File 'lib/datadog/core/environment/agent_info.rb', line 54

def logger
  @logger
end

Instance Method Details

#==(other) ⇒ Object



72
73
74
# File 'lib/datadog/core/environment/agent_info.rb', line 72

def ==(other)
  other.is_a?(self.class) && other.agent_settings == agent_settings
end

#fetchDatadog::Core::Remote::Transport::HTTP::Negotiation::Response?

Fetches the information from the agent.

Returns:



65
66
67
68
69
70
# File 'lib/datadog/core/environment/agent_info.rb', line 65

def fetch
  res = @client.send_info
  return unless res.ok?

  res
end