code: func GetStatusVars(vars *SessionVars) (map[string]*StatusVal, error) {
  	statusVars := make(map[string]*StatusVal)
  	statisticsListLock.RLock()
  	defer statisticsListLock.RUnlock()
  
  	for _, statistics := range statisticsList {
  		vals, err := statistics.Stats(vars)
  		if err != nil {
  			return nil, err
  		}
  
  		for name, val := range vals {
  			scope := statistics.GetScope(name)
  			statusVars[name] = &StatusVal{Value: val, Scope: scope}
  		}
  	}
  
  	return statusVars, nil
  }
docs: // GetStatusVars gets registered statistics status variables.
  // TODO: Refactor this function to avoid repeated memory allocation / dealloc