private Set<MetricNameDto> getCustomMetricsNamesNewModel(List<TaskDataDto> tests) {
    try {
      Set<Long> taskIds = CommonUtils.getTestsIds(tests);

      List<Object[]> metricDescriptionEntities = getMetricNames(taskIds);

      if (metricDescriptionEntities.isEmpty()) {
        return Collections.emptySet();
      }

      Set<MetricNameDto> metrics = new HashSet<>(metricDescriptionEntities.size());

      for (Object[] mde : metricDescriptionEntities) {
        for (TaskDataDto td : tests) {
          if (td.getIds().contains((Long) mde[2])) {
            String metricName = (String) mde[0];
            MetricNameDto metricNameDto =
                new MetricNameDto(td, metricName, (String) mde[1], MetricNameDto.Origin.METRIC);
            // synonyms are required for new model of standard metrics for correct back
            // compatibility
            metricNameDto.setMetricNameSynonyms(StandardMetricsNamesUtil.getSynonyms(metricName));
            metrics.add(metricNameDto);
            break;
          }
        }
      }

      return metrics;
    } catch (PersistenceException e) {
      log.debug(
          "Could not fetch data from MetricSummaryEntity: {}",
          DataProcessingUtil.getMessageFromLastCause(e));
      return Collections.emptySet();
    }
  }
  private Set<MetricNameDto> getCustomTestGroupMetricsNamesNewModel(List<TaskDataDto> tests) {
    try {
      Set<Long> taskIds = CommonUtils.getTestsIds(tests);

      Multimap<Long, Long> testGroupMap = fetchUtil.getTestGroupIdsByTestIds(taskIds);

      List<Object[]> metricDescriptionEntities = getMetricNames(testGroupMap.keySet());

      metricDescriptionEntities =
          CommonUtils.filterMonitoring(metricDescriptionEntities, monitoringPlotGroups);

      if (metricDescriptionEntities.isEmpty()) {
        return Collections.emptySet();
      }

      Set<MetricNameDto> metrics = new HashSet<>(metricDescriptionEntities.size());

      // add test-group metric names
      for (Object[] mde : metricDescriptionEntities) {
        for (TaskDataDto td : tests) {
          Collection<Long> allTestsInGroup = testGroupMap.get((Long) mde[2]);
          if (CommonUtils.containsAtLeastOne(td.getIds(), allTestsInGroup)) {
            metrics.add(
                new MetricNameDto(
                    td, (String) mde[0], (String) mde[1], MetricNameDto.Origin.TEST_GROUP_METRIC));
          }
        }
      }

      return metrics;
    } catch (PersistenceException e) {
      log.debug(
          "Could not fetch test-group data from MetricSummaryEntity: {}",
          DataProcessingUtil.getMessageFromLastCause(e));
      return Collections.emptySet();
    }
  }