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

Remove queue.Consumer #31502

Merged
merged 18 commits into from
May 12, 2022
Merged

Remove queue.Consumer #31502

merged 18 commits into from
May 12, 2022

Conversation

faec
Copy link
Contributor

@faec faec commented May 3, 2022

What does this PR do?

Removes the queue.Consumer interface, and replaces its Get call with one directly on the queue interface itself.

Why is it important?

The current Beats queue interface defines a notion of a "consumer" targeting a queue, and which is the exclusive object through which the queue can be read. There can be an arbitrary number of consumers operating in parallel, which can be closed independently of the queue and of each other.

Supporting the queue consumer interface and its current implementations is an obstacle to many planned changes, particularly elastic/elastic-agent-shipper#27 where we are trying to propagate consistent ordered event IDs through all queue types.

While we could use more complicated workarounds to support this regardless, there are good reasons to instead remove the concept of a queue consumer entirely:

  • Unlike queue.Producer, the consumer has no special configuration of its own that affects its behavior, which means it's questionable whether there's any advantage to creating multiple consumers (as opposed to calling directly into the queue from multiple goroutines).
  • Outside of the queue tests there is only one line in the entire Beats codebase that creates a queue consumer, and it never creates more than one.
  • Removing the extra layer of indirection prepares the way for simpler unified handling of events and event batches between the traditional Beats pipeline and the in-progress Shipper prototype.

This PR should functionally be a no-op; the only functional change is that certain places that used to pass a queue consumer now pass the queue itself instead.

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.

@faec faec added cleanup Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels May 3, 2022
@faec faec requested a review from a team as a code owner May 3, 2022 18:12
@faec faec requested review from cmacknz and fearful-symmetry and removed request for a team May 3, 2022 18:12
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@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 May 3, 2022
@mergify mergify bot assigned faec May 3, 2022
Copy link
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

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

LGTM, code seems clearer after this as well.

@elasticmachine
Copy link
Collaborator

elasticmachine commented May 3, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-05-12T14:39:10.802+0000

  • Duration: 71 min 11 sec

Test stats 🧪

Test Results
Failed 0
Passed 22556
Skipped 1938
Total 24494

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

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

Copy link
Contributor

@fearful-symmetry fearful-symmetry left a comment

Choose a reason for hiding this comment

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

Yay, looks good to me, with what queue knowledge I have.

@mergify
Copy link
Contributor

mergify bot commented May 10, 2022

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b queue-consumer upstream/queue-consumer
git merge upstream/main
git push upstream queue-consumer

@faec faec merged commit 416f70b into elastic:main May 12, 2022
@faec faec deleted the queue-consumer branch May 12, 2022 15:52
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants