调试
出于调试的目的,可以将查询参数debug=true附加到查询。附加这个参数可以让您在响应的扩展键下检索所有实体的uid属性以及server_latency和start_ts信息。
parsing_ns: 解析查询的延迟(以纳秒为单位)。processing_ns: 处理查询的延迟(以纳秒为单位)。encoding_ns: 对JSON响应进行编码的延迟(以纳秒为单位)。start_ts: 事务的逻辑开始时间戳。
以debug作为查询参数的查询:
curl -H "Content-Type: application/dql" http://localhost:8080/query?debug=true -XPOST -d $'{
tbl(func: allofterms(name@en, "The Big Lebowski")) {
name@en
}
}' | python -m json.tool | less
返回uid和server_latency
{
"data": {
"tbl": [
{
"uid": "0x41434",
"name@en": "The Big Lebowski"
},
{
"uid": "0x145834",
"name@en": "The Big Lebowski 2"
},
{
"uid": "0x2c8a40",
"name@en": "Jeffrey \"The Big\" Lebowski"
},
{
"uid": "0x3454c4",
"name@en": "The Big Lebowski"
}
],
"extensions": {
"server_latency": {
"parsing_ns": 18559,
"processing_ns": 802990982,
"encoding_ns": 1177565
},
"txn": {
"start_ts": 40010
}
}
}
}
注意
GraphQL+-已重命名为Dgraph查询语言(DQL)。虽然application/dql是Content-Type头的首选值,但我们将继续支持Content-Type: application/graphql+-,以避免进行破坏性的更改。