diff --git a/cmd/dagger/cmd/common/track.go b/cmd/dagger/cmd/common/track.go index cff3e745..b492ad70 100644 --- a/cmd/dagger/cmd/common/track.go +++ b/cmd/dagger/cmd/common/track.go @@ -28,6 +28,34 @@ func commandName(cmd *cobra.Command) string { return strings.Join(parts, " ") } +// TrackProjectCommand is like TrackCommand but includes project and +// optionally environment metadata. +// func TrackProjectCommand(ctx context.Context, cmd *cobra.Command, w *state.Project, env *state.State, props ...*telemetry.Property) chan struct{} { +// props = append([]*telemetry.Property{ +// { +// // Hash the repository URL for privacy +// Name: "git_repository_hash", +// Value: hash(gitRepoURL(w.Path)), +// }, +// { +// // The project path might contain the username (e.g. /home/user/project), so we hash it for privacy. +// Name: "project_path_hash", +// Value: hash(w.Path), +// }, +// }, props...) + +// if env != nil { +// props = append([]*telemetry.Property{ +// { +// Name: "environment_name", +// Value: env.Name, +// }, +// }, props...) +// } + +// return TrackCommand(ctx, cmd, props...) +// } + // hash returns the sha256 digest of the string // func hash(s string) string { // return fmt.Sprintf("%x", sha256.Sum256([]byte(s)))