[PR #2145] [MERGED] Propagate context through all methods in management #14725

Open
opened 2026-08-05 03:06:12 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/2145
Author: @pascal-fischer
Created: 6/18/2024
Status: Merged
Merged: 6/27/2024
Merged by: @pascal-fischer

Base: feature/add-context-throughout-managementHead: develop/propagate-context


📝 Commits (10+)

📊 Changes

121 files changed (+2705 additions, -2592 deletions)

View changed files

📝 client/cmd/testutil_test.go (+3 -3)
📝 client/internal/engine_test.go (+4 -4)
📝 client/server/server_test.go (+3 -3)
📝 go.mod (+1 -2)
📝 go.sum (+2 -5)
📝 management/client/client_test.go (+3 -3)
📝 management/cmd/management.go (+59 -54)
📝 management/cmd/migration_up.go (+10 -4)
📝 management/server/account.go (+263 -260)
📝 management/server/account_test.go (+95 -94)
📝 management/server/activity/sqlite/sqlite.go (+12 -11)
📝 management/server/activity/sqlite/sqlite_test.go (+6 -5)
📝 management/server/activity/store.go (+10 -7)
📝 management/server/dns.go (+17 -16)
📝 management/server/dns_test.go (+20 -19)
📝 management/server/ephemeral.go (+23 -16)
📝 management/server/ephemeral_test.go (+14 -13)
📝 management/server/event.go (+8 -7)
📝 management/server/event_test.go (+8 -7)
📝 management/server/file_store.go (+48 -47)

...and 80 more files

📄 Description

Describe your changes

This PR extends all occurrences of logrus in our management with log.WithContext(ctx) so that the logger will log the newly added context variables into the log messages. It then propagates the context through all method headers and method calls up to the root context.

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 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/2145 **Author:** [@pascal-fischer](https://github.com/pascal-fischer) **Created:** 6/18/2024 **Status:** ✅ Merged **Merged:** 6/27/2024 **Merged by:** [@pascal-fischer](https://github.com/pascal-fischer) **Base:** `feature/add-context-throughout-management` ← **Head:** `develop/propagate-context` --- ### 📝 Commits (10+) - [`7738f63`](https://github.com/netbirdio/netbird/commit/7738f63929c48d588880f72ab342d12e81acfeb3) add context creation and logging - [`c282ea6`](https://github.com/netbirdio/netbird/commit/c282ea64ab2ec8ad678325836a2ba6c342a37391) fix test - [`10d095e`](https://github.com/netbirdio/netbird/commit/10d095ee4b4a02498f0edfa403c0e5b879ae8d2a) add context to logs - [`29ed565`](https://github.com/netbirdio/netbird/commit/29ed565ec8854e416ee5fd44d1aed7976351755d) revert everything except management - [`ba1d2bd`](https://github.com/netbirdio/netbird/commit/ba1d2bd318444e4a5a76257b8e17e7c30aa6a35c) propagate context to all methods - [`2b3e293`](https://github.com/netbirdio/netbird/commit/2b3e29316cf2df07f03e3003a7e09ba027bb8089) remove ctx from client files in management - [`5d07118`](https://github.com/netbirdio/netbird/commit/5d07118ce3bc19dff2f936d822590c841866c060) revert client changes - [`8abe453`](https://github.com/netbirdio/netbird/commit/8abe45394d1a6d37263253fc9b72f5331203d235) remove comment - [`d978b2f`](https://github.com/netbirdio/netbird/commit/d978b2fe2d511858d45708310e983fa1fd6cbc33) add linter exceptions - [`94e5eb4`](https://github.com/netbirdio/netbird/commit/94e5eb4d864c6d1de6921e781222b7486184d61d) set proper accountID to grpc calls ### 📊 Changes **121 files changed** (+2705 additions, -2592 deletions) <details> <summary>View changed files</summary> 📝 `client/cmd/testutil_test.go` (+3 -3) 📝 `client/internal/engine_test.go` (+4 -4) 📝 `client/server/server_test.go` (+3 -3) 📝 `go.mod` (+1 -2) 📝 `go.sum` (+2 -5) 📝 `management/client/client_test.go` (+3 -3) 📝 `management/cmd/management.go` (+59 -54) 📝 `management/cmd/migration_up.go` (+10 -4) 📝 `management/server/account.go` (+263 -260) 📝 `management/server/account_test.go` (+95 -94) 📝 `management/server/activity/sqlite/sqlite.go` (+12 -11) 📝 `management/server/activity/sqlite/sqlite_test.go` (+6 -5) 📝 `management/server/activity/store.go` (+10 -7) 📝 `management/server/dns.go` (+17 -16) 📝 `management/server/dns_test.go` (+20 -19) 📝 `management/server/ephemeral.go` (+23 -16) 📝 `management/server/ephemeral_test.go` (+14 -13) 📝 `management/server/event.go` (+8 -7) 📝 `management/server/event_test.go` (+8 -7) 📝 `management/server/file_store.go` (+48 -47) _...and 80 more files_ </details> ### 📄 Description ## Describe your changes This PR extends all occurrences of logrus in our management with `log.WithContext(ctx)` so that the logger will log the newly added context variables into the log messages. It then propagates the context through all method headers and method calls up to the root context. ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [x] It is a refactor - [ ] tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <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 03:06:12 -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#14725