Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-9496

QueryResult metrics(true) - lazy loading clarification

    XMLWordPrintable

Details

    Description

      Emphasise that metrics are lazy loading and only returned after results are retrieved

                  var qo = new QueryOptions();
                  qo.Metrics(true);
       
                  for (int i = 0; i < 100; i++)
                  {
                      var queryResult = await cluster.QueryAsync<dynamic>("select \"Hello World\" as greeting", qo);
          
                      var metrics = queryResult.MetaData.Metrics;
                      Console.WriteLine(metrics.ElapsedTime);
                  }
      
      

      vs

                 var qo = new QueryOptions();
                  qo.Metrics(true);
       
                  for (int i = 0; i < 100; i++)
                  {
                      var queryResult = await cluster.QueryAsync<dynamic>("select \"Hello World\" as greeting", qo);
                      await foreach (var row in queryResult)
                      {
                          Console.WriteLine(row);
                      }
                      var metrics = queryResult.MetaData.Metrics;
                      Console.WriteLine(metrics.ElapsedTime);
                  }
      

      first one will return metrics as null values, second will load the metrics data.

      Reporter: Roi Katz
      E-mail: roi.katz@Couchbase.com

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            hakim.cassimally Hakim Cassimally
            roi.katz Roi Katz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty