Skip to content

Commit

Permalink
fix: zapi PollData logged the wrong number of instances during batch …
Browse files Browse the repository at this point in the history
…processing (#1366)
  • Loading branch information
cgrinds authored Oct 21, 2022
1 parent 9db5393 commit 4ef9149
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/collectors/zapi/collector/zapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,15 @@ func (z *Zapi) PollData() (map[string]*matrix.Matrix, error) {
z.Logger.Debug().Str("key", key).Msg("removed instance")
}

numInstances := len(mat.GetInstances())
// update metadata
_ = z.Metadata.LazySetValueInt64("api_time", "data", apiT.Microseconds())
_ = z.Metadata.LazySetValueInt64("parse_time", "data", parseT.Microseconds())
_ = z.Metadata.LazySetValueUint64("metrics", "data", count)
_ = z.Metadata.LazySetValueUint64("instances", "data", uint64(len(instances)))
_ = z.Metadata.LazySetValueUint64("instances", "data", uint64(numInstances))
z.AddCollectCount(count)

if len(mat.GetInstances()) == 0 {
if numInstances == 0 {
return nil, errs.New(errs.ErrNoInstance, "")
}

Expand Down

0 comments on commit 4ef9149

Please sign in to comment.