Example #1
0
        public string GetConfigSetName()
        {
            if (string.IsNullOrEmpty(_configSetName))
            {
                _configSetName = _configSetNameProvider.GetConfigSetName();
            }

            return(_configSetName);
        }
Example #2
0
        private async Task <DestinationConfig> GetDestinationConfigAsync(string destinationId, CancellationToken cancellationToken)
        {
            var configSetName      = _configSetNameProvider.GetConfigSetName();
            var destinationsConfig = await _destinationsConfigProvider.GetDestinationsConfigAsync(configSetName, cancellationToken);

            var destinationConfig = destinationsConfig.Where(x => x.DestinationId.Equals(destinationId, StringComparison.CurrentCultureIgnoreCase)).SingleOrDefault();

            if (destinationConfig == null)
            {
                throw new Exception($"Destination with id '{destinationId}' not found");
            }

            return(destinationConfig);
        }
        public async Task <IEnumerable <string> > CollectAsync(CancellationToken cancellationToken)
        {
            var configSetName = _configSetNameProvider.GetConfigSetName();
            var collectorMode = _collectorModeProvider.GetCollectorMode();

            var dataCollectionsConfig = await _dataCollectionsConfigProvider.GetDataCollectionsConfigAsync(configSetName, cancellationToken);

            var dataGroups = dataCollectionsConfig.GroupBy(x => x.DataGroupName).Select(x => new { DataGroupName = x.Key, DataCollectionsConfig = x });

            var tasks = dataGroups.Select(x => CollectGroupAsync(x.DataGroupName, collectorMode, x.DataCollectionsConfig, cancellationToken)).ToList();

            await Task.WhenAll(tasks);

            return(tasks.SelectMany(x => x.Result).ToList());
        }
        public string GetConfigSetName()
        {
            try
            {
                _logger.LogTrace("Started getting config set name");

                var result = _configSetNameProvider.GetConfigSetName();

                _logger.LogTrace("Finished getting config set name");

                _logger.LogInformation($"Using config set name '{result}'");

                return(result);
            }
            catch (Exception e)
            {
                _logger.LogCritical("Error getting config set name: {errorMessage}", e.GetAggregateMessages());
                throw;
            }
        }