-
Notifications
You must be signed in to change notification settings - Fork 200
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
fix(exporter): Handle pool sync time metrics collection gracefully #1616
fix(exporter): Handle pool sync time metrics collection gracefully #1616
Conversation
This PR fixes a bug in pool sync time metrics collector in maya exporter. If last request is in progress, don't queue the current request during pool last Sync time metrics collection and increament the reject request counter. Signed-off-by: mittachaitu <[email protected]>
@@ -68,6 +68,7 @@ type poolSyncMetrics struct { | |||
zpoolLastSyncTime *prometheus.GaugeVec | |||
zpoolStateUnknown *prometheus.GaugeVec | |||
zpoolLastSyncTimeCommandError *prometheus.GaugeVec | |||
zpoolListRequestRejectCounter prometheus.Gauge |
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.
instead of using prometheus.Gauge
, using promethus.Counter
will be better.
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.
Done
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.
gave one comment regarding use of Counter
. Otherwise lgtm
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.
Left a minor comment about name, PTAL
prometheus.GaugeOpts{ | ||
Namespace: "openebs", | ||
Name: "zpool_list_request_reject_count", | ||
Help: "Total no of rejected requests of zpool list", |
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.
Name should be actual command separated by underscore
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.
Done. PTAL
if p.isRequestInProgress() { | ||
p.zpoolListRequestRejectCounter.Inc() | ||
p.Unlock() | ||
p.zpoolListRequestRejectCounter.Collect(ch) |
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 will the above line (line no. 121) do exactly?
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.
Collect is called by the Prometheus registry when collecting
metrics. The implementation sends each collected metric via the
provided channel and returns once the last metric has been sent. The
descriptor of each sent metric is one of those returned by Describe
(unless the Collector is unchecked, see above). Returned metrics that
share the same descriptor must differ in their variable label values.
The above statement is taken Prometheus docs/comments.
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.
Signed-off-by: mittachaitu <[email protected]>
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
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
LGTM |
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.
changes are good
Signed-off-by: mittachaitu [email protected]
What this PR does / why we need it:
This PR fixes a bug in the pool sync time metrics collector in Maya-exporter.
If the last request is in progress, don't queue the current request during pool
last Sync time metrics collection and increment the reject request counter.
Note
This PR is the address comments of #1615.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
UnitTest will be added once after understanding the flow.
Checklist:
documentation
tagbreaking-changes
tagrequires-upgrade
tag