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.



59
60
61
62
63
# File 'lib/datadog/core/environment/agent_info.rb', line 59

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.



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

def agent_settings
  @agent_settings
end

#loggerObject (readonly)

Returns the value of attribute logger.



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

def logger
  @logger
end

#propagation_checksumInteger? (readonly)

Returns the propagation checksum, comprising of process tags and optionally container tags (from the Trace Agent) Currently called/used by the DBM code to inject the propagation checksum into the SQL comment.

This checksum is used for correlation across signals (traces, DBM, data streams, etc.) in environments

The checksum is populated by the trace transport’s periodic fetch calls.

Returns:

  • the FNV hash based on the container and process tags or nil



88
89
90
# File 'lib/datadog/core/environment/agent_info.rb', line 88

def propagation_checksum
  @propagation_checksum
end

Instance Method Details

#==(other) ⇒ Object



77
78
79
# File 'lib/datadog/core/environment/agent_info.rb', line 77

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 Trace Agent.

Returns:

  • the response from the agent

  • if an error occurred while fetching the information



68
69
70
71
72
73
74
75
# File 'lib/datadog/core/environment/agent_info.rb', line 68

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

  update_propagation_checksum(res)

  res
end