graylog2-server icon indicating copy to clipboard operation
graylog2-server copied to clipboard

Util to simplify execution of basic pivot search

Open patrickmann opened this issue 1 year ago • 1 comments

What?

Create a utility service that simplifies execution of basic pivot searches in the backend. It would accept the variable parts of the search (query, pivot field name) and handle the details of building the search, extracting the values from the result rows, and handling errors.

Why?

  • When coding a search for the first time, it is difficult to know which classes to use and how
  • There are multiple instances of these searches in the code base. They are very similar to each other: EventDefinitionAggregator InputDiagnosticService EventAssetRiskAggregator

Your Environment

  • Graylog Version: 6.2

patrickmann avatar Nov 15 '24 08:11 patrickmann

Hi, I'd like to take this issue as my first contribution. Let me know if it's available. Thanks!

bhuvnsh avatar Jun 12 '25 08:06 bhuvnsh

took on the job

prokhin avatar Aug 04 '25 07:08 prokhin

✅ Implemented PivotSearchService to encapsulate basic pivot search logic. ✅ Refactored InputDiagnosticService to use this new service. ✅ Added unit tests to verify both the new service and refactored logic.

This should simplify pivot-based queries and promote reuse across components like EventDefinitionAggregator and EventAssetRiskAggregator.

prokhin avatar Aug 07 '25 13:08 prokhin

@patrickmann How about it?

prokhin avatar Aug 14 '25 10:08 prokhin

@prokhin Thanks for the submission. I will try and get around to reviewing it as soon as possible.

patrickmann avatar Aug 14 '25 13:08 patrickmann

@prokhin

  • new classes are missing the license header comment. Please add that - just copy from some other class.
  • can you also refactor the other classes (EventDefinitionAggregator, EventAssetRiskAggregator) to use your new service?

patrickmann avatar Aug 14 '25 13:08 patrickmann

Thank you for your valuable feedback. I've taken it into work. @patrickmann I can't find these classes(EventDefinitionAggregator, EventAssetRiskAggregator). Can I know the exact name and path?

prokhin avatar Aug 15 '25 09:08 prokhin