-
Notifications
You must be signed in to change notification settings - Fork 950
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: fix removeImage metric logic #2934
fix: fix removeImage metric logic #2934
Conversation
Signed-off-by: KevinBetterQ <1093850932@qq.com>
Codecov Report
@@ Coverage Diff @@
## master #2934 +/- ##
==========================================
+ Coverage 66.78% 68.11% +1.32%
==========================================
Files 289 291 +2
Lines 18299 18331 +32
==========================================
+ Hits 12221 12486 +265
+ Misses 4645 4383 -262
- Partials 1433 1462 +29
|
LGTM, @KevinBetterQ could you make sure is this feature still be wanted? |
For status monitoring, it is indeed necessary |
@@ -131,7 +131,6 @@ func (s *Server) removeImage(ctx context.Context, rw http.ResponseWriter, req *h | |||
|
|||
label := util_metrics.ActionDeleteLabel | |||
defer func(start time.Time) { | |||
metrics.ImageActionsCounter.WithLabelValues(label).Inc() |
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.
maybe we could judge the return err here to decide how to handle the counter? if err was not found, not add it?
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.
it's more clear I think
|
Hi, thank you very much for your submission. I probably understand your logic, which means that the status monitoring in the original defer may lead to unnecessary statistics of the number of actions, because it may not be returned when the image operation is performed. But I think the logic is understandable, when you call the remove operation, it should cause the operation count to be incremented by 1, not what you changed. |
Signed-off-by: KevinBetterQ 1093850932@qq.com
Ⅰ. Describe what this PR did
fixing the statistical logic of ImageActionsCounter metric when removing image
Ⅱ. Does this pull request fix one issue?
fixes #2923
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
added
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews