-
Notifications
You must be signed in to change notification settings - Fork 35
Added ytop_strategy_on_delete_waiting_time_seconds prometheus metric #641
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package metrics | ||
|
|
||
| import ( | ||
| "time" | ||
|
|
||
| "github.com/prometheus/client_golang/prometheus" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ctrlmetrics "sigs.k8s.io/controller-runtime/pkg/metrics" | ||
| ) | ||
|
|
||
| //nolint:gochecknoglobals // Prometheus metrics are package-level for registration and reuse. | ||
| var onDeleteWaitSeconds = prometheus.NewGaugeVec( | ||
| prometheus.GaugeOpts{ | ||
| Namespace: "ytop", | ||
| Subsystem: "update_strategy", | ||
| Name: "on_delete_wait_seconds", | ||
qurname2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Help: "Seconds a component has been waiting in OnDelete mode since the mode started.", | ||
| }, | ||
| []string{"cluster", "component"}, | ||
|
||
| ) | ||
|
|
||
| func init() { | ||
| ctrlmetrics.Registry.MustRegister(onDeleteWaitSeconds) | ||
| } | ||
|
|
||
| func ObserveOnDeleteWait(cluster, component string, startedAt *metav1.Time) { | ||
| lbl := []string{cluster, component} | ||
| if startedAt == nil || startedAt.IsZero() { | ||
| onDeleteWaitSeconds.DeleteLabelValues(lbl...) | ||
| return | ||
| } | ||
| onDeleteWaitSeconds.WithLabelValues(lbl...).Set(time.Since(startedAt.Time).Seconds()) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.