diff --git a/cmd/pilotctl/appstore_catalogue.go b/cmd/pilotctl/appstore_catalogue.go index 7d2be8f3..d7af60d5 100644 --- a/cmd/pilotctl/appstore_catalogue.go +++ b/cmd/pilotctl/appstore_catalogue.go @@ -248,8 +248,9 @@ func cmdAppStoreCatalogue(_ []string) { identityPath := configDir() + "/identity.json" client := telemetry.NewClientFromIdentity(url, identityPath, 0) err := client.Send(telemetry.Event{ - Kind: "catalogue_viewed", - TS: time.Now().UTC().Format(time.RFC3339), + Kind: "catalogue_viewed", + TS: time.Now().UTC().Format(time.RFC3339), + Payload: json.RawMessage(`{"surface":"catalogue"}`), }) if err != nil { slog.Warn("telemetry send failed, catalogue still rendered", "err", err) diff --git a/pkg/telemetry/client.go b/pkg/telemetry/client.go index 0f3526f7..84f98443 100644 --- a/pkg/telemetry/client.go +++ b/pkg/telemetry/client.go @@ -98,6 +98,7 @@ func (c *Client) Send(events ...Event) error { url := c.url sign := c.sign pubKeyB := c.pubKeyB + nodeID := c.nodeID c.mu.Unlock() if disabled || url == "" { @@ -113,6 +114,15 @@ func (c *Client) Send(events ...Event) error { return nil } + // Inject node ID into events that don't supply their own. + if nodeID != 0 { + for i := range events { + if events[i].NodeID == 0 { + events[i].NodeID = nodeID + } + } + } + body, err := json.Marshal(events) if err != nil { return fmt.Errorf("telemetry marshal: %w", err)