Azure cosmosdb 如何获取CosmosDB图形集合上请求的度量?

Azure cosmosdb 如何获取CosmosDB图形集合上请求的度量?,azure-cosmosdb,Azure Cosmosdb,我想了解有关Gremlim查询的详细信息-因此我将FeedOptions参数的PopulateQueryMetrics属性设置为true 但是我返回的FeedResponse对象没有填充QueryMetrics属性 var queryString = $"g.addV('{d.type}').property('id', '{d.Id}')"; var query = client.CreateGremlinQuery<dynamic>(graphCollection, queryS

我想了解有关Gremlim查询的详细信息-因此我将
FeedOptions
参数的
PopulateQueryMetrics
属性设置为
true

但是我返回的
FeedResponse
对象没有填充
QueryMetrics
属性

var queryString = $"g.addV('{d.type}').property('id', '{d.Id}')";
var query = client.CreateGremlinQuery<dynamic>(graphCollection, queryString,
    new FeedOptions {
        PopulateQueryMetrics = true
    });
while (query.HasMoreResults)
{
    FeedResponse<dynamic> response = await query.ExecuteNextAsync();
    //response.QueryMetrics is null
}
var queryString=$“g.addV('{d.type}').property('id','{d.id}')”;
var query=client.CreateGremlinQuery(graphCollection、queryString、,
新的饲料选择{
PopulateQueryMetrics=true
});
while(query.HasMoreResults)
{
FeedResponse=wait query.ExecuteNextAsync();
//response.QueryMetrics为空
}

我遗漏了什么吗?

根据您的描述,我用Gremlin(graph)API创建了我的Azure Cosmos DB帐户,我可能会遇到与您提到的相同的问题。我找到了一个教程并阅读了调试为什么查询运行缓慢一节,如下所示:

在SQL API SDK中,Azure Cosmos DB提供查询执行统计信息

IDocumentQuery=client.CreateDocumentQuery(
CreateDocumentCollectionUri(DatabaseName,CollectionName),
“从c中选择*,其中c.city=‘西雅图’”,
新的饲料选择
{ 
PopulateQueryMetrics=真,
MaxItemCount=-1,
MaxDegreeOfParallelism=-1,
EnableCrossPartitionQuery=true
}).AsDocumentQuery();
FeedResponse结果=等待查询。ExecuteExtAsync();
//按分区键范围Id返回度量
IReadOnlyDictionary metrics=result.QueryMetrics;
然后,我通过上面的SQL API查询了我的Cosmos DB Gremlin(graph)帐户,我检索了
QueryMetrics
,如下所示:

注意:我还检查了是否可以像下面这样指定SQL表达式
SELECT*FROM c,其中c.id='thomas'和c.label='person'
。对于添加新顶点,我不知道如何构造SQL表达式。此外,
CreateDocumentAsync
方法不支持
FeedOptions
参数

据我所知,
PopulateQueryMetrics
设置可能仅在使用SQL API时起作用。您可以添加您的反馈