-
Notifications
You must be signed in to change notification settings - Fork 698
[SLI Metrics] kuberay_job_execution_duration_seconds #3488
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 11 commits
6696724
37127a7
3b228ef
2e6aeab
fa117cc
c72c9e9
a1ed979
f34a3fb
68fc3ba
92e177e
7ed3761
6005a72
f10ad94
6012415
26dcf56
5b16829
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 |
|---|---|---|
| @@ -1,24 +1,49 @@ | ||
| package metrics | ||
|
|
||
| import ( | ||
| "strconv" | ||
|
|
||
| "github.com/prometheus/client_golang/prometheus" | ||
| ) | ||
|
|
||
| // RayJobMetricsCollector implements the prometheus.Collector interface to collect ray job metrics. | ||
| type RayJobMetricsCollector struct { | ||
| // Metrics | ||
| // RayJobCollector implements the prometheus.Collector and ray.RayJobMetricsCollector interface to collect ray job metrics. | ||
| type RayJobCollector struct { | ||
troychiu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| rayJobExecutionDurationSeconds *prometheus.GaugeVec | ||
| } | ||
|
|
||
| // NewRayJobMetricsCollector creates a new RayJobMetricsCollector instance. | ||
| func NewRayJobMetricsCollector() *RayJobMetricsCollector { | ||
| collector := &RayJobMetricsCollector{} | ||
| // NewRayJobCollector creates a new RayJobCollector instance. | ||
| func NewRayJobCollector() *RayJobCollector { | ||
| collector := &RayJobCollector{ | ||
| rayJobExecutionDurationSeconds: prometheus.NewGaugeVec( | ||
| prometheus.GaugeOpts{ | ||
| Name: "kuberay_job_execution_duration_seconds", | ||
| Help: "Duration from RayJob CR initialization to reaching a terminal state or retrying state, where retrying state indicates the CR was previously failed and backoff is enabled.", | ||
troychiu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| []string{"name", "namespace", "result", "retry_count"}, | ||
|
||
| ), | ||
| } | ||
| return collector | ||
| } | ||
|
|
||
| // Describe implements prometheus.Collector interface Describe method. | ||
| func (c *RayJobMetricsCollector) Describe(_ chan<- *prometheus.Desc) { | ||
| func (c *RayJobCollector) Describe(ch chan<- *prometheus.Desc) { | ||
| c.rayJobExecutionDurationSeconds.Describe(ch) | ||
| } | ||
|
|
||
| // Collect implements prometheus.Collector interface Collect method. | ||
| func (c *RayJobMetricsCollector) Collect(_ chan<- prometheus.Metric) { | ||
| func (c *RayJobCollector) Collect(ch chan<- prometheus.Metric) { | ||
| c.rayJobExecutionDurationSeconds.Collect(ch) | ||
| } | ||
|
|
||
| func (c *RayJobCollector) ObserveRayJobExecutionDuration(name, namespace, result string, retryCount int, duration float64) { | ||
| c.rayJobExecutionDurationSeconds.WithLabelValues(name, namespace, result, strconv.Itoa(retryCount)).Set(duration) | ||
| } | ||
|
|
||
| type RayJobNoopCollector struct{} | ||
troychiu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| func NewRayJobNoopCollector() *RayJobNoopCollector { | ||
| return &RayJobNoopCollector{} | ||
| } | ||
|
|
||
| func (c *RayJobNoopCollector) ObserveRayJobExecutionDuration(_ string, _ string, _ string, _ int, _ float64) { | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.