metric:tag
http://localhost:4242/api/search/lookup?m=system.disk.in_use{uid=1}
http://localhost:4242/api/search/lookup?m=*{uid=1}
http://localhost:4242/api/query?start=1h-ago&m=sum:rate:system.disk.in_use{uid=1}
//第一个tag是 groupby的 如果不groupby第一个请用{} http://localhost:4242/api/query?start=1h-ago&m=sum:rate:1m-sum-null:system.disk.in_use{host=cfeng|wangxh.pc,device=*}{uid=1}&show_query=true&show_summary=true http://localhost:4242/api/query?start=1h-ago&m=sum:rate:1m-sum-null:system.disk.in_use{host=wangxh.pc,device=*}{uid=1}&m=sum:rate:1m-sum-null:system.disk.in_use{host=cfeng,device=*}{uid=1}&show_query=true&show_summary=true
https://app.datadoghq.com/series/batch_query
requests[0][from]:1487290901859 requests[0][to]:1487294501859 requests[0][interval]:20 requests[0][q]:avg:system.cpu.user{} by {host} + avg:cacti.hosts.count{} by {lv}, avg:cacti.hosts.count{} by {lv} requests[0][aggregator]:avg requests[0][type]:line requests[1][from]:1487290901859 requests[1][to]:1487294501859 requests[1][interval]:20 requests[1][q]:avg:system.core.count{} by {host} + avg:cacti.hosts.count{} by {lv}, avg:cacti.hosts.count{} by {lv} requests[1][aggregator]:avg requests[1][type]:line _authentication_token:f89dcfc0531c10bed68ae38662da53a65f2387d2
handleQuery
{
data_query.buildQueriesAsync(tsdb).addCallback(new BuildCB())
.addErrback(new ErrorCB());
}
BuildCB
runAsync
findSpans
根据tagv进行模糊查询处理
好,问题来了。
查询数据是[uid=1 host=wang*]
查询数据是[host=wangxh1].
为什么?
因为首先他会把host=wangxh1进行数据模糊查询,正则匹配,这时候非wangxh1的不会提取出来;然后再进行wildcard的数据过滤,发现wangxh1命中,那么数据就只有wangxh1。
上面结果为空
因为首先进行wangxh1正则查询,出来的数据还要进行error的模糊匹配,最后命中不了,结果为空。