I am trying to use Metricbeats couchbase module. I keep getting the below error
Error: %!(EXTRA *json.UnmarshalTypeError=json: cannot unmarshal number 790.2097902097902 into Go struct field BucketBasicStats.opsPerSec of type int64)
I did some research and I see that there is an issue in the below code
[https://github.com/elastic/beats/blob/master/metricbeat/module/couchbase/bucket/data.go]
The metricbeat couchbase module has defined BucketBasicStats Struct as:
type BucketBasicStats struct {
QuotaPercentUsed float64json:"quotaPercentUsed"
OpsPerSec int64json:"opsPerSec"
DiskFetches int64json:"diskFetches"
ItemCount int64json:"itemCount"
DiskUsed int64json:"diskUsed"
DataUsed int64json:"dataUsed"
MemUsed int64json:"memUsed"
}
It is making an assumption that OpsPerSec is an int64 where as it really is a float. Couchbase API pools/default/buckets always returns this field as a float (unless it is 0 !!). Looking at their APIs, they haven't really indicated that this field is an int. This should be a simple enough fix to change the field from int to float in the above module.