private Map<String,MetricHeaderInfo> processCSVFileDataHeader(DbClient dbClient,StorageSystem storageSystem,String directorName,List<String> headers){
  Map<String,MetricHeaderInfo> metricToObjectMap=new HashMap<>();
  for (  String header : headers) {
    Matcher matcher=METRIC_NAME_PATTERN.matcher(header);
    if (matcher.matches()) {
      String name=matcher.group(1);
      if (!METRICS_NAMES_TO_GATHER.contains(name)) {
        continue;
      }
      String objectName=matcher.group(2);
      String units=matcher.group(3);
      if (Strings.isNullOrEmpty(objectName)) {
        objectName=EMPTY;
      }
      StorageHADomain vplexDirector=lookupVPlexDirectorByName(dbClient,storageSystem,directorName);
      if (objectName.equals(EMPTY)) {
        MetricHeaderInfo headerInfo=new MetricHeaderInfo();
        headerInfo.type=MetricHeaderInfo.Type.DIRECTOR;
        headerInfo.director=vplexDirector;
        headerInfo.units=units;
        metricToObjectMap.put(header,headerInfo);
      }
 else {
        StoragePort storagePort=lookupVPlexFrontStoragePortByName(dbClient,vplexDirector,objectName);
        if (storagePort != null) {
          MetricHeaderInfo headerInfo=new MetricHeaderInfo();
          headerInfo.type=MetricHeaderInfo.Type.PORT;
          headerInfo.director=vplexDirector;
          headerInfo.port=storagePort;
          headerInfo.units=units;
          metricToObjectMap.put(header,headerInfo);
        }
      }
    }
  }
  return metricToObjectMap;
}

private Map < String , MetricHeaderInfo > processCSVFileDataHeader ( DbClient dbClient , StorageSystem storageSystem , String directorName , List < String > headers ) { Map < String , MetricHeaderInfo > metricToObjectMap = new HashMap < > ( ) ; for ( String header : headers ) { Matcher matcher = METRIC_NAME_PATTERN . matcher ( header ) ; if ( matcher . matches ( ) ) { String name = matcher . group ( 1 ) ; if ( ! METRICS_NAMES_TO_GATHER . contains ( name ) ) { continue ; } String objectName = matcher . group ( 2 ) ; String units = matcher . group ( 3 ) ; if ( Strings . isNullOrEmpty ( objectName ) ) { objectName = EMPTY ; } StorageHADomain vplexDirector = lookupVPlexDirectorByName ( dbClient , storageSystem , directorName ) ; if ( objectName . equals ( EMPTY ) ) { MetricHeaderInfo headerInfo = new MetricHeaderInfo ( ) ; headerInfo . type = MetricHeaderInfo . Type . DIRECTOR ; headerInfo . director = vplexDirector ; headerInfo . units = units ; metricToObjectMap . put ( header , headerInfo ) ; } else { StoragePort storagePort = lookupVPlexFrontStoragePortByName ( dbClient , vplexDirector , objectName ) ; if ( storagePort != null ) { MetricHeaderInfo headerInfo = new MetricHeaderInfo ( ) ; headerInfo . type = MetricHeaderInfo . Type . PORT ; headerInfo . director = vplexDirector ; headerInfo . port = storagePort ; headerInfo . units = units ; metricToObjectMap . put ( header , headerInfo ) ; } } } } return metricToObjectMap ; }
return a mapping of the metric name and the dataobject ( storagehadomain or storageport ) to which the metric applies . first line from the csv file will look like this : time , time ( utc ) , be - prt . write a1 - fc02 ( kb / s ) , be - prt . write a1 - fc03 ( kb / s ) , . . . ' headers ' will contain each of the strings delimited by ' , ' . this function will parse that to determine what dataobject it should be associated with and its units .
