Exemplo n.º 1
0
        public async Task <IList <ServiceEvent> > GetServiceEventsAsync(string serviceName, Duration duration, IList <Type> types, CancellationToken token)
        {
            var filter           = FilterFactory.CreateServiceFilter(this.traceStoreReader, types, serviceName);
            var allServiceEvents = (await this.traceStoreReader.ReadTraceRecordsAsync(duration, filter, token).ConfigureAwait(false)).Select(oneRecord => ServiceEventAdapter.Convert(oneRecord)).ToList();

            if (this.traceStoreReader.IsPropertyLevelFilteringSupported() || string.IsNullOrWhiteSpace(serviceName))
            {
                return(allServiceEvents);
            }

            return(allServiceEvents.Where(oneEvent => oneEvent.ServiceId.Equals(ServiceEvent.TransformServiceName(serviceName), StringComparison.InvariantCultureIgnoreCase)).ToList());
        }