Exemplo n.º 1
0
        public IActionResult GetMetricsFromAgent([FromRoute] int agentId, [FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime)
        {
            _logger.LogInformation("RamControllerAgent FromTime:{0} ToTime {1}", fromTime, toTime);
            var metrics = _repository.GetByPeriodFromAgent(new PeriodAgentArgs()
            {
                FromTime = fromTime, ToTime = toTime, AgentId = agentId
            });

            var response = new ByPeriodRamMetricResponse()
            {
                Metrics = _mapper.Map <IEnumerable <RamMetric>, List <RamMetricDto> >((IEnumerable <RamMetric>)metrics)
            };

            return(Ok(response));
        }
Exemplo n.º 2
0
        public IActionResult GetMetricsFromAgent(
            [FromRoute] int agentId,
            [FromRoute] DateTimeOffset fromTime,
            [FromRoute] DateTimeOffset toTime)
        {
            var metrics = _repository.GetByPeriodFromAgent(fromTime, toTime, agentId);

            var response = new AllRamMetricsResponse()
            {
                Metrics = new List <RamMetricManagerDto>()
            };

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

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

            return(Ok(response));
        }