-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[process-agent] Refactor status build and add it to core agent #10886
[process-agent] Refactor status build and add it to core agent #10886
Conversation
…rrors in api server; update GetStatus signature
6290f7d
to
b9b531f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I love the changes you made
|
||
stats := make(map[string]interface{}) | ||
json.Unmarshal(data, &stats) //nolint:errcheck | ||
renderStatusTemplate(b, "/process-agent.tmpl", stats) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know that the path for this will still be valid after we build and install the agent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other agents are using this same pattern to render the status template e.g. security-agent:
datadog-agent/pkg/status/render.go
Line 134 in 105db35
renderStatusTemplate(b, "/header.tmpl", stats) |
Since the files are located in the templates
folder in the status
package, I believe that they're compiled with the agent so they're always available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! 🔥
This looks great! 🔥 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from agent-core :)
What does this PR do?
Currently process-agent exposes an
agent/status
endpoint that is used only to fetch the core status from the mainpkg/status
library. It's up to the./process-agent status
process to fetch the core status, fetch the expvars, build the final status and render the status template.This PR refactors this architecture to encapsulate the status build inside
/agent/status
. By doing so,./process-agent status
needs only to call the endpoint and render the status template. It also makes it easier to reuse the same endpoint in the core agent to include process-agent in its status output.This PR introduces the following main changes:
pkg/process/util/status.go
filecmd/process-agent/api
uses the GetStatus build function frompkg/process/util
cmd/process-agent/app
fetches the status from the process-agent API servercore agent
fetches the process-agent status from the process-agent API serverpkg/status
so it can be used by both core and process agents.Motivation
Add status command to process-agent and improve agent flare.
Additional Notes
Possible Drawbacks / Trade-offs
Describe how to test/QA your changes
The following tests need to be performed on a linux host, docker, k8s cluster, windows and macOS.
Set the following settings on the
datadog.yaml
fileRun
and
Make sure that the output contains a message saying that the process-agent is not running or is unreachable.
Update datadog.yaml to enable the process-agent
Re-run
and
Make sure that we're showing relevant and correct runtime information for process-agent.
Reviewer's Checklist
Triage
milestone is set.team/..
label has been applied, if known.major_change
label if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote.changelog/no-changelog
label has been applied.qa/skip-qa
label is not applied.need-change/operator
andneed-change/helm
labels have been applied.