[PR #5164] [MERGED] [client] Fix/health result in bundle #25112

Closed
opened 2026-08-05 06:09:33 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5164
Author: @pappz
Created: 1/23/2026
Status: Merged
Merged: 1/23/2026
Merged by: @pappz

Base: mainHead: fix/health-result-in-bundle


📝 Commits (3)

  • b8997ac Add support for optional status refresh callback during debug bundle generation
  • 1f22328 Always update wg status
  • 810aa41 Remove duplicated wg status call

📊 Changes

5 files changed (+62 additions, -18 deletions)

View changed files

📝 client/internal/debug/debug.go (+7 -0)
📝 client/internal/engine.go (+6 -18)
📝 client/internal/peer/status.go (+32 -0)
📝 client/server/debug.go (+13 -0)
📝 client/server/server.go (+4 -0)

📄 Description

Describe your changes

Refresh WireGuard statistics in status queries and debug bundles

WireGuard handshake times and transfer statistics were stale in status
output and debug bundles, relying on cached values updated only during
periodic health probes (every 5+ seconds).

Changes:

  • Add RefreshWireGuardStats() method to status recorder for fast
    WireGuard stats refresh (~1ms)
  • Always refresh WireGuard stats on every status query, independent
    of health probe throttling
  • Update RunHealthProbes() to include WireGuard stats refresh
  • Add callback mechanism to refresh full status (including health probes)
    before debug bundle generation

Result: Status output and debug bundles now contain accurate, real-time
WireGuard handshake times and transfer statistics.

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)

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/__

Summary by CodeRabbit

  • Improvements
    • Health probes now refresh WireGuard statistics for more accurate, up-to-date status reporting.
    • Debug bundles capture current health status at generation time, improving diagnostic accuracy.
    • Background status refreshes are invoked when running probes to keep peer stats current.

✏️ Tip: You can customize this high-level summary in your review settings.


🔄 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/5164 **Author:** [@pappz](https://github.com/pappz) **Created:** 1/23/2026 **Status:** ✅ Merged **Merged:** 1/23/2026 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `main` ← **Head:** `fix/health-result-in-bundle` --- ### 📝 Commits (3) - [`b8997ac`](https://github.com/netbirdio/netbird/commit/b8997ac73d1792d872c3cfe8316fa6ab4cd94a8c) Add support for optional status refresh callback during debug bundle generation - [`1f22328`](https://github.com/netbirdio/netbird/commit/1f223285794d76472224eecc4902873d688d44ec) Always update wg status - [`810aa41`](https://github.com/netbirdio/netbird/commit/810aa41fc64d5bd6453ff20ede76bc3f3fc1fdb4) Remove duplicated wg status call ### 📊 Changes **5 files changed** (+62 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/debug/debug.go` (+7 -0) 📝 `client/internal/engine.go` (+6 -18) 📝 `client/internal/peer/status.go` (+32 -0) 📝 `client/server/debug.go` (+13 -0) 📝 `client/server/server.go` (+4 -0) </details> ### 📄 Description ## Describe your changes Refresh WireGuard statistics in status queries and debug bundles WireGuard handshake times and transfer statistics were stale in status output and debug bundles, relying on cached values updated only during periodic health probes (every 5+ seconds). Changes: - Add RefreshWireGuardStats() method to status recorder for fast WireGuard stats refresh (~1ms) - Always refresh WireGuard stats on every status query, independent of health probe throttling - Update RunHealthProbes() to include WireGuard stats refresh - Add callback mechanism to refresh full status (including health probes) before debug bundle generation Result: Status output and debug bundles now contain accurate, real-time WireGuard handshake times and transfer statistics. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [x] 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) > 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: - [ ] I added/updated documentation for this change - [x] 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/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Health probes now refresh WireGuard statistics for more accurate, up-to-date status reporting. * Debug bundles capture current health status at generation time, improving diagnostic accuracy. * Background status refreshes are invoked when running probes to keep peer stats current. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- 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 06:09:33 -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#25112