[PR #2144] Context creation and logging in management #18768

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

Original Pull Request: https://github.com/netbirdio/netbird/pull/2144

State: closed
Merged: Yes


Describe your changes

This PR creates 3 root contexts. It adds a logSource parameter to each context:

  • GRPC: For all requests coming via grpc api. For this case, the context will be extended with a requestID, the deviceID of the peer, and the accountID the peer belongs to
  • HTTP: For all requests coming from REST api. For this case, the context will be extended with a requestID, the userID of the user querying the api, and the accountID the user is accessing (needs updating once we implement multitenancy).
  • SYSTEM: which logs general system logs that occur during management operation e.g. startup, expiration trigger...

The PR updates the logger with a custom implementation that logs the additional fields.

Caution

This PR will cause both management and client logger to lose their formatting. The formatting will be created in a separate PR before merging the feature branch.

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)
  • Extended the README / documentation, if necessary
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/2144 **State:** closed **Merged:** Yes --- ## Describe your changes This PR creates 3 root contexts. It adds a logSource parameter to each context: - GRPC: For all requests coming via grpc api. For this case, the context will be extended with a requestID, the deviceID of the peer, and the accountID the peer belongs to - HTTP: For all requests coming from REST api. For this case, the context will be extended with a requestID, the userID of the user querying the api, and the accountID the user is accessing (needs updating once we implement multitenancy). - SYSTEM: which logs general system logs that occur during management operation e.g. startup, expiration trigger... The PR updates the logger with a custom implementation that logs the additional fields. > [!CAUTION] > This PR will cause both management and client logger to lose their formatting. The formatting will be created in a separate PR before merging the feature branch. ## Issue ticket number and link ### 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) - [ ] Extended the README / documentation, if necessary
saavagebueno added the pull-request label 2026-08-05 04:08:54 -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#18768