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

Output Filtering #742

Closed
brampling opened this issue Sep 19, 2022 · 5 comments · Fixed by #808
Closed

Output Filtering #742

brampling opened this issue Sep 19, 2022 · 5 comments · Fixed by #808
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@brampling
Copy link
Contributor

brampling commented Sep 19, 2022

A user must be able to filter output from BotKube executor commands (e.g. kubectl) with simple string matching. This should be analogous to how users use grep when running kubectl from the command line. grep and grep-like syntax are not requirements.

AC

  • Command output can be filtered using simple string matching
  • Filtering is a CommandFlag and usable across any executor command
  • Only matching output lines are returned to the user
  • There is an indication that output is filtered
  • There is an indication when there is output but no filter matches
  • There is an indication when there is no output (i.e. no match/no output errors are differentiated)

Nice to have: more advanced filtering than simple string matching (e.g. RegEx, grep-style syntax, etc.). This should only be implemented if it comes from an existing package and we can do it with a clean UX.

Notes

  • Behavior - one of them:
    - Dedicated flag (@botkube kubectl logs <pod> --filter 'grep string and maybe params')
    • Piping @botkube kubectl logs <pod> | filter "str"
  • Support it globally - kubectl and other commands
  • Naming: filter - we won't support full grep functionality
  • No highlight on communication platforms
  • Collect anonymous analytics
  • Only grep for now / or instead of using binary, use some existing Go library
  • Include it in integration tests
  • Interactive option - out of scope -> will be done in a separate task
@brampling brampling added this to the v0.15.0 milestone Sep 19, 2022
@lpetkov lpetkov changed the title Executor Response Filtering Output Filtering Sep 29, 2022
@ezodude
Copy link
Contributor

ezodude commented Oct 17, 2022

The --filter is now under review, and the PR has been feature integrated with the interactive option.

Extra effort was required to ensure the text filter is resilient, works with edge cases and can be run from different contexts.

  • Dedicated flag (@botkube kubectl logs --filter 'some filter value')
  • Support it globally - kubectl and other commands
  • Collect anonymous analytics
  • Include it in integration tests

Follow up tickets

@lpetkov @brampling would appreciate your input.

Advanced filtering than simple string matching

This includes filters that use RegEx, grep-style syntax, etc... A bit of work is required to add this.

Also, these format can be triggered by supplying an extra flag. E.g. --re to signify that the supplied filter text should be handled differently.

Specifically,

  • Handling incorrect expressions supplied by users.
  • Updating both Interactive UI and regular kubectl with errors messages for incorrect expressions.
  • Reworking the executor filter algorithm to correctly remove the --filter flag before running downstream commands.
  • Guarding against errors from edge cases.

Further filtering

Currently, interactive filtering offers the ability to re-filter the original output.

Having run this a few times on Slack, the perceived expected behaviour was to further filter on the output from the original filter.

Supporting this will require some minor investigation.

@pkosiec
Copy link
Member

pkosiec commented Oct 18, 2022

Reopening until we have a last missing piece: documentation 🙂

@ezodude
Copy link
Contributor

ezodude commented Oct 18, 2022

Documentation now in review.

@ezodude
Copy link
Contributor

ezodude commented Oct 18, 2022

Documentation is complete.

@pkosiec pkosiec closed this as completed Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants