Beispiel #1
0
 public HttpProxy(ILogger <HttpProxy> logger, ProxyMetrics metrics)
 {
     Contracts.CheckValue(logger, nameof(logger));
     Contracts.CheckValue(metrics, nameof(metrics));
     _logger  = logger;
     _metrics = metrics;
 }
Beispiel #2
0
        public void OnProxyMetrics(ProxyMetrics oldMetrics, ProxyMetrics newMetrics)
        {
            var elapsed     = newMetrics.Timestamp - oldMetrics.Timestamp;
            var newRequests = newMetrics.RequestsStarted - oldMetrics.RequestsStarted;

            Console.Title = $"Proxied {newMetrics.RequestsStarted} requests ({newRequests} in the last {(int)elapsed.TotalMilliseconds} ms)";
        }
Beispiel #3
0
 public StreamCopierTests()
 {
     _metricCreator = Provide <IMetricCreator, TestMetricCreator>();
     _metrics       = Create <ProxyMetrics>();
 }
 public StreamCopier(ProxyMetrics metrics, in StreamCopyTelemetryContext context)
 public void OnProxyMetrics(ProxyMetrics oldMetrics, ProxyMetrics newMetrics)
 {
     _requestsStarted.IncTo(newMetrics.RequestsStarted);
     _requestsFailed.IncTo(newMetrics.RequestsFailed);
     _CurrentRequests.Set(newMetrics.CurrentRequests);
 }
Beispiel #6
0
 public HttpProxy(ILogger <HttpProxy> logger, ProxyMetrics metrics)
 {
     _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
     _metrics = metrics ?? throw new ArgumentNullException(nameof(metrics));
 }