Closed amrishraje closed 3 years ago
I also worked with couchbase to get their position on what their /pools/default/buckets
API is returning. Their response is documented below. Based on JSON spec, the API is returning a numeric type which can be both an int or a float. We should not interpret it as an int64 in the metricbeat couchbase module.
From the initial review of your request, please find our below answers - The issue is that couchbase returns the basicStats.opsPerSec field as a float instead of int. Couchbase returns the basicStats.opsPerSec field as numeric type which is in JSON schema. As per JSON Schema documentation, the type number can either be integers or floating point numbers. Also in the provided documentation, we would like to let you know that we do not explicitly see that the return value is of type
int
only. Hence we would like to re-iterate that the return value should be interpreted asnumeric
type which can be either integers or floating point numbers. We hope this answers your request. Please let us know if you have further questions regarding this and we're glad to help.
Pinging @elastic/integrations-services (Team:Services)
The referenced commit makes this look like it's fixed in 7.8, but I've just tried with that version and we get the same issues.
ERROR node/data.go:80 Error: json: cannot unmarshal number 2.002002002002002 into Go struct field NodeInterestingStats.nodes.interestingStats.cmd_get of type int64
ERROR bucket/data.go:53 Error: json: cannot unmarshal number 10.004004004004 into Go struct field BucketBasicStats.basicStats.opsPerSec of type int64
I can confirm, we fix a different field but we left this one. It's not ideal to parse everything as double
in Elasticsearch (it uses more space at the end) but the fact that JSON don't differentiate their numeric
type between integer or floating point will force Beats to assume that everything can be potentially a double
type.
Not sure if this is related, but using logstash with filebeat/metricbeat consistently results in "0" being interpreted as an int.
I've even seen "0.0" get converted to "0" int, until a new index rolls around and the value is a non-zero non-integer.
This is for schemaless data with no templates in ES. The root cause is most certainly JSON not distinguishing float from int in Numeric.
Please refer to below post: https://discuss.elastic.co/t/couchbase-module-throws-json-parse-exception-on-basicstats-opspersec/235455
Issue: Metricbeat Couchbase module throws the below error
Error: %!(EXTRA *json.UnmarshalTypeError=json: cannot unmarshal number 790.2097902097902 into Go struct field BucketBasicStats.opsPerSec of type int64)
Issue is in the data.go file. The code makes an assumption that couchbase API
pools/default/buckets
returns an int where as it actually returns a float. I have checked this with version 5.x and 6.x of couchbase.I see this issue with metricbeat version 6.8.3 (amd64), libbeat 6.8.3 running on RHEL 7.7
Error Details: