Skip the empty ids on the stats gatherer
This commit is contained in:
parent
9234c71bd5
commit
a2c8097dc7
1 changed files with 6 additions and 3 deletions
9
stats.go
9
stats.go
|
@ -62,10 +62,13 @@ func appendMuxVars(vars map[string]string, stats map[string]interface{}) {
|
||||||
case key == "id":
|
case key == "id":
|
||||||
stats["id"] = bson.ObjectIdHex(value)
|
stats["id"] = bson.ObjectIdHex(value)
|
||||||
case key == "ids":
|
case key == "ids":
|
||||||
|
var objectIds []bson.ObjectId
|
||||||
ids := strings.Split(value, "/")
|
ids := strings.Split(value, "/")
|
||||||
objectIds := make([]bson.ObjectId, len(ids))
|
for _, id := range ids {
|
||||||
for i, id := range ids {
|
if id == "" {
|
||||||
objectIds[i] = bson.ObjectIdHex(id)
|
continue
|
||||||
|
}
|
||||||
|
objectIds = append(objectIds, bson.ObjectIdHex(id))
|
||||||
}
|
}
|
||||||
stats["ids"] = objectIds
|
stats["ids"] = objectIds
|
||||||
stats["id"] = objectIds[0]
|
stats["id"] = objectIds[0]
|
||||||
|
|
Reference in a new issue