[PR #6394] [CLOSED] [client] introduce client-side event aggregation #29483

Open
opened 2026-08-05 08:08:09 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6394
Author: @dmitri-netbird
Created: 6/10/2026
Status: Closed

Base: mainHead: dmitri-event-aggregation


📝 Commits (10+)

  • 60bcf7d added an implementation of aggregating memory store
  • 243e934 initial support for aggregation of events
  • b654a75 added tcp-aggregation test
  • 101ae3c added manager integration test
  • 8f99362 added tracking of the number of start-, drop, and end-events in an aggregation window
  • 42e0007 fixes based on sonarcube checks
  • 12a8943 regenerated proto files
  • a593e32 removed inadvertenly added google proto files
  • d9d585e pacifying linter
  • 598558c Merge remote-tracking branch 'origin/main' into dmitri-event-aggregation

📊 Changes

11 files changed (+1072 additions, -148 deletions)

View changed files

📝 client/internal/netflow/logger/logger.go (+6 -2)
📝 client/internal/netflow/manager.go (+82 -25)
client/internal/netflow/manager_integration_test.go (+291 -0)
client/internal/netflow/store/event_aggregation_test.go (+362 -0)
📝 client/internal/netflow/store/memory.go (+105 -1)
📝 client/internal/netflow/types/types.go (+27 -6)
📝 flow/proto/flow.pb.go (+110 -55)
📝 flow/proto/flow.proto (+6 -0)
📝 flow/proto/flow_grpc.pb.go (+38 -56)
📝 shared/management/http/api/openapi.yml (+27 -0)
📝 shared/management/http/api/types.gen.go (+18 -3)

📄 Description

Describe your changes

To reduce the frequency at which flow events are emitted, a client-aggregation of flow events is implemented in this PR.

Events are aggregated over a time window by destination address, destination port, protocol, and icmp code (for icmp). Total number of start-, end-, and drop-events is tracked, as well as the number of transmitted and received bytes and packets.

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • This change does not modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — OR I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See CONTRIBUTING.md.

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/800

Summary by CodeRabbit

  • New Features
    • Network flow events now include an aggregation window with start/end timestamps.
    • Events now report per-flow counters for starts, ends, and drops.
    • Flow event delivery is more reliable: events are aggregated and unacknowledged events are retried automatically until ACKed.
  • Documentation
    • Updated API schema and generated models to include the new aggregation window fields and start/end/drop counters.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/6394 **Author:** [@dmitri-netbird](https://github.com/dmitri-netbird) **Created:** 6/10/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `dmitri-event-aggregation` --- ### 📝 Commits (10+) - [`60bcf7d`](https://github.com/netbirdio/netbird/commit/60bcf7dfc35ec498175b2913185032cb015eb1a4) added an implementation of aggregating memory store - [`243e934`](https://github.com/netbirdio/netbird/commit/243e93477f7c6481e175a06553d006264d7d0270) initial support for aggregation of events - [`b654a75`](https://github.com/netbirdio/netbird/commit/b654a75a4323182490395cfbef6851d82ab98559) added tcp-aggregation test - [`101ae3c`](https://github.com/netbirdio/netbird/commit/101ae3ca770b91770c716bfefa294b292ad4b22a) added manager integration test - [`8f99362`](https://github.com/netbirdio/netbird/commit/8f99362a25a2a260fea72b022f7cd56b0d1bd28c) added tracking of the number of start-, drop, and end-events in an aggregation window - [`42e0007`](https://github.com/netbirdio/netbird/commit/42e0007f4a3cf785cf43a8ce2d7981d7176ae297) fixes based on sonarcube checks - [`12a8943`](https://github.com/netbirdio/netbird/commit/12a8943b992c94865b971f6ef1b683bed8f78f7e) regenerated proto files - [`a593e32`](https://github.com/netbirdio/netbird/commit/a593e32a1ddcb481b85cccbb1a986d6789bd4e41) removed inadvertenly added google proto files - [`d9d585e`](https://github.com/netbirdio/netbird/commit/d9d585e1d436b1500faff8f8b3658a3a13b09401) pacifying linter - [`598558c`](https://github.com/netbirdio/netbird/commit/598558c77eaa38a04364934746b8f10caaf6c647) Merge remote-tracking branch 'origin/main' into dmitri-event-aggregation ### 📊 Changes **11 files changed** (+1072 additions, -148 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/netflow/logger/logger.go` (+6 -2) 📝 `client/internal/netflow/manager.go` (+82 -25) ➕ `client/internal/netflow/manager_integration_test.go` (+291 -0) ➕ `client/internal/netflow/store/event_aggregation_test.go` (+362 -0) 📝 `client/internal/netflow/store/memory.go` (+105 -1) 📝 `client/internal/netflow/types/types.go` (+27 -6) 📝 `flow/proto/flow.pb.go` (+110 -55) 📝 `flow/proto/flow.proto` (+6 -0) 📝 `flow/proto/flow_grpc.pb.go` (+38 -56) 📝 `shared/management/http/api/openapi.yml` (+27 -0) 📝 `shared/management/http/api/types.gen.go` (+18 -3) </details> ### 📄 Description ## Describe your changes To reduce the frequency at which flow events are emitted, a client-aggregation of flow events is implemented in this PR. Events are aggregated over a time window by destination address, destination port, protocol, and icmp code (for icmp). Total number of start-, end-, and drop-events is tracked, as well as the number of transmitted and received bytes and packets. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] This change does **not** modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — **OR** I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See [CONTRIBUTING.md](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#discuss-changes-with-the-netbird-team-first). > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [x] I added/updated documentation for this change - [ ] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/800 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Network flow events now include an aggregation window with start/end timestamps. * Events now report per-flow counters for starts, ends, and drops. * Flow event delivery is more reliable: events are aggregated and unacknowledged events are retried automatically until ACKed. * **Documentation** * Updated API schema and generated models to include the new aggregation window fields and start/end/drop counters. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 08:08:09 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#29483