Skip to content

Streams: Add Filter Rules count column#25035

Open
gally47 wants to merge 6 commits intomasterfrom
streams-filter-rules-col
Open

Streams: Add Filter Rules count column#25035
gally47 wants to merge 6 commits intomasterfrom
streams-filter-rules-col

Conversation

@gally47
Copy link
Contributor

@gally47 gally47 commented Feb 17, 2026

Motivation and Context

fixes https://github.com/Graylog2/graylog-plugin-enterprise/issues/13217
/nocl

Screenshots (if appropriate):

Screenshot 2026-02-19 at 12 38 41

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have requested a documentation update.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a “Filter Rules” count column to the Streams Overview, including an expandable section to view configured destination filter rules per stream. This supports the enterprise issue requesting visibility into destination filter rule usage directly from the streams list.

Changes:

  • Web UI: adds destination_filters column (count badge) and an expanded “Filter Rules” section + actions.
  • Web UI: introduces a batched React Query hook to fetch filter rule counts across streams.
  • Server: adds an API endpoint and service method to compute per-stream destination filter rule counts (plus tests).

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
graylog2-web-interface/src/routing/ApiRoutes.ts Adds route for destination filter rule counts endpoint.
graylog2-web-interface/src/components/streams/hooks/useStreamOutputFilters.ts Allows fetching filters without a destination type (for “all destinations” view).
graylog2-web-interface/src/components/streams/hooks/useStreamDestinationFilterRuleCount.ts New batched hook to fetch per-stream filter rule counts.
graylog2-web-interface/src/components/streams/hooks/useStreamDestinationFilterRuleCount.test.ts Verifies batching behavior for the new count hook.
graylog2-web-interface/src/components/streams/StreamsOverview/hooks/useTableComponents.tsx Registers new expanded section and actions for destination filter rules.
graylog2-web-interface/src/components/streams/StreamsOverview/cells/DestinationFilterRulesCell.tsx New table cell rendering the filter rule count badge + expand toggle.
graylog2-web-interface/src/components/streams/StreamsOverview/StreamsOverview.test.tsx Extends StreamsOverview tests to cover the new filter rules expand/collapse behavior.
graylog2-web-interface/src/components/streams/StreamsOverview/ExpandedDestinationFilterRulesSection.tsx New expanded section listing destination filter rules with pagination.
graylog2-web-interface/src/components/streams/StreamsOverview/ExpandedDestinationFilterRulesActions.tsx Adds “Manage Filter Rules” link action for the expanded section.
graylog2-web-interface/src/components/streams/StreamsOverview/Constants.ts Adds destination_filters attribute and updates column titles/order defaults.
graylog2-web-interface/src/components/streams/StreamsOverview/ColumnRenderers.tsx Wires new column renderer for destination_filters.
graylog2-server/src/test/java/org/graylog2/streams/filters/StreamDestinationFilterServiceTest.java Adds unit test for counting filter rules by stream IDs.
graylog2-server/src/main/java/org/graylog2/streams/filters/StreamDestinationFilterService.java Adds countByStreamIds implementation.
graylog2-server/src/main/java/org/graylog2/rest/resources/streams/StreamResource.java Adds /streams/destinations/filters/count endpoint for counts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 144 to 149
final Map<String, Long> countsByStreamId = new HashMap<>();
collection.find(in(FIELD_STREAM_ID, streamIds)).forEach(dto -> {
if (permissionSelector.test(dto.id())) {
countsByStreamId.merge(dto.streamId(), 1L, Long::sum);
}
});
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

countByStreamIds iterates collection.find(...) and deserializes full StreamDestinationFilterRuleDTO objects (including the potentially large rule payload) just to count items. This can become unnecessarily expensive on the Streams Overview when many streams/rules are present. Consider using a projection / lightweight result class (e.g., only _id + stream_id) for this query, or an aggregation that returns only the fields required for counting, to reduce DB transfer and decoding overhead.

Copilot uses AI. Check for mistakes.
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.

1 participant

Comments