Skip to content

Conversation

blakerouse
Copy link
Contributor

@blakerouse blakerouse commented Sep 25, 2025

What does this PR do?

Updates the run subcommand to always log any errors to the logger.

Why is it important?

There where still some cases where the Elastic Agent can fail to run but the reason is not written to the log.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • [ ] I have added an integration test or an E2E test

Disruptive User Impact

None.

Related issues

@blakerouse blakerouse self-assigned this Sep 25, 2025
@blakerouse blakerouse requested a review from a team as a code owner September 25, 2025 19:16
@blakerouse blakerouse added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Sep 25, 2025
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link
Contributor

mergify bot commented Sep 25, 2025

This pull request does not have a backport label. Could you fix it @blakerouse? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label that automatically backports to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@blakerouse blakerouse added the backport-active-all Automated backport with mergify to all the active branches label Sep 25, 2025
@blakerouse blakerouse changed the title Update run command to have a critical section to ensure errors are always logged Improve logging to catch early errors on startup Sep 25, 2025
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 40%)

See analysis details on SonarQube

@blakerouse
Copy link
Contributor Author

@ycombinator Thanks for the review. I implemented the requested fixes, if you can give this another review.

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @blakerouse

@blakerouse blakerouse merged commit 18beeba into elastic:main Oct 1, 2025
18 of 21 checks passed
@blakerouse blakerouse deleted the run-critical-log branch October 1, 2025 18:05
Copy link
Contributor

github-actions bot commented Oct 1, 2025

@Mergifyio backport 8.18 8.19 9.0 9.1 9.2

Copy link
Contributor

mergify bot commented Oct 1, 2025

backport 8.18 8.19 9.0 9.1 9.2

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Oct 1, 2025
* Update run command to have a critical section to ensure errors are always logged.

* Add changelog.

* Cleanup from code review.

(cherry picked from commit 18beeba)

# Conflicts:
#	internal/pkg/agent/cmd/run.go
mergify bot pushed a commit that referenced this pull request Oct 1, 2025
* Update run command to have a critical section to ensure errors are always logged.

* Add changelog.

* Cleanup from code review.

(cherry picked from commit 18beeba)

# Conflicts:
#	internal/pkg/agent/cmd/run.go
mergify bot pushed a commit that referenced this pull request Oct 1, 2025
* Update run command to have a critical section to ensure errors are always logged.

* Add changelog.

* Cleanup from code review.

(cherry picked from commit 18beeba)

# Conflicts:
#	internal/pkg/agent/cmd/run.go
mergify bot pushed a commit that referenced this pull request Oct 1, 2025
* Update run command to have a critical section to ensure errors are always logged.

* Add changelog.

* Cleanup from code review.

(cherry picked from commit 18beeba)

# Conflicts:
#	internal/pkg/agent/cmd/run.go
mergify bot pushed a commit that referenced this pull request Oct 1, 2025
* Update run command to have a critical section to ensure errors are always logged.

* Add changelog.

* Cleanup from code review.

(cherry picked from commit 18beeba)
blakerouse added a commit that referenced this pull request Oct 2, 2025
* Update run command to have a critical section to ensure errors are always logged.

* Add changelog.

* Cleanup from code review.

(cherry picked from commit 18beeba)

Co-authored-by: Blake Rouse <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-active-all Automated backport with mergify to all the active branches Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to recover from corrupted upgrades when the host system reboots
3 participants