code: func (m *Manager) ToMetricSeries(ctx context.Context, series []types.BasePerfEntityMetricBase) ([]EntityMetric, error) {
  	counters, err := m.CounterInfoByKey(ctx)
  	if err != nil {
  		return nil, err
  	}
  
  	var result []EntityMetric
  
  	for i := range series {
  		var values []MetricSeries
  		s, ok := series[i].(*types.PerfEntityMetric)
  		if !ok {
  			panic(fmt.Errorf("expected type %T, got: %T", s, series[i]))
  		}
  
  		for j := range s.Value {
  			v := s.Value[j].(*types.PerfMetricIntSeries)
  
  			values = append(values, MetricSeries{
  				Name:     counters[v.Id.CounterId].Name(),
  				unit:     counters[v.Id.CounterId].UnitInfo.GetElementDescription().Key,
  				Instance: v.Id.Instance,
  				Value:    v.Value,
  			})
  		}
  
  		result = append(result, EntityMetric{
  			Entity:     s.Entity,
  			SampleInfo: s.SampleInfo,
  			Value:      values,
  		})
  	}
  
  	return result, nil
  }
docs: // ToMetricSeries converts []BasePerfEntityMetricBase to []EntityMetric