github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/controllers/core/tiltfile/metrics.go (about) 1 package tiltfile 2 3 import ( 4 "context" 5 6 dockertypes "github.com/docker/docker/api/types" 7 8 "github.com/tilt-dev/tilt/internal/analytics" 9 ) 10 11 // reportDockerConnectionEvent records a metric about Docker connectivity. 12 func (r *Reconciler) reportDockerConnectionEvent(ctx context.Context, success bool, serverVersion dockertypes.Version) { 13 r.dockerConnectMetricReporter.Do(func() { 14 var status string 15 if success { 16 status = "connected" 17 } else { 18 status = "error" 19 } 20 21 tags := map[string]string{ 22 "status": status, 23 } 24 25 if serverVersion.Version != "" { 26 tags["server.version"] = serverVersion.Version 27 } 28 29 if serverVersion.Arch != "" { 30 tags["server.arch"] = serverVersion.Arch 31 } 32 33 analytics.Get(ctx).Incr("api.tiltfile.docker.connect", tags) 34 }) 35 }