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

[Metricbeat] new uWSGI module #6006

Merged
merged 6 commits into from
Jan 9, 2018
Merged

[Metricbeat] new uWSGI module #6006

merged 6 commits into from
Jan 9, 2018

Conversation

iahmedov
Copy link
Contributor

@iahmedov iahmedov commented Jan 6, 2018

This adds uWSGI server monitoring metrics.

  • docs asciidoc
  • fields
  • dashboard
  • unit tests
  • integration tests
  • system tests

uwsgi_dashboard

@elasticmachine
Copy link
Collaborator

Can one of the admins verify this patch?

}
}

func NewModule(base mb.BaseModule) (mb.Module, error) {

Choose a reason for hiding this comment

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

exported function NewModule should have comment or be unexported

return env
}

func GetEnvHTTPServer() string {

Choose a reason for hiding this comment

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

exported function GetEnvHTTPServer should have comment or be unexported


import "os"

func GetEnvTCPServer() string {

Choose a reason for hiding this comment

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

exported function GetEnvTCPServer should have comment or be unexported

Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

Awesome contribution, thank you! 🎉

I left a few comments, @ruflin may have some more comments about fields.yml

@@ -0,0 +1,7 @@
- module: uwsgi
metricsets: ["status"]
enabled: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you remove enabled here? we use the default now (true), as this is handled by modules subcommand

period: 10s
hosts: ["tcp://127.0.0.1:9191"]


Copy link
Contributor

Choose a reason for hiding this comment

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

some spurious empty lines here

type: long
description: >
Number of requests served
- name: core.static_requests
Copy link
Contributor

@exekias exekias Jan 8, 2018

Choose a reason for hiding this comment

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

Sounds like you could group requests like: requests.total, requests.static, requests.routed, etc...

}

// New creates a new instance of the MetricSet.
func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add an Experimental warning here? Something like:

cfgwarn.Experimental("The uWSGI status metricset is experimental")

@exekias
Copy link
Contributor

exekias commented Jan 8, 2018

jenkins, test it

@iahmedov
Copy link
Contributor Author

iahmedov commented Jan 8, 2018

Thanks @exekias for review, made requested changes

"read_errors": 0,
"pid": 1
},

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you generate this file or add it manually? I kind of wonder how this newline here happened.

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 made this file manually, actually uwsgi.status contains only one of the nested fields (total, worker or core)

Copy link
Contributor

Choose a reason for hiding this comment

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

Normally we generate these fields automatically with one of the tests like here for example: https://github.com/elastic/beats/blob/master/metricbeat/module/kibana/status/status_integration_test.go#L27 Like this we assure that the file stays up-to-date if we change mappings. Perhaps you could open a follow up PR with a file that is auto generated?

Copy link
Contributor

@ruflin ruflin 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 great stuff. Thanks a lot for adding dashboards, tests etc.

Could you add a CHANGELOG entry?

I left some thoughts on the field naming. But I rather get this PR in and see how it works and do some potential adaptions in a follow up PR before we make it beta/GA.

description: >
uwsgi.status metricset fields
fields:
- name: total.requests
Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably turn around the namespacing as I thinkrequests is the namespace and total only describes which values it is in the requests namespace. Same below like:

errors.write.total
errors.read.total

and others.

Copy link
Contributor Author

@iahmedov iahmedov Jan 9, 2018

Choose a reason for hiding this comment

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

total was kind of summary for all workers, it has requests, exceptions, read, write errors, if I turnaround total.requests, can you suggest naming for summary data?

current structure is as below

"total": {
  "requests": 102,
  "exceptions": 1,
  "write_errors": 0,
  "read_errors": 0,
  "pid": 1
}

turned around might look like this

"summary": {
  "requests": {
     "total": 102
  },
  "exceptions": 1,
  "errors": {
    "write": {
       "total" : 0
    },
    "read": {
       "total" : 0
    },
  }
  "pid": 1
}

feels like to much overhead, but if it is considered as more readable I welcome the changes.
I appreciate if you suggest better structure for summary data.

Copy link
Contributor

Choose a reason for hiding this comment

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

In general my approach is going from the generic one to the more detailed. So in the above case I think a user might first search for an error and then he can decide if writes or reads. I would assume he does not look at the document and think "I need a total" and then check what is inside total. But I'm pretty sure it could be argued the other way around :-)

@ruflin
Copy link
Contributor

ruflin commented Jan 9, 2018

jenkins, test it

@exekias
Copy link
Contributor

exekias commented Jan 9, 2018

jenkins, test it please

@exekias exekias merged commit 8a3365f into elastic:master Jan 9, 2018
@exekias
Copy link
Contributor

exekias commented Jan 9, 2018

Merging it now, thank you so much for this awesome module! As @ruflin said, we can open follow up PRs to tweak field names

@iahmedov
Copy link
Contributor Author

Thank you @exekias @ruflin for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants