-
Notifications
You must be signed in to change notification settings - Fork 5
Add Prometheus metrics for image push failure alerting #56
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
base: main
Are you sure you want to change the base?
Conversation
@kebe7jun 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: kebe7jun <[email protected]>
Co-authored-by: kebe7jun <[email protected]>
Co-authored-by: kebe7jun <[email protected]>
@kebe7jun 这个pr啥时候能合入哇 |
你帮忙测试 Review 一下? |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #56 +/- ##
==========================================
+ Coverage 22.03% 23.60% +1.57%
==========================================
Files 6 7 +1
Lines 926 953 +27
==========================================
+ Hits 204 225 +21
- Misses 701 706 +5
- Partials 21 22 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This PR implements Prometheus metrics to enable reliable alerting on image push failures in kube-snapshot, addressing the need for explicit, machine-readable indicators of push operations.
Problem
Previously, when image push operations failed (due to registry auth issues, network problems, or other errors), the only way to detect failures was through log parsing or generic task status monitoring. This made it difficult for platform teams to:
Solution
Added comprehensive Prometheus metrics that expose detailed information about image push operations:
New Metrics
snapshot_image_push_total
- Counter tracking all push attempts with labels:namespace
,pod
,image
- Resource identificationstatus
- "success" or "failure"reason
- Failure categorization (auth_error, push_failed, image_not_exists, runtime_error)snapshot_image_push_failures_total
- Counter tracking only failed pushes with detailed failure reasonssnapshot_tasks_total
- Counter tracking task phase transitions (CREATED, COMPLETED, FAILED)Key Features
:8080
Example Usage
Alerting Examples
Implementation Details
internal/metrics
package with Prometheus counter definitionsreconcilePushImage
function to record metrics on success/failure:8080
The implementation provides the explicit, machine-readable indicators requested, enabling platform teams to build reliable monitoring and alerting around image push operations.
Fixes #55.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://storage.googleapis.com/storage/v1/b/kubebuilder-tools/o/kubebuilder-tools-1.30.0-linux-amd64.tar.gz
/home/REDACTED/work/kube-snapshot/kube-snapshot/bin/setup-envtest-release-0.18 use 1.30.0 --bin-dir /home/REDACTED/work/kube-snapshot/kube-snapshot/bin -p path
(http block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.