Esempio n. 1
0
        public MetricsEndpointService(ILogger logger, IOptions <MonitoringOptions> options)
        {
            _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
            _options = options?.Value ?? throw new ArgumentNullException(nameof(options));

            _server = new MetricServer(_options.MetricsEndpointPort, _options.MetricsEndpointPath);
        }
Esempio n. 2
0
 public CloudWatchMetricsHandler(
     ILogger logger,
     IOptions <MonitoringOptions> options,
     IAmazonCloudWatch cloudWatchClient)
 {
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
     _options          = options?.Value ?? throw new ArgumentNullException(nameof(options));
     _cloudWatchClient = cloudWatchClient ?? throw new ArgumentNullException(nameof(cloudWatchClient));
 }
Esempio n. 3
0
 public SqsStatsService(
     ILogger logger,
     IOptions <MonitoringOptions> monitoringOptions,
     IAmazonSQS sqsClient,
     IAmazonECS ecsClient,
     IMediator mediator)
 {
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
     _monitoringOptions = monitoringOptions.Value ?? throw new ArgumentNullException(nameof(monitoringOptions));
     _sqsClient         = sqsClient ?? throw new ArgumentNullException(nameof(sqsClient));
     _ecsClient         = ecsClient ?? throw new ArgumentNullException(nameof(ecsClient));
     _mediator          = mediator ?? throw new ArgumentNullException(nameof(mediator));
 }
Esempio n. 4
0
        public SqsStatsService(
            ILogger logger,
            IOptions <MonitoringOptions> monitoringOptions,
            IAmazonSQS sqsClient,
            IAmazonECS ecsClient,
            IMediator mediator,
            IApplicationLifetime applicationLifetime)
        {
            _logger              = logger ?? throw new ArgumentNullException(nameof(logger));
            _monitoringOptions   = monitoringOptions.Value ?? throw new ArgumentNullException(nameof(monitoringOptions));
            _sqsClient           = sqsClient ?? throw new ArgumentNullException(nameof(sqsClient));
            _ecsClient           = ecsClient ?? throw new ArgumentNullException(nameof(ecsClient));
            _mediator            = mediator ?? throw new ArgumentNullException(nameof(mediator));
            _applicationLifetime = applicationLifetime ?? throw new ArgumentNullException(nameof(applicationLifetime));

            _retryPolicy = Policy.Handle <Exception>()
                           .WaitAndRetryAsync(_monitoringOptions.SqsConnectionRetryCount,
                                              attempts => TimeSpan.FromSeconds(attempts * _monitoringOptions.SqsConnectionRetryBackoffMultiplier), OnRetryAsync);
        }