예제 #1
0
        public IActionResult GetMetricsByPercentileFromAgent(
            [FromRoute] DateTimeOffset fromTime,
            [FromRoute] DateTimeOffset toTime,
            [FromRoute] Percentile percentile)
        {
            var metrics          = _repository.GetByPeriodWithSorting(fromTime, toTime, "value");
            var percentileMetric = metrics.Cast <DotNetMetric>().SingleOrDefault(i => i.Value == PercentileCalculator.Calculate(GetListValuesFromMetrics(metrics), (double)percentile / 100.0));
            var response         = new AllDotNetMetricsResponse()
            {
                Metrics = new List <DotNetMetricDto>()
            };

            response.Metrics.Add(_mapper.Map <DotNetMetricDto>(percentileMetric));

            _logger.LogInformation($"Запрос метрик DotNet персентиля за период с {fromTime} по {toTime}");

            return(Ok(response));
        }