Skip to content

Comments

NIFI-5155: Add host address info to bulletins#2773

Closed
mattyb149 wants to merge 2 commits intoapache:mainfrom
mattyb149:NIFI-5155
Closed

NIFI-5155: Add host address info to bulletins#2773
mattyb149 wants to merge 2 commits intoapache:mainfrom
mattyb149:NIFI-5155

Conversation

@mattyb149
Copy link
Contributor

Thank you for submitting a contribution to Apache NiFi.

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 master)?

  • Is your initial contribution a single, squashed commit?

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?
  • 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 travis-ci for build issues and submit an update to your PR as soon as possible.

Copy link
Contributor

@zenfenan zenfenan left a comment

Choose a reason for hiding this comment

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

Hi.. When I started looking into this sometime back, I came across this: https://stackoverflow.com/questions/2381316/java-inetaddress-getlocalhost-returns-127-0-0-1-how-to-get-real-ip

In some cases (mostly a Debian thing), there are high possibilities of getting 127.0.0.1 eventhough there is an actual IP associated to the machine(s).

@mattyb149
Copy link
Contributor Author

@zenfenan Good point. The reporting tasks haven't had this information available before, is this a "no-harm-no-foul" thing, and if not, how should it be handled?

@zenfenan
Copy link
Contributor

zenfenan commented Jun 8, 2018

I'm not entirely sure if this poses an immediate threat, but in the future when other extensions try to use the getNodeAddress() API, it might possibly be an issue, especially on the user experience perspective i.e. chances of the user getting confused when all the bulletins print 127.0.0.1 are there, IMO.

For the workaround, this feels like a good approach: https://stackoverflow.com/a/28346117

@mcgilman
Copy link
Contributor

mcgilman commented Jun 8, 2018

I'm not exactly sure why the Bulletin itself has a nodeAddress field. However, I can offer that the corresponding BulletinDTO contains a nodeAddress to help differentiate between which node in the cluster is reporting the message. This is populated when the responses are merged at the cluster coordinator. In standalone mode, there is only a single instance so this field does not need to be populated. This is also how component validationErrors work.

@zenfenan
Copy link
Contributor

zenfenan commented Jun 9, 2018

@mcgilman Are you saying regardless of the setNodeAddress API not setting anything, the cluster coordinator takes care of populating it ?

@mcgilman
Copy link
Contributor

@zenfenan Correct. The cluster coordinator handles setting the node address for the bulletins that are returned through the REST API. However, those are not the same objects that are available in the SiteToSiteBulletinReportingTask. I wasn't considering this in my previous response.

@markap14
Copy link
Contributor

@mattyb149 I think this makes sense but have a couple of thoughts on the PR:

  • Probably should use the value set in NiFiProperties for the http/https hostname if it is populated. This would be more consistent with the value provided to the Cluster Coordinator and also is better for multi-homed environments.
  • If not available, I would do the InetAddress.getLocalHost().getHostAddress() address only once and stash away that value in a final member variable rather than performing the lookup for each Bulletin that is created.

@mattyb149
Copy link
Contributor Author

@markap14 How would we get at the value in NiFiProperties? They're not readily available from the FlowController (nor is the FlowController interface itself IIRC). Perhaps we call a static method on BulletinFactory?

Agreed about storing away getHostAddress(), that was a hasty copy-pasty :)

@mattyb149 mattyb149 changed the base branch from master to main November 30, 2020 03:17
@mattyb149 mattyb149 force-pushed the NIFI-5155 branch 2 times, most recently from 56c1cfc to 13c441a Compare November 30, 2020 03:21
@github-actions
Copy link

github-actions bot commented May 2, 2021

We're marking this PR as stale due to lack of updates in the past few months. If after another couple of weeks the stale label has not been removed this PR will be closed. This stale marker and eventual auto close does not indicate a judgement of the PR just lack of reviewer bandwidth and helps us keep the PR queue more manageable. If you would like this PR re-opened you can do so and a committer can remove the stale tag. Or you can open a new PR. Try to help review other PRs to increase PR review bandwidth which in turn helps yours.

@github-actions github-actions bot added the Stale label May 2, 2021
@github-actions github-actions bot closed this May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants