public IActionResult GetMetricsFromAllCluster([FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime)
        {
            var response = _repository.GetByPeriod(fromTime, toTime);

            _logger.LogInformation("GetMetricsFromAllCluster_DotNet:", " fromTime: ", fromTime.ToString(), " toTime: ", toTime.ToString());

            return(Ok(response));
        }
Exemple #2
0
            public async Task <AgentDotNetMetricResponse> Handle(DotNetMetricGetByPeriodQuery request, CancellationToken cancellationToken)
            {
                var result = await Task.Run(() =>
                {
                    var metricsList = _repository.GetByPeriod(request.FromTime, request.ToTime);

                    var response = new AgentDotNetMetricResponse();

                    response.Metrics.AddRange(_mapper.Map <List <AgentDotNetMetricDto> >(metricsList));

                    return(response);
                });

                return(result);
            }
        public IActionResult GetErrorsCount([FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime)
        {
            _logger.LogInformation("DotNetController FromTime:{0} ToTime {1}", fromTime, toTime);

            var metrics = _repository.GetByPeriod(new PeriodArgs()
            {
                FromTime = fromTime, ToTime = toTime
            });
            var response = new ByPeriodDotNetMetricResponse()
            {
                Metrics = _mapper.Map <IEnumerable <DotNetMetric>, List <DotNetMetricDto> >((IEnumerable <DotNetMetric>)metrics)
            };

            return(Ok(response));
        }
        public IActionResult GetByPeriod([FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime)
        {
            _logger.LogInformation($"Запрос метрик за период c {fromTime:f} по {toTime:f}");
            var metrics = _repository.GetByPeriod(fromTime, toTime);

            var response = new ListDotNetMetricsResponse()
            {
                Metrics = new List <DotNetMetricResponse>()
            };

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

            return(Ok(response));
        }
Exemple #5
0
        public IActionResult GetMetricsFromAllCluster(
            [FromRoute] DateTimeOffset fromTime,
            [FromRoute] DateTimeOffset toTime)
        {
            var metrics  = _repository.GetByPeriod(fromTime, toTime);
            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} для кластера");

            return(Ok(response));
        }
 public IActionResult GetMetricsFromAgent([FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime)
 {
     try
     {
         _logger.Debug($"Route(api/metrics/dotnet): Running the GetMetricsFromAgent method");
         var metrics  = _repository.GetByPeriod(fromTime, toTime);
         var response = new MetricsResponse <DotNetMetricsDto>();
         foreach (var item in metrics)
         {
             response.Metrics.Add(_mapper.Map <DotNetMetricsDto>(item));
         }
         _logger.Debug($"Route(api/metrics/dotnet): GetMetricsFromAgent method completed successfully");
         return(Ok(response.Metrics.ToList()));
     }
     catch (Exception e)
     {
         _logger.Error(e);
         return(BadRequest(e.Message));
     }
 }
        public IActionResult GetMetricsFromAgent([FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime)
        {
            var config = new MapperConfiguration(cfg => cfg.CreateMap <DotNetMetric, DotNetMetricDto>());

            var m = config.CreateMapper();

            var metrics = _repository.GetByPeriod(fromTime, toTime);

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

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

            _logger.LogInformation(string.Concat("GetMetricsFromAgent_DotNet: ", " fromTime: ", fromTime.ToString(), " toTime: ", toTime.ToString()));

            return(Ok(response));
        }
 public IList <DotNetMetric> GetDotNetMetricsByPeriod(DateTimeOffset fromTime, DateTimeOffset toTime, int agentId = 0)
 {
     return(_dotNetMetricsRepository.GetByPeriod(fromTime, toTime, agentId));
 }