[coordinator] Topk aggregation got NaN values
Problem
Use m3_stack/start_m3.sh to setup local m3cluster. Then query topk(1, go_goroutines) got many datapoint, but just want one datapoint.
use the following command
curl http://localhost:7201/api/v1/query_range\?query\=topk\(1%2C%20go_goroutines\)\&start\=1540796580\&end\=1540796670\&step\=60
got these:
{
"status": "success",
"data": {
"resultType": "matrix",
"result": [
{
"metric": {
"__name__": "go_goroutines",
"instance": "localhost:9090",
"job": "prometheus",
"role": "remote"
},
"values": [
[
1540796580,
"NaN"
],
[
1540796640,
"NaN"
]
],
"step_size_ms": 60000
},
{
"metric": {
"__name__": "go_goroutines",
"instance": "m3coordinator01:7203",
"job": "coordinator",
"role": "remote"
},
"values": [
[
1540796580,
"NaN"
],
[
1540796640,
"NaN"
]
],
"step_size_ms": 60000
},
{
"metric": {
"__name__": "go_goroutines",
"instance": "m3db_seed:7203",
"job": "dbnode",
"role": "remote"
},
"values": [
[
1540796580,
"8979"
],
[
1540796640,
"9022"
]
],
"step_size_ms": 60000
}
]
}
}
But query from prometheus, use the same command but with prometheus port that is 9090, got these result:
{
"status": "success",
"data": {
"resultType": "matrix",
"result": [
{
"metric": {
"__name__": "go_goroutines",
"instance": "m3db_seed:7203",
"job": "dbnode"
},
"values": [
[
1540796580,
"8979"
],
[
1540796640,
"9022"
]
]
}
]
}
}
Expect Result:
Like prometheus result, ignore the NaN value, empty metric.
Version
Latest Commit: c27cff0cbceab9fc2c1af85d338e869b9d66c5b3
We can check for all NaNs in a series and skip adding it to the list of series to be rendered. The other option would be to add a filter during rendering results to json. However, the first option should be more optimal.
https://github.com/m3db/m3/blob/master/src/query/api/v1/handler/prometheus/native/read.go#L237
any update on this one?