Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add couchdb module #9406

Merged
merged 25 commits into from
Jan 28, 2019
Merged

Add couchdb module #9406

merged 25 commits into from
Jan 28, 2019

Conversation

berfinsari
Copy link
Contributor

No description provided.

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@ruflin ruflin added module review Metricbeat Metricbeat Team:Integrations Label for the Integrations team labels Dec 6, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/infrastructure

@sayden sayden self-assigned this Dec 6, 2018
@berfinsari
Copy link
Contributor Author

Is there anything that I can do for this unsuccessful check?

@ruflin
Copy link
Member

ruflin commented Dec 12, 2018

@berfinsari Try to run make update and make fmt and then push again. This will generate / update a few files.

@berfinsari
Copy link
Contributor Author

I ran make update and make fmt commands and nothing changes. Is there anything else I can do?

@jsoriano
Copy link
Member

@berfinsari you need to run make update fmt from the beats directory so it is applied to all beats. In this case the outdated file is in x-pack/metricbeat/, you can also run make update fmt from this directory.

@berfinsari berfinsari requested a review from a team as a code owner December 14, 2018 15:16
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good, I have added some comments, my main concern is that I am not sure if we should collect all aggregated values or only current values.

metricbeat/module/couchdb/server/_meta/fields.yml Outdated Show resolved Hide resolved
metricbeat/module/couchdb/server/data.go Show resolved Hide resolved
metricbeat/module/couchdb/_meta/test/serverstats.json Outdated Show resolved Hide resolved
@jsoriano
Copy link
Member

@berfinsari btw, I have seen you are also the author of other modules and some community beats for the same services, out of curiosity, do you have some preferences about using specific community beats instead of Metricbeat?

metricbeat/module/couchdb/_meta/test/serverstats.json Outdated Show resolved Hide resolved
"httpd_status_codes": common.MapStr{
"200": common.MapStr{
"description": data.HttpdStatusCodes.Num200.Description,
"current": data.HttpdStatusCodes.Num200.Current,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly means current in this context? Since the last request?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that is the answer of your question, but the fields provide the current, minimum and maximum, and a collection of statistical means and quantities. These statistics produce results that measure the interaction with the server since it was started.

@berfinsari
Copy link
Contributor Author

@jsoriano At the beginning of the process, I was creating community beats for both learning the process and preparing and using it, because there is not so many requirements like the metricbeat module in community beats. When I was keeping contribute to Metricbeat module, I was also keeping create community beats. I guess it is enough to contribute to Metricbeat module.

@jsoriano
Copy link
Member

@jsoriano At the beginning of the process, I was creating community beats for both learning the process and preparing and using it, because there is not so many requirements like the metricbeat module in community beats. When I was keeping contribute to Metricbeat module, I was also keeping create community beats. I guess it is enough to contribute to Metricbeat module.

Sounds good, thanks a lot for your work in these modules!

@sayden
Copy link
Contributor

sayden commented Dec 20, 2018

Please, also write in the docs that this module works with Couchdb and it's not tested with Couchdb 2. While they both maintain a 99% of API compatibility, the amount of metrics you can extract from Couchdb 2 is bigger than in Couchdb 1, for example the shards of the databases or the statistics about Mango queries.

description: >
Example field
fields:
- name: num200
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think fields here should be named just with the number i.e. 200 instead of num200.

@sayden sayden self-requested a review December 20, 2018 10:42
@berfinsari berfinsari requested review from a team as code owners January 8, 2019 18:33
@urso urso removed the request for review from a team January 8, 2019 22:20
metricbeat/module/couchdb/_meta/fields.yml Show resolved Hide resolved

// New creates a new instance of the MetricSet.
func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
cfgwarn.Experimental("The couchdb server metricset is experimental.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can go directly to beta for these metricsets, please update it in the fields files too.

metricbeat/module/couchdb/_meta/docs.asciidoc Show resolved Hide resolved
"github.com/stretchr/testify/assert"
)

const testFile = "../_meta/test/serverstats.json"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used variable.

@@ -0,0 +1,43 @@
"couchdb": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an incomplete JSON? It should start by {. The error in travis seems caused by this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have overlooked this field. I made the correction. I think the error in travis isn't about this. CouchDB returns an error because database does not exist in Docker. This causes the TestFetch() methods in integration tests to fail. I'm trying to fix this error, but I haven't found a solution yet.


func eventMapping(content []byte) common.MapStr {
var data Server
json.Unmarshal(content, &data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for errors here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review. I believe I've addressed all the feedback now.

@@ -0,0 +1,58 @@
{
"@timestamp":"2016-05-23T08:05:34.853Z",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the indentation is off in this file and contains some old fields, I wonder if this was generated or manually created?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated. Should I update this file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, can you generated it again to see if the strange indentation disappears?

Number of HTTP COPY requests

- name: HEAD
type: scaled_float
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these header counters(?) be long instead of float?

HTTP status codes statistics
fields:
- name: "200"
type: scaled_float
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as above: long instead of float?

couchdb statistics
fields:
- name: database_writes
type: scaled_float
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

long? Same for most fields below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed all fields with float to long.

}

/*
// TODO: Enable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be enabled again I assume?

@jsoriano
Copy link
Member

jenkins, test this

@jsoriano jsoriano mentioned this pull request Jan 27, 2019
14 tasks
@jsoriano
Copy link
Member

Thanks @berfinsari! I think we can merge this and continue with follow ups, I have created a new issue to keep track of development of this module (#10354).


def get_hosts(self):
return [os.getenv('COUCHDB_HOST', 'localhost') + ':' +
os.getenv('COUCHDB_PORT', '5894')]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
os.getenv('COUCHDB_PORT', '5894')]
os.getenv('COUCHDB_PORT', '5984')]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be fixed in follow up #10358

@jsoriano jsoriano merged commit 6293568 into elastic:master Jan 28, 2019
@jsoriano
Copy link
Member

Merged, @berfinsari do you happen to have some dashboards you'd like to share too? 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Metricbeat Metricbeat module review Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants