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

Add Message Search Functionality #288

Merged
merged 16 commits into from Jul 19, 2023

Conversation

nathanscottdaniels
Copy link
Contributor

@nathanscottdaniels nathanscottdaniels commented Jun 18, 2021

Overhaul search functionality prototype first introduced by @plmarcelo in PR #175.
Improved performance by not reading the entire topic into memory and having a safety limit on the number of messages to read before the search aborts. Added a maximum results count. Added a date filter to allow user to specify which timestamp to start searching from. Added better output.

image
image

pedro lastra and others added 7 commits August 8, 2020 16:40
…eading the entire topic into memory and having a safetly limit on the number of messages to read befor the search aborts. Added a maximum results count. Added a date filter to allow user to specify which timestamp to start searching from. Added better output.
@nathanscottdaniels nathanscottdaniels changed the title Search Add Message Search Functionality Jun 18, 2021
@sreenivasvp
Copy link

@nathanscottdaniels
Can you please merge this feature, It really helps to quickly search.

@nathanscottdaniels
Copy link
Contributor Author

@nathanscottdaniels
Can you please merge this feature, It really helps to quickly search.

That's not how pull requests work. Only obsidian dynamics can merge it, at their discretion. If you want to use this feature, you can clone my fork and build it locally.

@markabrahams
Copy link

Hi Obsidian Dynamics - any thoughts on merging this PR? I'm looking for a Kafka tool that can do message searching within topics, and kafdrop with this PR looks ideal!

@davideicardi
Copy link
Collaborator

How search is implemented?
Given that Kafka doesn't have any native feature to search (as far as I know), my concern is that this feature can be abused and cause some trouble in the Kafka servers. What do you think?

Anyway for sure conflicts must be resolved before we can start evaluating it.

@nathanscottdaniels
Copy link
Contributor Author

How search is implemented? Given that Kafka doesn't have any native feature to search (as far as I know), my concern is that this feature can be abused and cause some trouble in the Kafka servers. What do you think?

Anyway for sure conflicts must be resolved before we can start evaluating it.

The code in this PR as well as its description answer all of your questions and concerns. But to summarize, searching is done within kafdrop by seeking to a point in time in the kafka topic and reading messages, filtering out those that don't match the search. I have put various safety measures in place to ensure the kafaka brokers are not abused, and this functionality is no more or less intensive the the brokers than a user of kafdrop flipping through pages of message previews.

@nathanscottdaniels
Copy link
Contributor Author

I do not have a working Java development environment anymore so another volunteer will need to resolve the merge conflicts, sorry.

@Bert-R
Copy link
Collaborator

Bert-R commented Apr 17, 2023

I will take care of that

@Bert-R
Copy link
Collaborator

Bert-R commented Apr 18, 2023

@nathanscottdaniels Can you allow me to push to the search branch in your fork?

@davideicardi
Copy link
Collaborator

@Bert-R I think you can just fork his branch and add more commits, then create another PR. This should maintain history and credits...

@nathanscottdaniels
Copy link
Contributor Author

@nathanscottdaniels Can you allow me to push to the search branch in your fork?

Just sent you an invite

} else if (scanStatus.scannedCount() >= SEARCH_MAX_MESSAGES_TO_SCAN) {
completionReason = CompletionReason.EXCEEDED_MAX_SCAN_COUNT;
} else {
// TODO: This situation cannot occur. There is no exit criterion on end of timespan
Copy link
Collaborator

Choose a reason for hiding this comment

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

@nathanscottdaniels See this TODO. At the moment, there is no way the search ends on reaching the end of the timespan. If it would, it would result in the below message to the user:

Search reached the end of the specified time span before finding requested number of results.  Scanned  %d messages.

How do you want to resolve this? Add the search criterion or drop the end state? The latter, I can do for you. For the former, I'd have to depend on you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I missed that. Can you just drop that end state? I appreciate your help.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Bert-R
Copy link
Collaborator

Bert-R commented Apr 19, 2023

@davideicardi It's compiling again and I've refactored it a bit for maintainability. One update is needed, based on a question I asked to Nathan. After that, I feel it's OK to merge this. The search behavior is just based on regular seeking and polling. I don't think it'll cause issues with the broker.

Copy link
Collaborator

@Bert-R Bert-R left a comment

Choose a reason for hiding this comment

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

Looks good now

@nathanscottdaniels Thanks for the contribution!
@davideicardi Do you want to take a look? Otherwise it can be merged.

@Bert-R Bert-R merged commit ed9d1cd into obsidiandynamics:master Jul 19, 2023
1 check passed
nerajchand pushed a commit to fairfaxmedia/charts that referenced this pull request May 3, 2024
This change will bump the version of the kafdrop image.

It includes numerous Dependency updates as well as bugfixes, and
security patching.

Also includes some shiny new features such as:

- Added Message Search functionality
[#288](obsidiandynamics/kafdrop#288)
- Enabled dependabot to update deps and base image tag
[#404](obsidiandynamics/kafdrop#404)

**Breaking Changes**:

- Update to JDK 17 and SpringBoot 3 in upstream
[#482](obsidiandynamics/kafdrop#482)

For the complete list of changes see:

[Releases](https://github.com/obsidiandynamics/kafdrop/releases)

[Comparing
Changes](obsidiandynamics/kafdrop@3.30.0...4.0.1)
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.

None yet

5 participants