|
@@ -17,6 +17,7 @@
|
|
|
package metrics
|
|
package metrics
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "os"
|
|
|
"strings"
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/docker/compose-cli/utils"
|
|
"github.com/docker/compose-cli/utils"
|
|
@@ -24,6 +25,9 @@ import (
|
|
|
|
|
|
|
|
// Track sends the tracking analytics to Docker Desktop
|
|
// Track sends the tracking analytics to Docker Desktop
|
|
|
func Track(context string, args []string, status string) {
|
|
func Track(context string, args []string, status string) {
|
|
|
|
|
+ if isInvokedAsCliBackend() {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
command := GetCommand(args)
|
|
command := GetCommand(args)
|
|
|
if command != "" {
|
|
if command != "" {
|
|
|
c := NewClient()
|
|
c := NewClient()
|
|
@@ -36,6 +40,11 @@ func Track(context string, args []string, status string) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func isInvokedAsCliBackend() bool {
|
|
|
|
|
+ executable := os.Args[0]
|
|
|
|
|
+ return strings.HasSuffix(executable, "-backend")
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func isCommand(word string) bool {
|
|
func isCommand(word string) bool {
|
|
|
return utils.StringContains(commands, word) || isManagementCommand(word)
|
|
return utils.StringContains(commands, word) || isManagementCommand(word)
|
|
|
}
|
|
}
|