public async Task <TResult> ReceiveAsync <TResult>(IQuery <TResult> query, CancellationToken cancellationToken = default)
        {
            var stopWatch = new Stopwatch();

            _metrics.Increment(new RequestCounterMetric(query));
            _metrics.Increment(new RequestGaugeMetric("generic_request_gauge", "Current request count"));
            try {
                stopWatch.Start();
                var result = await _next.ReceiveAsync(query, cancellationToken);

                stopWatch.Stop();

                _metrics.Observe(new RequestDurationMetric(query), stopWatch.ElapsedMilliseconds);

                return(result);
            }
            catch (Exception exception) {
                stopWatch.Stop();
                _metrics.Increment(new RequestFailureMetric(query, exception));

                throw;
            }
            finally {
                _metrics.Decrement(new RequestGaugeMetric("generic_request_gauge", "Current request count"));
            }
        }
 public async Task <TResult> ReceiveAsync <TResult>(IQuery <TResult> query, CancellationToken cancellationToken = default)
 {
     Enrich(Options.QueryIdPropertyName, query.QueryId);
     return(await _next.ReceiveAsync(query, cancellationToken));
 }
 public async Task <TResult> ReceiveAsync <TResult>(IQuery <TResult> query, ICorrelation correlation, CancellationToken cancellationToken = default)
 {
     return(await _receiver.ReceiveAsync(query, cancellationToken));
 }
 public async Task <TResult> ReceiveAsync <TResult>(IQuery <TResult> query, CancellationToken cancellationToken = default)
 {
     _log.Verbose("Receiving {queryType} on http", query.DisplayName());
     return(await _queryReceiver.ReceiveAsync(query, cancellationToken));
 }
Exemplo n.º 5
0
 public async Task <T> ReceiveAsync <T>(IQuery <T> query, BasicDeliverEventArgs args, CancellationToken cancellationToken)
 {
     return(await _queryReceiver.ReceiveAsync(query, cancellationToken));
 }