Class: Raygun::Apm::Diagnostics
- Inherits:
-
Object
- Object
- Raygun::Apm::Diagnostics
- Defined in:
- lib/raygun/apm/diagnostics.rb
Constant Summary collapse
- AGENT_STATE_DOWN =
"\nThe Raygun APM Agent appears to not be running on the current host.\nIf not already installed, please consult https://raygun.com/documentation/product-guides/apm/agent/downloads/\nOtherwise refer to https://raygun.com/documentation/product-guides/apm/agent/installation/ for starting the Agent."
- AGENT_STATE_UNKNOWN =
"\nThe Raygun APM Agent is reachable, but Unable to determine the state of the Agent at the moment."
- AGENT_STATE_UP_MISCONFIGURED =
"\nThe Raygun APM Agent is running, but misconfigured.\nThe API Key needs to be set through the Raygun_ApiKey environment variable.\nThe API key can be found under 'Application Settings' in the Raygun UI"
- AGENT_STATE_UP_CONFIGURED =
"\nThe Raygun APM Agent is configured properly!"
- AGENT_MINIMUM_VERSION_NOT_MET =
"\nVersion #{Raygun::Apm::VERSION} of the Raygun APM Profiler requires a minimum Agent version #{Raygun::Apm::MINIMUM_AGENT_VERSION}\nPlease download the latest Agent from https://raygun.com/documentation/product-guides/apm/agent/downloads/"
- PROFILER_NOOPED =
"Profiler loaded in noop mode and will be disabled due to the minimum Agent version not met"
Instance Method Summary collapse
-
#initialize(host: Apm::Config::TCP_MANAGEMENT_HOST, port: Apm::Config::TCP_MANAGEMENT_PORT) ⇒ Diagnostics
constructor
A new instance of Diagnostics.
- #verify_agent(tracer) ⇒ Object
Constructor Details
#initialize(host: Apm::Config::TCP_MANAGEMENT_HOST, port: Apm::Config::TCP_MANAGEMENT_PORT) ⇒ Diagnostics
Returns a new instance of Diagnostics.
14 15 16 17 |
# File 'lib/raygun/apm/diagnostics.rb', line 14 def initialize(host: Apm::Config::TCP_MANAGEMENT_HOST, port: Apm::Config::TCP_MANAGEMENT_PORT) @host = host @port = port end |
Instance Method Details
#verify_agent(tracer) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/raygun/apm/diagnostics.rb', line 19 def verify_agent(tracer) socket.write "GetAgentInfo" response = JSON.parse(socket.gets) if minimum_agent_version_not_met?(response['Version']) puts AGENT_MINIMUM_VERSION_NOT_MET tracer.noop! puts PROFILER_NOOPED else if response['Status'] == 1 puts AGENT_STATE_UP_CONFIGURED elsif response['Status'] == 0 puts AGENT_STATE_UP_MISCONFIGURED end end rescue Errno::ECONNREFUSED puts AGENT_STATE_DOWN rescue puts AGENT_STATE_UNKNOWN end |