Exemplo n.º 1
0
        protected FeedResponse <T> FindByPredicate <T>(Expression <Func <T, bool> > predicate, FeedOptions options = default)
        {
            var queryable = _client.CreateDocumentQuery <T>(_collectionUri, options ?? EmptyOptions);
            var query     = queryable.Where(predicate);
            var response  = query.AsDocumentQuery().ExecuteNextAsync <T>().ConfigureAwait(false).GetAwaiter().GetResult();

            _metrics.Gauge(nameof(FeedResponse <T> .RequestCharge), () => response.RequestCharge);
            return(response);
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Creates a new gauge metric and registers it under the given type and name
 /// </summary>
 /// <typeparam name="T">The type the gauge measures</typeparam>
 /// <param name="name">The metric name</param>
 /// <param name="evaluator">The gauge evaluation function</param>
 /// <returns></returns>
 public GaugeMetric <T> Gauge <T>(string name, Func <T> evaluator)
 {
     return(_host.Gauge(typeof(TOwner), name, evaluator));
 }