예제 #1
0
        public IActionResult GetMetricsFromAgent([FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime)
        {
            _logger.LogInformation($"Запрос метрики DotNet с {fromTime} по {toTime}");

            DateTimeOffset timeFrom = fromTime.UtcDateTime;
            DateTimeOffset timeto   = toTime.UtcDateTime;

            var metrics = _repository.GetByDatePeriod(timeFrom, timeto);

            var response = new AllDotNetMetricsResponse()
            {
                Metrics = new List <DotNetMetricDto>()
            };

            foreach (var metric in metrics)
            {
                response.Metrics.Add(_mapper.Map <DotNetMetricDto>(metric));
            }

            return(Ok(response));
        }