public IActionResult GetMetricsByPercentileFromAgent( [FromRoute] int agentId, [FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime, [FromRoute] Percentile percentile) { var metrics = _repository.GetByPeriodWithSortingFromAgent(fromTime, toTime, "value", agentId); var percentileMetric = metrics.Cast <RamMetricModel>().SingleOrDefault(i => i.Value == PercentileCalculator.Calculate(GetListValuesFromMetrics(metrics), (double)percentile / 100.0)); var response = new AllRamMetricsResponse() { Metrics = new List <RamMetricManagerDto>() }; response.Metrics.Add(_mapper.Map <RamMetricManagerDto>(percentileMetric)); _logger.LogInformation($"Запрос персентиля = {percentile} метрик Ram за период с {fromTime} по {toTime} для агента {agentId}"); return(Ok(response)); }