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

x-pack/filebeat/input/websocket: refactor input for generalisation #40308

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented Jul 23, 2024

Proposed commit message

This extracts the common logic between streaming inputs into a new interface type to allow addition of new streaming inputs.


No behaviour change.

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
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@efd6 efd6 added enhancement Filebeat Filebeat backport-skip Skip notification from the automated backport with mergify Team:Security-Service Integrations Security Service Integrations Team labels Jul 23, 2024
@efd6 efd6 self-assigned this Jul 23, 2024
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jul 23, 2024
@efd6 efd6 force-pushed the 40264-websocket_refactor branch from 5d44c53 to ed71a8b Compare July 23, 2024 00:20
@efd6 efd6 marked this pull request as ready for review July 23, 2024 02:01
@efd6 efd6 requested a review from a team as a code owner July 23, 2024 02:01
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

This extracts the common logic between streaming inputs into a new
interface type to allow addition of new streaming inputs.
@efd6 efd6 force-pushed the 40264-websocket_refactor branch from ed71a8b to 7deec48 Compare July 25, 2024 00:22
return s.time()
}

func (s *websocketStream) Close() error {
Copy link
Contributor

@ShourieG ShourieG Aug 1, 2024

Choose a reason for hiding this comment

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

Should the websocket stream contain a handler to the ws connection and (s *websocketStream) Close() function should also take care of gracefully closing the ws connection if present ? ISTM that this would make make the design more consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless I'm missing something, that would be a change in functionality. This is a pure refactor with no change in behaviour. If this is something that should be done (rather than something I've missed) then it should happen in another PR. I'm not convinced that doing this would make things simpler; in order to do this we would need the websocketStream to hold on to the ws conn so that it can close it while at the moment it just naturally happens due to the c.Close() call in the follow method.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, I was just speaking from a design perspective here, not that this would make it simpler, just more consistent in this new structure. I agree that if we consider to do this it should be a separate PR and not this one so approving this.

Copy link
Contributor

@ShourieG ShourieG left a comment

Choose a reason for hiding this comment

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

LGTM

@efd6 efd6 merged commit 4a40fa0 into elastic:main Aug 2, 2024
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify enhancement Filebeat Filebeat Team:Security-Service Integrations Security Service Integrations Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants