From 55bf5ff4ddef314ac92880bce365301b86b71f24 Mon Sep 17 00:00:00 2001 From: Joel Longtine Date: Fri, 18 Feb 2022 16:39:22 -0700 Subject: [PATCH] Restore TrackProjectCommand + comment (so we can use it later for telemetry) Signed-off-by: Joel Longtine --- cmd/dagger/cmd/common/track.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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)))