-
Notifications
You must be signed in to change notification settings - Fork 425
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
Export currentOP uptime query metrics #706
Export currentOP uptime query metrics #706
Conversation
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.
Thanks @tregubov-av,
Looks good to me.
Could you please sign the CLA?
exporter/currentop_collector.go
Outdated
opid, ok := bsonMapElement["opid"].(int32) | ||
if !ok { | ||
logger.Errorf("Invalid type int32 assertion for 'opid': %t", ok) | ||
break | ||
} | ||
namespace, ok := bsonMapElement["ns"].(string) | ||
if !ok { | ||
logger.Errorf("Invalid type string assertion for 'ns': %t", ok) | ||
break | ||
} | ||
db, collection := splitNamespace(namespace) | ||
op, ok := bsonMapElement["op"].(string) | ||
if !ok { | ||
logger.Errorf("Invalid type string assertion for 'op': %t", ok) | ||
break | ||
} | ||
decs, ok := bsonMapElement["desc"].(string) | ||
if !ok { | ||
logger.Errorf("Invalid type string assertion for 'desc': %t", ok) | ||
break | ||
} | ||
microsecs_running, ok := bsonMapElement["microsecs_running"].(int64) | ||
if !ok { | ||
logger.Errorf("Invalid type int64 assertion for 'microsecs_running': %t", ok) | ||
break | ||
} |
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.
do we really need all these assertions?
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 think for a more flexible construction of alerts, you need to have a sufficient number of labels.
In this case, you have to use type assertion to get the values from the interface.
But I don't want to panic if the code fails.
If there are suggestions on how to do better, I'm ready to rewrite this part
1db5977
to
58d79a2
Compare
This is weird... P.S. |
58d79a2
to
0d1ce9d
Compare
Hi @tregubov-av, yeah, problem isn't in your PR. We started having this problem for all PRs recently and thanks for inputs. we will try to fix that. |
Co-authored-by: Artem Gavrilov <[email protected]>
4d53667
to
9b84b52
Compare
9b84b52
to
329e8e6
Compare
👍 |
Resolves: #704
This is the implementation of the collector for notifications about too long requests are in processed.
For example: