Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AC/FC integration #2995

Open
wants to merge 30 commits into
base: dev
Choose a base branch
from
Open

AC/FC integration #2995

wants to merge 30 commits into from

Conversation

kaylareopelle
Copy link
Contributor

Resolves #2859

When the agent recognizes it is running in an agent control
environment, it will start automatic health checks that will
create a new file at a configured destination at a given
frequency that provides details about the last reported status
of the agent.

When the agent is not seen within an agent control environment,
files will not be created.
@kaylareopelle kaylareopelle changed the title WIP: AC/FC integration AC/FC integration Jan 7, 2025
CHANGELOG.md Outdated Show resolved Hide resolved
lib/new_relic/agent/configuration/default_source.rb Outdated Show resolved Hide resolved
lib/new_relic/agent/health_check.rb Outdated Show resolved Hide resolved
lib/new_relic/agent/health_check.rb Outdated Show resolved Hide resolved
test/new_relic/agent/health_check_test.rb Show resolved Hide resolved
@kaylareopelle kaylareopelle marked this pull request as ready for review January 7, 2025 01:16
kaylareopelle and others added 11 commits January 7, 2025 10:22
Instead of creating a new file at the interval, reuse the same file for
the life of the process.
The array was not being correctly destructured, which would raise an
error when the status was HTTP_ERROR
The health check status may be updated for other reasons on the CI,
which may cause the message to be inaccurate by the time the result is
accessed from the hash
There was a bug related to the HTTP_ERROR constant, where the sprintf
string manipulation changed the constant to equal the first value it
came across. By freezing the constants and
dup'ing the status before assigning it,
we can avoid this problem.
Previously the invalid license key status would be set, but the
health check files would not be written until the first request to the
web app was made.

Now, health checks will begin before the agent officially starts.
Copy link
Contributor

@tannalynn tannalynn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple of questions and noticed some puts, wanted to comment on them just to make sure they dont get forgotten in the future.

lib/new_relic/agent/health_check.rb Outdated Show resolved Hide resolved
lib/new_relic/agent/health_check.rb Outdated Show resolved Hide resolved
lib/new_relic/agent/health_check.rb Outdated Show resolved Hide resolved
test/new_relic/agent/agent/start_test.rb Outdated Show resolved Hide resolved
test/new_relic/agent/agent/start_test.rb Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
lib/new_relic/agent/health_check.rb Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
test/new_relic/agent/health_check_test.rb Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Make sure the SHUTDOWN status is only applied when the agent is healthy
Instead of waiting until
create_and_run_health_check_loop is run to verify
the necessary config options are present, evaluate whether checks
are enabled on initialization.

In addition, log the status of the config-related instance variables
during initialization.
Copy link
Contributor

SimpleCov Report

Coverage Threshold
Line 93.57% 93%

The fleet ID setting has been replaced by agent_control.enabled.
At this time, enabled will only refer to health checks being enabled.
The value is a Boolean and defaults to false.
The default value is '/newrelic/apm/health' in the code,
though the spec default is 'file:///newrelic/apm/health'.
Since we need to remove the 'file://' anyway, take it out when defining
the string to avoid unncessary gsubs
* Add link to Agent Control documentation
* Add environment variable detail to config description
* Capitalize Agent Control in logs and docs
@continue = false
end

def create_file_path
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep an eye on the spec for this; we may not need to create the path if it doesn't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AC/FC Integration Support
4 participants