mirror of
https://github.com/docker/compose.git
synced 2025-07-24 22:24:41 +02:00
Do not send metrics if executed as CLI backend
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
parent
bf5b8f9b8a
commit
924d92a817
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user