Skip to content

NIFI-9183: Add a command-line option to save status history#5356

Closed
Lehel44 wants to merge 11 commits intoapache:mainfrom
Lehel44:NIFI-9183
Closed

NIFI-9183: Add a command-line option to save status history#5356
Lehel44 wants to merge 11 commits intoapache:mainfrom
Lehel44:NIFI-9183

Conversation

@Lehel44
Copy link
Contributor

@Lehel44 Lehel44 commented Aug 30, 2021

Thank you for submitting a contribution to Apache NiFi.

Please provide a short description of the PR here:

Description of PR

Added command-line option to save status history in JSON.

Details

When you run nifi.sh with a command line option, the RunNiFi class parses the options, creates a NiFi server instance, and sends a request to the BootstrapListener on the server. Objects from nifi-core can be injected by spring web context. Since only a single NiFiServer instance can be accessed in BootstrapListener, I extended it with a new method that returns the status history.

  • Outsourced StatusHistoryRepository creation to a factory bean from FlowController in order to use it in nifi-runtime.
  • The NiFiServer interface has been extended with the String getNodeStatusHistoryJson(final int days); method. (Returns a string in order to avoid additional dependencies in nifi-bootstrap. Dependencies in nifi-runtime affect nifi-bootstrap as well, and they must be added to assembly/common.xml filters.)
  • Extended RunNiFi and nifi.sh with the new status-history option.
  • The StatusHistoryRepository gets injected into JettyServer which can be accessed by NiFiBootstrap.

Still under consideration or work in progress:

  • NiFiServer: default vs not default method?
  • Extend admin guide

https://issues.apache.org/jira/browse/NIFI-9183

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically main)?

  • Is your initial contribution a single, squashed commit? Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not squash or use --force when pushing to allow for clean monitoring of changes.

For code changes:

  • Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
  • Have you written or updated unit tests to verify your changes?
  • Have you verified that the full build is successful on JDK 8?
  • Have you verified that the full build is successful on JDK 11?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
  • If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
  • If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.

Copy link
Contributor

@simonbence simonbence left a comment

Choose a reason for hiding this comment

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

Thanks for the change, especially for extracting the status repository creation! I went through your PR and I found a couple of things I think might be improved. If you have questions I would be more than happy to discuss the given topics.

Copy link
Contributor

@simonbence simonbence left a comment

Choose a reason for hiding this comment

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

I had some remarks, please take a look. Also please fix the broken checks.

Copy link
Contributor

@simonbence simonbence left a comment

Choose a reason for hiding this comment

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

I made some comments, you might be interested about. Other than that, I kindly ask you to take a look on my previous remarks about HeadlessNiFiServer.

Copy link
Contributor

@simonbence simonbence left a comment

Choose a reason for hiding this comment

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

LGTM

@tpalfy
Copy link
Contributor

tpalfy commented Oct 12, 2021

LGTM+1
Merged to main.

@turcsanyip
Copy link
Contributor

Closing the PR because it was not closed with the merge commit.

@turcsanyip turcsanyip closed this Oct 12, 2021
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.

5 participants