-
Notifications
You must be signed in to change notification settings - Fork 767
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 metrics to monitor processes by user and host #333
Conversation
Signed-off-by: Peter Löffler <peter.loeffler@runtastic.com>
Signed-off-by: Peter Löffler <peter.loeffler@runtastic.com>
Signed-off-by: Peter Löffler <peter.loeffler@runtastic.com>
collector/info_schema_processlist.go
Outdated
@@ -121,6 +147,52 @@ var ( | |||
} | |||
) | |||
|
|||
func processesByUser(db *sql.DB, ch chan<- prometheus.Metric, query string, i int) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the i int
for? It seems unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I don't think it's necessary to pass the package scope query string
.
I'm wondering if it would be more efficient to change the exporter to dump the process list, and collate the results in Go. This would allow the exporter to execute one query against |
Signed-off-by: Peter Löffler <peter.loeffler@runtastic.com>
Signed-off-by: Peter Löffler <peter.loeffler@runtastic.com>
Only executing one query sounds like a good idea. |
Let's document this feature request in an issue. |
Let me know if #334 is what you're looking for. |
Sounds perfect! |
Can you please have a look to my last commit? |
Nice, looks pretty good. What do you think about keeping a couple bool flags to disable host/user metrics. We can leave them on by default, but some people might have a lot of users/hosts where the cardinality would be too high, but they may still want command/state metrics. |
One more request, please add a CHANGELOG entry. |
Good idea. Is it ok that the additional flags are not listet when calling --help? |
I would probably list them in |
- add additional exporter flags: collect.info_schema.processlist.disable_processes_by_user collect.info_schema.processlist.disable_processes_by_host Signed-off-by: Peter Löffler <peter.loeffler@runtastic.com>
- add additional exporter flags: collect.info_schema.processlist.disable_processes_by_user collect.info_schema.processlist.disable_processes_by_host Signed-off-by: Peter Löffler <peter.loeffler@runtastic.com>
Added the flags + a hopefully proper changelog entry. |
What do you think? Can we merge it? Anything I can do? |
Sorry, got lost in my review pile. |
collector/info_schema_processlist.go
Outdated
@@ -26,6 +32,14 @@ var ( | |||
"collect.info_schema.processlist.min_time", | |||
"Minimum time a thread must be in each state to be counted", | |||
).Default("0").Int() | |||
processesDisableByUserFlag = kingpin.Flag( | |||
"collect.info_schema.processlist.disable_processes_by_user", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer positive flags when possible, to avoid confusing double negatives.
Let's use collect.info_schema.processlist.processes_by_user
, with a default of true. Same for by_host.
This way the disable flag will be --no-collect.info_schema.processlist.processes_by_user
.
Signed-off-by: Peter Löffler <peter.loeffler@runtastic.com>
No problem. Just wanted to know... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Very nice! Thx a lot! |
Added 2 new flags --collect.info_schema.processlist.processes_by_user and --collect.info_schema.processlist.processes_by_host which are needed in addition to --collect.info_schema.processlist.
By using them you get 2 new metrics:
Found it very useful to have this metrics and thought it could be interesting to have it in place for many people.
Closes: #334