databricks-cli/cmd/telemetry/dummy.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
751 B
Go
Raw Normal View History

2025-02-03 03:18:38 +00:00
package telemetry
2025-01-22 21:03:13 +00:00
import (
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/telemetry"
"github.com/databricks/cli/libs/telemetry/protos"
"github.com/spf13/cobra"
)
2025-02-03 03:18:38 +00:00
func newDummyCommand() *cobra.Command {
2025-01-22 21:03:13 +00:00
cmd := &cobra.Command{
2025-02-03 03:18:38 +00:00
Use: "dummy",
Short: "log dummy telemetry events",
Long: "Fire a test telemetry event against the configured Databricks workspace.",
2025-01-22 21:03:13 +00:00
Hidden: true,
PreRunE: root.MustWorkspaceClient,
}
cmd.RunE = func(cmd *cobra.Command, args []string) error {
2025-02-03 03:18:38 +00:00
for _, v := range []string{"VALUE1", "VALUE2"} {
2025-01-22 21:03:13 +00:00
telemetry.Log(cmd.Context(), protos.DatabricksCliLog{
CliTestEvent: &protos.CliTestEvent{
Name: protos.DummyCliEnum(v),
},
})
}
return nil
}
return cmd
}