示例#1
0
        public IActionResult GetMetricsByPercentileFromCluster(
            [FromRoute] DateTimeOffset fromTime,
            [FromRoute] DateTimeOffset toTime,
            [FromRoute] Percentile percentile)
        {
            var metrics = _repository.GetMetricsFromTimeToTimeOrderBy(fromTime, toTime, "value");

            if (metrics.Count == 0)
            {
                return(NoContent());
            }

            int percentileThisList = (int)percentile;

            percentileThisList = percentileThisList * metrics.Count / 100;

            var response = metrics[percentileThisList].Value;

            _logger.LogInformation($"Запрос percentile = {percentile} Network FromTime = {fromTime} ToTime = {toTime}");

            return(Ok(response));
        }