Exemple #1
0
        public void InitializeJobConfiguration(IServiceProvider serviceProvider)
        {
            _configuration             = serviceProvider.GetRequiredService <IOptionsSnapshot <JobConfiguration> >().Value;
            _executionTimeoutInSeconds = _configuration.ExecutionTimeoutInSeconds ?? DefaultExecutionTimeoutInSeconds;
            _maxBlobsToProcess         = _configuration.MaxBlobsToProcess ?? DefaultMaxBlobsToProcess;
            var logHeader          = _configuration.LogHeader ?? throw new ArgumentNullException(nameof(_configuration.LogHeader));
            var logHeaderDelimiter = _configuration.LogHeaderDelimiter ?? throw new ArgumentNullException(nameof(_configuration.LogHeaderDelimiter));

            _logHeaderMetadata = new LogHeaderMetadata(logHeader, logHeaderDelimiter);
            _blobPrefix        = _configuration.BlobPrefix;
            var blobLeaseManager = new AzureBlobLeaseManager(serviceProvider.GetRequiredService <ILogger <AzureBlobLeaseManager> >());

            var source = new AzureStatsLogSource(
                ValidateAzureCloudStorageAccount(_configuration.AzureAccountConnectionStringSource),
                _configuration.AzureContainerNameSource,
                _executionTimeoutInSeconds / _maxBlobsToProcess,
                blobLeaseManager,
                serviceProvider.GetRequiredService <ILogger <AzureStatsLogSource> >());

            var dest = new AzureStatsLogDestination(
                ValidateAzureCloudStorageAccount(_configuration.AzureAccountConnectionStringDestination),
                _configuration.AzureContainerNameDestination,
                serviceProvider.GetRequiredService <ILogger <AzureStatsLogDestination> >());

            var sanitizers = new List <ISanitizer> {
                new ClientIPSanitizer(_logHeaderMetadata)
            };

            _processor = new Processor(source, dest, _maxBlobsToProcess, sanitizers, serviceProvider.GetRequiredService <ILogger <Processor> >());
        }
Exemple #2
0
 public ClientIPSanitizer(LogHeaderMetadata headerMetadata)
 {
     _headerMetadata   = headerMetadata ?? throw new ArgumentNullException(nameof(headerMetadata));
     _headerValueIndex = headerMetadata.GetIndex(_headerValue) ?? throw new ArgumentException(nameof(headerMetadata.Header));
 }