-
Notifications
You must be signed in to change notification settings - Fork 428
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
PMM-6579 Add monitoring for current and recent slow queries #157
Conversation
Anton Kucherov seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Codecov Report
@@ Coverage Diff @@
## master #157 +/- ##
==========================================
+ Coverage 9.82% 12.18% +2.35%
==========================================
Files 46 47 +1
Lines 2452 2609 +157
==========================================
+ Hits 241 318 +77
- Misses 2178 2250 +72
- Partials 33 41 +8
Continue to review full report at Codecov.
|
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.
Hi @stefano-pogliani . We also use dep
, for backward compatibility. I see new dependencies in go.mod
file. Could you update those dependencies with dep, please?
Also, it would be great if you could add a few tests. At least for GetDatabaseProfilerStats()
and GetDatabaseCurrentOpStats()
methods, but it's up to you.
I have a question. Isn't it possible to have something to show what queries are taking too much to complete? For example, by exporting execution time of queries. I know there is same thing for this PostgreSQL exporter which also exports calls per min. |
Hello @dexterHD,
I am very new to
I will look into adding some tests. |
@alitoufighi you mean the actual query document?
I had a quick look and I'm not sure which bit of the exporter you are referring to. |
Yes. Take a look at this.
Sorry to waste your time, my bad. My colleagues had used its pg_query_stats:
query: "SELECT d.datname, LEFT(s.query, 200) as query, sum(s.calls) as calls, sum(s.total_time) as total_time, min(s.min_time) as min_time, max(s.max_time) as max_time FROM pg_stat_statements s inner join pg_database d on s.dbid = d.oid group by d.datname, LEFT(query, 200) order by sum(calls) desc"
metrics:
- datname:
usage: "LABEL"
description: "Database name"
- query:
usage: "LABEL"
description: "SQL query"
- calls:
usage: "COUNTER"
description: "Number of calls"
- total_time:
usage: "DURATION"
description: "Execution time of query"
- min_time:
usage: "DURATION"
description: "Min execution time of query"
- max_time:
usage: "DURATION"
description: "Max execution time of query" I wonder if there is such utility in MongoDB. I just read about explain.execusionStats(), but it doesn't seem to be able to be used as an automated way for use in monitoring. EDIT: I saw something similar in |
Hi @alitoufighi, The It would be a lot of work (potentially adding significant complexity) to map queries to query shapes. |
819c8b4
to
e4c7613
Compare
Hello @dexterHD 👋 Sorry it took a while but I was finally able to sync |
e4c7613
to
1c65136
Compare
…b_exporter into stefano-pogliani-ops-2023 # Conflicts: # collector/mongodb_collector.go # mongodb_exporter.go # testdata/mongodb_exporter.testFlagHelp.golden
Same demand, I also want this feature to get mongodb slow query. Can add this feature to mongodb_exporter? |
I found this feature in PR Add monitoring for current and recent slow queries , it's open. Can merge this code to master? |
Is anybody here to complete this PR? Performance analysis would be a great step in monitoring. |
Hi. We are currently hard at work on a new, entirely rewritten version of the exporter. Please send PRs to exporter_v2 branch, that will help us integrate it faster. |
Hello PR owner, we are cleaning up the mess with the branches. New mongodb_exporter implementation would be default Please resubmit and resolve any conflicts against the We also moved to the Github Actions from Travis CI, so that would check your code going forward. Thanks, |
If you have a local clone, you can update it by running: git branch -m master release-0.1x |
Do we really want this in the exporter? |
Thank you for your PR. Unfortunately, it does not align with how we collect and use slow queries in PMM. |
@askomorokhov How does PMM collect and use slow queries? Is it pt-mongodb-query-digest? |
Exporting of the system profile collection just got added to the main branch. |
Hello 👋
We would like to monitor queries recorded in the
system.profile
collection and running queries for queries slower then a configurable threshold.This change would add two optional metrics, disabled by default, for slow queries in
system.profile
and for slow queries currently running.I'd be happy to iterate over this if it is of interest.