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":
|
||||
stats["id"] = bson.ObjectIdHex(value)
|
||||
case key == "ids":
|
||||
var objectIds []bson.ObjectId
|
||||
ids := strings.Split(value, "/")
|
||||
objectIds := make([]bson.ObjectId, len(ids))
|
||||
for i, id := range ids {
|
||||
objectIds[i] = bson.ObjectIdHex(id)
|
||||
for _, id := range ids {
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
objectIds = append(objectIds, bson.ObjectIdHex(id))
|
||||
}
|
||||
stats["ids"] = objectIds
|
||||
stats["id"] = objectIds[0]
|
||||
|
|
Reference in a new issue