[management] Add device and owner fields to peer event meta

Merged
ML
14d ago
+39-1

Describe your changes

Integrations that react to peer activity events (device trust sync, firewall identity mapping) need the device serial, OS and owner to act on an event. Today the event meta only has name, FQDN, IPs and location, so every event costs a follow-up GET /api/peers and GET /api/users to resolve the device.

Peer.EventMeta now also adds serial_number, os, os_version and hostname, plus user_id when the peer has an owner (setup-key peers omit it). Every event built from Peer.EventMeta picks these up, including user.peer.login, peer removal and rename. The keys are additive and meta is already a free-form string map in the API, so the response schema does not change.

Issue ticket number and link

No issue yet.

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)
  • I ran and tested this change locally — I did not rely on CI to find out whether it works
  • This PR has a single purpose (not a fix + refactor + feature in one)
  • This change is a trivial fix, OR it links an issue the NetBird team agreed on beforehand. Changes to the public API, gRPC protocols, functionality behavior, CLI / service flags, or new features always need that agreement first. 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)

Additive keys in the existing free-form event meta map; no schema or behavior change to document.

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

  • New Features
    • Peer event metadata now includes the peer’s serial number, operating system, OS version, and hostname, alongside existing location and optional IPv6 details.
    • When a peer has an owner, its event metadata also includes the owner’s user ID.