Ejemplo n.º 1
0
        public async Task <IEnumerable <TraceViewModel> > Get(
            [FromQuery] string service, [FromQuery] string tags,
            [FromQuery] long?startTimestamp, [FromQuery] long?finishTimestamp,
            [FromQuery] int?minDuration, [FromQuery] int?maxDuration, [FromQuery] int?limit)
        {
            var query = new TraceQuery
            {
                Tags            = tags,
                ServiceName     = service,
                StartTimestamp  = TimestampHelpers.Convert(startTimestamp),
                FinishTimestamp = TimestampHelpers.Convert(finishTimestamp),
                MinDuration     = minDuration,
                MaxDuration     = maxDuration,
                Limit           = limit.GetValueOrDefault(10)
            };

            var data = await _spanQuery.GetTraces(query);

            var traceViewModels = _mapper.Map <List <TraceViewModel> >(data);

            foreach (var trace in traceViewModels)
            {
                var item = data.FirstOrDefault(x => x.TraceId == trace.TraceId);
                trace.Services = GetTraceServices(item);
            }

            return(traceViewModels);
        }
Ejemplo n.º 2
0
        public async Task <PageViewModel <TraceViewModel> > Get(
            [FromQuery] string service, [FromQuery] string tags,
            [FromQuery] DateTime?startTimestamp, [FromQuery] DateTime?finishTimestamp,
            [FromQuery] int?minDuration, [FromQuery] int?maxDuration,
            [FromQuery] int?pageNumber, [FromQuery] int?pageSize)
        {
            var query = new TraceQuery
            {
                Tags              = tags,
                ServiceName       = service,
                StartTimestamp    = startTimestamp?.ToUniversalTime(),
                FinishTimestamp   = finishTimestamp?.ToUniversalTime(),
                MinDuration       = minDuration,
                MaxDuration       = maxDuration,
                CurrentPageNumber = pageNumber.GetValueOrDefault(1),
                PageSize          = pageSize.GetValueOrDefault(10)
            };

            var data = await _spanQuery.GetTraces(query);

            var pageViewModel = _mapper.Map <PageViewModel <TraceViewModel> >(data);

            foreach (var traceViewModel in pageViewModel.Data)
            {
                var trace = data.Data.FirstOrDefault(x => x.TraceId == traceViewModel.TraceId);
                traceViewModel.Services = GetTraceServices(trace);
            }

            return(pageViewModel);
        }
Ejemplo n.º 3
0
        public async Task <PageViewModel <TraceViewModel> > Get(
            [FromQuery] string application,
            [FromQuery] DateTimeOffset?startTimestamp, [FromQuery] DateTimeOffset?finishTimestamp,
            [FromQuery] int?minDuration, [FromQuery] int?maxDuration,
            [FromQuery] int?pageNumber, [FromQuery] int?pageSize)
        {
            var query = new TraceQuery
            {
                ApplicationName   = application,
                StartTimestamp    = startTimestamp,
                FinishTimestamp   = finishTimestamp,
                MinDuration       = minDuration,
                MaxDuration       = maxDuration,
                CurrentPageNumber = pageNumber.GetValueOrDefault(1),
                PageSize          = pageSize.GetValueOrDefault(10)
            };
            var data = await _spanQuery.GetTraces(query);

            return(_mapper.Map <PageViewModel <TraceViewModel> >(data));
        }