elastic / beats

:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
https://www.elastic.co/products/beats
Other
12.08k stars 4.89k forks source link

Support for couchdb 3 #22743

Open raulmartinezr opened 3 years ago

raulmartinezr commented 3 years ago

Hello,

I see couchdb module @metricbeat supports versions 1 and 2. Is there any plan to extend this suppor to version 3, 3.1?

Thanks in advance! Raúl

elasticmachine commented 3 years ago

Pinging @elastic/integrations-services (Team:Services)

hufon commented 3 years ago

Actual state tested with metricbeat 7.7

2020-11-25T12:46:27.103Z ERROR runtime/panic.go:199 recovered from panic while fetching 'couchdb/server' for host 'couchdb-1.couchdb.ippon-doc.svc.cluster.local:5984'. Recovering, but please report this. {"panic": "runtime error: invalid memory address or nil pointer dereference", "stack": "github.com/elastic/beats/v7/libbeat/logp.Recover\n\t/go/src/github.com/elastic/beats/libbeat/logp/global.go:101\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:679\nruntime.panicmem\n\t/usr/local/go/src/runtime/panic.go:199\nruntime.sigpanic\n\t/usr/local/go/src/runtime/signal_unix.go:394\ngithub.com/elastic/beats/v7/metricbeat/module/couchdb/server.(*MetricSet).Fetch\n\t/go/src/github.com/elastic/beats/metricbeat/module/couchdb/server/server.go:101\ngithub.com/elastic/beats/v7/metricbeat/mb/module.(*metricSetWrapper).fetch\n\t/go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:256\ngithub.com/elastic/beats/v7/metricbeat/mb/module.(*metricSetWrapper).startPeriodicFetching\n\t/go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:224\ngithub.com/elastic/beats/v7/metricbeat/mb/module.(*metricSetWrapper).run\n\t/go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:208\ngithub.com/elastic/beats/v7/metricbeat/mb/module.(*Wrapper).Start.func1\n\t/go/src/github.com/elastic/beats/metricbeat/mb/module/wrapper.go:147"}

StephanU commented 3 years ago

This might be easy to solve. It seems like the result format of the couchdb stats endpoints did not change from version 2 to 3 (the release notes do not mentioned changes to the stats endpoints). So I just added another case statement here https://github.com/elastic/beats/blob/master/metricbeat/module/couchdb/server/server.go#L130 like this:

    case 3:
        m.fetcher = &V2{}

and it worked.