func reportAndFlushUserAction(action string, value interface{}) func() {
	metricsDone := make(chan struct{})
	go func() {
		client := newSegmentClient()
		defer client.Close()
		cfg, err := config.Read()
		if err != nil || cfg == nil || cfg.UserID == "" {
			log.Errorf("Error reading userid from ~/.pachyderm/config: %v", err)
			// metrics errors are non fatal
			return
		}
		reportUserMetricsToSegment(client, cfg.UserID, "user", action, value, "")
		close(metricsDone)
	}()
	return func() {
		select {
		case <-metricsDone:
			return
		case <-time.After(time.Second * 5):
			return
		}
	}
}
func reportAndFlushUserAction(action string, value interface{}) func() {
	metricsDone := make(chan struct{})
	go func() {
		client := newSegmentClient()
		defer client.Close()
		cfg, err := config.Read()
		if err != nil || cfg == nil || cfg.UserID == "" {
			log.Errorf("Error reading userid from ~/.pachyderm/config: %v", err)
			// metrics errors are non fatal
			return
		}
		reportUserMetricsToSegment(client, cfg.UserID, "user", action, value, "")
		close(metricsDone)
	}()
	return func() {
		select {
		case <-metricsDone:
			return
		case <-time.After(time.Second * 5):
			return
		}
	}
}
// Helper method called by (Start|Finish)ReportAndFlushUserAction. Like those
// functions, it is used by the pachctl binary and runs on users' machines
// TODO(msteffen): Wrap config parsing in a library