code: func NewSession(ctx context.Context, logPrefix string, etcdCli *clientv3.Client, retryCnt, ttl int) (*concurrency.Session, error) {
  	var err error
  
  	var etcdSession *concurrency.Session
  	failedCnt := 0
  	for i := 0; i < retryCnt; i++ {
  		if err = contextDone(ctx, err); err != nil {
  			return etcdSession, errors.Trace(err)
  		}
  
  		failpoint.Inject("closeClient", func(val failpoint.Value) {
  			if val.(bool) {
  				if err := etcdCli.Close(); err != nil {
  					failpoint.Return(etcdSession, errors.Trace(err))
  				}
  			}
  		})
  
  		failpoint.Inject("closeGrpc", func(val failpoint.Value) {
  			if val.(bool) {
  				if err := etcdCli.ActiveConnection().Close(); err != nil {
  					failpoint.Return(etcdSession, errors.Trace(err))
  				}
  			}
  		})
  
  		startTime := time.Now()
  		etcdSession, err = concurrency.NewSession(etcdCli,
  			concurrency.WithTTL(ttl), concurrency.WithContext(ctx))
  		metrics.NewSessionHistogram.WithLabelValues(logPrefix, metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds())
  		if err == nil {
  			break
  		}
  		if failedCnt%logIntervalCnt == 0 {
  			logutil.Logger(context.Background()).Warn("failed to new session to etcd", zap.String("ownerInfo", logPrefix), zap.Error(err))
  		}
  
  		time.Sleep(newSessionRetryInterval)
  		failedCnt++
  	}
  	return etcdSession, errors.Trace(err)
  }
docs: // NewSession creates a new etcd session.