Пример #1
0
        public async Task <IList <ApplicationEvent> > GetApplicationEventsAsync(string applicationName, Duration duration, IList <Type> types, CancellationToken token)
        {
            await this.InitIfRequiredAsync(token).ConfigureAwait(false);

            var filter = FilterFactory.CreateApplicationFilter(this.traceStoreReader, types, applicationName);
            var allApplicationEvents = (await this.traceStoreReader.ReadTraceRecordsAsync(duration, filter, token).ConfigureAwait(false)).Select(oneRecord => ApplicationEventAdapter.Convert(oneRecord)).ToList();

            if (this.traceStoreReader.IsPropertyLevelFilteringSupported() || string.IsNullOrWhiteSpace(applicationName))
            {
                return(allApplicationEvents);
            }

            // Today, local reader doesn't support filtering, so we filter on the model event.
            return(allApplicationEvents.Where(oneEvent => oneEvent.ApplicationId.Equals(ApplicationEvent.TransformAppName(applicationName), StringComparison.InvariantCultureIgnoreCase)).ToList());
        }