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

            var response = new ByPeriodDotNetMetricResponse()
            {
                Metrics = _mapper.Map <IEnumerable <DotNetMetric>, List <DotNetMetricDto> >((IEnumerable <DotNetMetric>)metrics)
            };

            return(Ok(response));
        }
Exemple #2
0
        public IActionResult GetMetricsFromAgent(
            [FromRoute] int agentId,
            [FromRoute] DateTimeOffset fromTime,
            [FromRoute] DateTimeOffset toTime)
        {
            var metrics  = _repository.GetByPeriodFromAgent(fromTime, toTime, agentId);
            var response = new AllDotNetMetricsResponse()
            {
                Metrics = new List <DotNetMetricManagerDto>()
            };

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

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

            return(Ok(response));
        }