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

Update default pipeline when inputs are renamed or deleted #21541

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

patrickmann
Copy link
Contributor

@patrickmann patrickmann commented Feb 4, 2025

/nocl new feature
Resolves Graylog2/graylog-plugin-enterprise/issues/9591

See related issue for details

  • Auto-rename input routing rule when input name changes; also update the default pipeline reference to the rule.
  • Auto-delete routing rules when a corresponding input is deleted

We also change the pattern for generated rule names to include the human readable input title while retaining the input ID for uniqueness.

How Has This Been Tested?

Unit tests and local ad hoc testing:

  • create inputs with routing
  • rename inputs
  • delete inputs
  • use names that are substrings of other names
  • duplicate input names

@patrickmann patrickmann changed the title Auto-rename input routing rule when input name changes Update default pipeline when inputs are renamed or deleted Feb 5, 2025
@patrickmann patrickmann requested a review from AntonEbel February 6, 2025 15:14
@patrickmann patrickmann marked this pull request as ready for review February 6, 2025 15:14
Copy link
Contributor

@AntonEbel AntonEbel left a comment

Choose a reason for hiding this comment

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

A stream can also be renamed. Did you plan to implement the handling of stream renaming in another PR, or is it easier to implement it in this one?

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

class InputRoutingServiceTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding @ExtendWith(MockitoExtension.class) would detect unnecessary stubbing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I expected the compiler or Sonar linter to alert me, but they didn't.
Strangely, adding the ExtendWith statement did not result in unused stubs being flagged; neither did adding the STRICT_SUBS setting.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I didn't mean that there is currently unnecessary stubbing in the test class. I just wanted to point out that it is always good to have this annotation so that Mockito can recognize unnecessary stubbing.

@patrickmann
Copy link
Contributor Author

A stream can also be renamed. Did you plan to implement the handling of stream renaming in another PR, or is it easier to implement it in this one?

Confirmed with @tellistone that we are not auto-updating rules for stream rename/delete. Users will have to manually delete obsolete rules.

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.

2 participants