blakelead / couchbase_exporter

Export metrics from Couchbase Server for Prometheus consumption
Other
35 stars 18 forks source link

json error #36

Closed bennydubois closed 5 years ago

bennydubois commented 5 years ago

exporter version 0.7.0 (compiled binary not in a container) couchbase version: 5.0.1

The exporter is handing out metrics BUT throws some errors on various servers:

level=error msg="json: cannot unmarshal number 530.5305305305305 into Go struct field .cmd_get of type int" level=error msg="json: cannot unmarshal number 8.998001998001998 into Go struct field .diskFetches of type int" level=error msg="json: cannot unmarshal object into Go struct field BucketData.autoCompactionSettings of type bool"

blakelead commented 5 years ago

Hello @bennydubois,

Thanks for reporting this issue! I'll check it asap.

blakelead commented 5 years ago

Hello @bennydubois,

It seems that your are not using version 0.7.0 but 0.2.1 or lower. Indeed, metric autoCompactionSettings does not exist since 0.3.0.

Could you please check again ?

mozai commented 5 years ago

I am using couchbase_exporter version 0.7.0 and I'm getting "json: cannot unmarshal object into Go struct field BucketData.autoCompactionSettings of type bool".

Asking couchbase myself (version 5.0.1) I can see sometimes the per-bucket "autoCompactionSettings" is a bool, and sometimes it's an object. By setting log.level=debug I can see the query is level=debug msg="GET http://localhost:8091/pools/default/buckets so I can try that query myself and see what data types I get in response.

curl -su "$CBUSER:$CBPASS" http://localhost:8091/pools/default/buckets |jq -S '.[].autoCompactionSettings'

false
false
{
  "allowedTimePeriod": {
    "abortOutside": true,
    "fromHour": 3,
    "fromMinute": 1,
    "toHour": 9,
    "toMinute": 1
  },
  "databaseFragmentationThreshold": {
    "percentage": 30,
    "size": "undefined"
  },
  "parallelDBAndViewCompaction": true,
  "viewFragmentationThreshold": {
    "percentage": 30,
    "size": "undefined"
  }
}

Sometimes it's a boolean, sometimes it's an object.

You told someone else he isn't really using version 0.7.0 -- I think I'm using 0.7.0 but maybe I'm mistaken. Is there a way to provoke couchbase_exporter to tell me its version number? The logfile on startup (even with log.level=debug) only tells me the version of couchbase I'm talking to (5.0.1), not the version of the exporter.

mozai commented 5 years ago

Nevermind about the version # I can see in the latest couchbase_exporter.go that it will dump the version # and current config set to the log at level=info .

blakelead commented 5 years ago

Hello @mozai,

Exactly, the version should be outputted in the logs (I added this log in version 0.6.0 I believe).

With the Docker version, I have the correct version output, and the exporter doesn't scrape for autoCompactionSettings attribute. Same thing with the binary version, and when I get the sources for 0.7.0 from the release page, I don't find any trace of autoCompactionSettings.

How did you get the exporter? Do you see level=info msg="Couchbase Exporter Version: 0.7.0" in your logs?

mozai commented 5 years ago

It was bestowed by a predecessor, who packaged it in a .deb saying it was version 0.7.0. I can't tell what version it really is. Maybe it's a plain string in the compiled binary... nope.

Close this ticket; we can safely assume I'm not using version 0.9.0 (the latest version today). If I still have the problem after deploying v0.9.0 I'll come back.

blakelead commented 5 years ago

Alright, please do that. Closing the ticket