feat: add device traffic metrics with gateway telemetry reporting and admin UI display
Add rx_bytes and tx_bytes fields to Device type and API responses. Add formatDataSize helper for human-readable byte formatting with units from B to TB. Add Received and Sent columns to devices table in admin UI with formatted traffic totals. Add traffic metrics display to device action panel. Add TelemetrySnapshot and PeerTelemetry types for gateway runtime stats. Add gateway telemetry endpoint at POST /gateway
This commit is contained in:
@@ -40,6 +40,14 @@ func (s *Service) Update(ctx context.Context, gatewayID string, input UpdateRequ
|
||||
return s.repo.Update(ctx, id, input)
|
||||
}
|
||||
|
||||
func (s *Service) StoreTelemetry(ctx context.Context, gatewayID string, snapshot TelemetrySnapshot) error {
|
||||
id, err := uuid.Parse(gatewayID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return s.repo.StoreTelemetry(ctx, id, snapshot)
|
||||
}
|
||||
|
||||
func (s *Service) Bootstrap(ctx context.Context, input BootstrapRequest) (Gateway, error) {
|
||||
if input.Name == "" {
|
||||
input.Name = "primary-gateway"
|
||||
|
||||
Reference in New Issue
Block a user