Skip to content

Commit

Permalink
adding generic command event
Browse files Browse the repository at this point in the history
  • Loading branch information
JyotikaGargg committed Jul 25, 2023
1 parent f7d5292 commit b9879f1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 3 additions & 2 deletions cmd/modern/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ import (
"github.com/microsoft/go-sqlcmd/internal/output"
"github.com/microsoft/go-sqlcmd/internal/output/verbosity"
"github.com/microsoft/go-sqlcmd/internal/pal"
"github.com/microsoft/go-sqlcmd/internal/telemetry"
"github.com/microsoft/go-sqlcmd/pkg/sqlcmd"
"github.com/spf13/cobra"

"github.com/microsoft/go-sqlcmd/internal/telemetry"

legacyCmd "github.com/microsoft/go-sqlcmd/cmd/sqlcmd"
)

Expand Down Expand Up @@ -115,6 +114,8 @@ func isFirstArgModernCliSubCommand() (isNewCliCommand bool) {
if len(os.Args) > 1 {
if rootCmd.IsValidSubCommand(os.Args[1]) {
isNewCliCommand = true
command := os.Args[1]
telemetry.TrackCommand(command)
}
}
return
Expand Down
2 changes: 0 additions & 2 deletions cmd/modern/root/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/microsoft/go-sqlcmd/internal/cmdparser"
"github.com/microsoft/go-sqlcmd/internal/localizer"
"github.com/microsoft/go-sqlcmd/internal/pal"
"github.com/microsoft/go-sqlcmd/internal/telemetry"
)

// Config defines the `sqlcmd config` sub-commands
Expand Down Expand Up @@ -39,7 +38,6 @@ func (c *Config) DefineCommand(...cmdparser.CommandOptions) {
}

c.Cmd.DefineCommand(options)
telemetry.TrackEvent("config")
}

// SubCommands sets up all the sub-commands for `sqlcmd config`
Expand Down
2 changes: 1 addition & 1 deletion internal/telemetry/appinsights.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Telemetry struct {
}

func InitializeAppInsights() {
instrumentationKey := "5587abc4-2843-4455-b7dd-c3eb1f2e45f6"
instrumentationKey := "3fdeec77-2951-456f-bcb2-9f003b512a3f"
config := appinsights.NewTelemetryConfiguration(instrumentationKey)
telemetryClient = appinsights.NewTelemetryClientFromConfig(config)
SetTelemetryClient(telemetryClient)
Expand Down

0 comments on commit b9879f1

Please sign in to comment.