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

Fix erroneously created http url directory path for monitoring #1811

Merged
merged 2 commits into from
Nov 29, 2022

Conversation

aleksmaus
Copy link
Member

@aleksmaus aleksmaus commented Nov 28, 2022

What does this PR do?

Fixes erroneously created http url directory path for monitoring when the agent runs.
Added a check if the url is passed in the path.

➜ sudo ls -la /Library/Elastic/Agent/http\:/localhost\:6791
total 0
drwxr-x---  2 root  wheel  64 Nov 28 11:12 .
drwxr-x---  3 root  wheel  96 Nov 28 11:12 ..

Why is it important?

No erroneous directories should be created during the agent execution.

Checklist

  • 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

How to test this PR locally

  1. Install the agent
  2. Make sure the agent create "http" directory, something like: /Library/Elastic/Agent/http\:/localhost\:6791

@aleksmaus aleksmaus added bug Something isn't working backport-v8.6.0 Automated backport with mergify labels Nov 28, 2022
@aleksmaus aleksmaus requested a review from a team as a code owner November 28, 2022 20:50
@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 28, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-11-29T02:38:56.917+0000

  • Duration: 18 min 49 sec

Test stats 🧪

Test Results
Failed 0
Passed 4613
Skipped 13
Total 4626

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages.

  • run integration tests : Run the Elastic Agent Integration tests.

  • run end-to-end tests : Generate the packages and run the E2E Tests.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@@ -75,7 +76,7 @@ func exposeMetricsEndpoint(
}

func createAgentMonitoringDrop(drop string) error {
if drop == "" || runtime.GOOS == "windows" {
if drop == "" || runtime.GOOS == "windows" || isHttpUrl(drop) {
Copy link
Member

Choose a reason for hiding this comment

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

This looks like it fixes it, but why is an HTTP URL even being passed here?

Copy link
Member Author

@aleksmaus aleksmaus Nov 28, 2022

Choose a reason for hiding this comment

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

@blakerouse do you know the history on this? seems like the monitoring changed from http to the local socket
between V1 and V2?

Copy link
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

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

Approving so we don't have a random http URL in our directory tree on installs, which looks a bit embarrassing. We can figure out where this is coming from separately.

@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 28, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 98.333% (59/60) 👍
Files 69.082% (143/207) 👍 0.483
Classes 69.133% (271/392) 👍 0.255
Methods 53.8% (814/1513) 👍 0.031
Lines 39.006% (8786/22525) 👎 -0.029
Conditionals 100.0% (0/0) 💚

@aleksmaus
Copy link
Member Author

/test

@aleksmaus aleksmaus merged commit 4ca690a into elastic:main Nov 29, 2022
@aleksmaus aleksmaus deleted the fix/http_url_path_directory branch November 29, 2022 13:11
mergify bot pushed a commit that referenced this pull request Nov 29, 2022
* Fix erroneously created http url directory path for monitoring

* Add changelog

(cherry picked from commit 4ca690a)
aleksmaus added a commit that referenced this pull request Nov 29, 2022
#1825)

* Fix erroneously created http url directory path for monitoring

* Add changelog

(cherry picked from commit 4ca690a)

Co-authored-by: Aleksandr Maus <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.6.0 Automated backport with mergify bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

V2: The monitoring URL is created as a directory during install
3 participants