Skip to content

Conversation

mashhurs
Copy link
Contributor

@mashhurs mashhurs commented Aug 14, 2025

Release notes

[rn:skip]

What does this PR do?

  • Improves the situation where LS may continuously reloading the pipeline but /_health_report isn't reachable;
  • prints logs (in Util#run_or_raise_error) regardless of the LS status for better visibility

Why is it important/What is the impact to the user?

N.A

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
  • [ ] I have made corresponding change to the default configuration files (and/or docker env variables)
  • [ ] I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@github-actions
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

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

@mergify
Copy link
Contributor

mergify bot commented Aug 14, 2025

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

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.
  • If no backport is necessary, please add the backport-skip label

@mashhurs mashhurs added the backport-skip Skip automated backport with mergify label Aug 14, 2025
@mashhurs mashhurs changed the title Print Logstash logs when pipeline faces an issue. [health-report CI] Print Logstash logs when pipeline faces an issue. Aug 14, 2025
# it is helpful when testing crash pipeline cases
config_path = os.getcwd() + "/.buildkite/scripts/health-report-tests/config"
process = subprocess.Popen(["bin/logstash", "--config.reload.automatic", "--path.settings", config_path,
"-w 1"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, shell=False)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

review note: in pipeline.yaml config files (e.g here), we set worker count, this is not necessary.

Copy link
Member

Choose a reason for hiding this comment

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

Confirmed, this flag is not necessary and arguably was not appropriate for a generalized run_logstash method anyway. I like removal 👍

full_error_message = (error_message + ", output: " + result.stdout) \
if result.stdout else error_message
raise Exception(f"{full_error_message}")
print(result.stdout)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

review note: regardless of failure status, prints log for better visibility.

Copy link
Member

Choose a reason for hiding this comment

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

Nice. Looks like the majority of the logging that is beneficial will happen at https://github.com/elastic/logstash/pull/17991/files/acc787b0aeac14acc37704857dccddd75661990f#diff-cabfb7b7a18cf3ea856fc69cec74a74345761db2625d41b10ceb7ec13c447252R85 but this is good too i think.

@elastic-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

@donoghuc
Copy link
Member

donoghuc commented Aug 15, 2025

Love the extra logging. That makes this much easier to reason through! I think this is pointing to #17992. I believe the "-w 1" you mention here #17991 (comment) is actually what exposed this. I think for consistency in previous behavior with the ruby impl we will want to strip whitespace at parse time.

return release_version

def install_plugin(self, plugin_path: str) -> None:
print("Installing logstash-integration-failure_injector plugin")
Copy link
Member

Choose a reason for hiding this comment

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

Is this a generalized method? Does this print statement belong here specific to one plugin?

Copy link
Contributor Author

@mashhurs mashhurs Aug 15, 2025

Choose a reason for hiding this comment

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

specific to one plugin?

Yup! The logstash-integration-failure_injector isn't embedded in the core by default and we install while health-report integration tests to simulate various scenarios (failure, backpressure, etc...). This log statement is very useful because a) plugin-manager (logstash-plugin {operation}) silently processes its operations. If any failure we get while installing the plugin w/o this log statement that b) might be confusing if it came from LS build.

Copy link
Member

@donoghuc donoghuc left a comment

Choose a reason for hiding this comment

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

These improvements make it much easier to reason about failures in this pipeline 🎉

Just one question about a message #17991 (comment)

@mashhurs mashhurs merged commit 74c7ec2 into elastic:main Aug 15, 2025
12 checks passed
@mashhurs mashhurs deleted the health-test-pipeline-print-ls-logs branch August 15, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-skip Skip automated backport with mergify

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants