-
Notifications
You must be signed in to change notification settings - Fork 22
Add hub_template_active_watches
metric
#61
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 hub_template_active_watches
metric
#61
Conversation
85727a9
to
0628595
Compare
// Clean up hub template watch metric | ||
log.V(3).Info("Deleting hub template watch metric") | ||
|
||
metricDeleted := hubTemplateActiveWatchesMetric.Delete(prometheus.Labels{ |
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 you think this would be better in cleanUpPolicy
?
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 put it here so that it would be more visible alongside the other metric setting. I figured that way if we wanted to update it in the future, it'd all be in a single file and a single function.
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.
...but using defer
covers the cleanup case also, right?
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.
Yup since we would just want it to be 0
when there are no more watches and not delete the metric. If we had a watch count per policy, then we would delete the metric when the policy gets deleted.
hubTempWatches := r.DynamicWatcher.GetWatchCount() | ||
log.V(3).Info("Setting hub template watch metric", "value", hubTempWatches) | ||
|
||
gaugeMetric, err := hubTemplateActiveWatchesMetric.GetMetricWith(prometheus.Labels{ |
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.
GetWatchCount
is for all watches and not just the watches for that particular policy.
I do like your idea of being able to distinguish which policy has a lot of watches. Perhaps we could add a method to the dynamic watcher library to accept an ObjectIdentifier
to get the watch count?
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.
The latest changes I have locally use Gauge instead of GaugeVec. I think I need to focus time on my other issues at this point, especially since the cleanup of GaugeVec becomes a little sticky. 🙂
b628c33
to
e7b094c
Compare
Could you please fix the commit message for |
2284420
to
c746829
Compare
Co-authored-by: Matt Prahl <[email protected]> Signed-off-by: Dale Haiducek <[email protected]>
Signed-off-by: Dale Haiducek <[email protected]>
Signed-off-by: Dale Haiducek <[email protected]>
c746829
to
df901ab
Compare
Gauge that records the current number of active watches. ref: stolostron/backlog#25866 Signed-off-by: Dale Haiducek <[email protected]>
df901ab
to
b4ac249
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dhaiducek, mprahl The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Adds a Gauge Vector that records the number of active watches for each root policy.
Addresses: