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> >()); }
public void InitializeJobConfiguration(IServiceProvider serviceProvider) { _configuration = serviceProvider.GetRequiredService <IOptionsSnapshot <CollectAzureChinaCdnLogsConfiguration> >().Value; _executionTimeoutInSeconds = _configuration.ExecutionTimeoutInSeconds ?? DefaultExecutionTimeoutInSeconds; var source = new AzureStatsLogSource( ValidateAzureCloudStorageAccount(_configuration.AzureAccountConnectionStringSource), _configuration.AzureContainerNameSource, _executionTimeoutInSeconds / MaxFilesToProcess); var dest = new AzureStatsLogDestination( ValidateAzureCloudStorageAccount(_configuration.AzureAccountConnectionStringDestination), _configuration.AzureContainerNameDestination); _chinaCollector = new ChinaStatsCollector(source, dest); }
public override void Init(IServiceContainer serviceContainer, IDictionary <string, string> jobArgsDictionary) { var cloudStorageAccountConnStringSource = JobConfigurationManager.GetArgument(jobArgsDictionary, ArgumentNames.AzureAccountConnectionStringSource); var cloudStorageAccountConnStringDest = JobConfigurationManager.GetArgument(jobArgsDictionary, ArgumentNames.AzureAccountConnectionStringDestination); _cloudStorageAccountSource = ValidateAzureCloudStorageAccount(cloudStorageAccountConnStringSource); _cloudStorageAccountDestination = ValidateAzureCloudStorageAccount(cloudStorageAccountConnStringDest); _cloudStorageContainerNameDestination = JobConfigurationManager.GetArgument(jobArgsDictionary, ArgumentNames.AzureContainerNameDestination); _cloudStorageContainerNameSource = JobConfigurationManager.GetArgument(jobArgsDictionary, ArgumentNames.AzureContainerNameSource); _destinationFilePrefix = JobConfigurationManager.GetArgument(jobArgsDictionary, ArgumentNames.DestinationFilePrefix); _executionTimeoutInSeconds = JobConfigurationManager.TryGetIntArgument(jobArgsDictionary, ArgumentNames.ExecutionTimeoutInSeconds) ?? DefaultExecutionTimeoutInSeconds; var source = new AzureStatsLogSource(cloudStorageAccountConnStringSource, _cloudStorageContainerNameSource, _executionTimeoutInSeconds / MaxFilesToProcess); var dest = new AzureStatsLogDestination(cloudStorageAccountConnStringDest, _cloudStorageContainerNameDestination); _chinaCollector = new ChinaStatsCollector(source, dest); }