File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ var loginCmd = &cobra.Command{
3232
3333 ctx := cmd .Context ()
3434 api := keys .GetAPIInstance (ctx )
35+ telemetryClient := keys .GetTelemetryInstance (ctx )
36+
37+ // Track login command
38+ ctx , done := telemetryClient .TrackCommand (ctx , "auth.login" , args )
39+ defer done ()
3540
3641 fmt .Println ("Please visit the following URL to login:" )
3742 authenticationURL := api .BuildAuthenticationUrl (
Original file line number Diff line number Diff line change @@ -89,6 +89,11 @@ var rootCmd = &cobra.Command{
8989 ctx := cmd .Context ()
9090 api := keys .GetAPIInstance (ctx )
9191 analytics := keys .GetAnalyticsInstance (ctx )
92+ telemetryClient := keys .GetTelemetryInstance (ctx )
93+
94+ // Track command execution
95+ ctx , done := telemetryClient .TrackCommand (ctx , "splash" , args )
96+ defer done ()
9297
9398 photoOfTheDayID := viper .GetString ("photo-of-the-day.id" )
9499
@@ -364,7 +369,11 @@ func init() {
364369}
365370
366371func Execute (ctx context.Context ) {
372+ telemetryClient := keys .GetTelemetryInstance (ctx )
373+
367374 if err := rootCmd .ExecuteContext (ctx ); err != nil {
375+ // Track command errors
376+ telemetryClient .TrackError (ctx , err , "unknown" )
368377 os .Exit (1 )
369378 }
370379}
You can’t perform that action at this time.
0 commit comments