-
Notifications
You must be signed in to change notification settings - Fork 538
[SLI-Metrics] kuberay_service_ready #3577
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: master
Are you sure you want to change the base?
[SLI-Metrics] kuberay_service_ready #3577
Conversation
7b1dcdb
to
a0ef666
Compare
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.
LGTM
Signed-off-by: You-Cheng Lin <[email protected]>
Signed-off-by: You-Cheng Lin <[email protected]>
Signed-off-by: You-Cheng Lin <[email protected]>
891aded
to
b633a37
Compare
@troychiu @kevin85421 Would you mind taking a look? |
Can't we simply reuse collectRayServiceInfo?
|
RayServiceInfo is |
|
@troychiu I get what you meant now. func (c *RayServiceMetricsManager) Collect(ch chan<- prometheus.Metric) {
var rayServiceList rayv1.RayServiceList
if err := c.client.List(context.Background(), &rayServiceList); err != nil {
c.log.Error(err, "Failed to list RayServices")
return
}
for _, rayService := range rayServiceList.Items {
c.collectRayServiceInfo(&rayService, ch)
}
c.RayServiceReady.Collect(ch)
}
func (c *RayServiceMetricsManager) collectRayServiceInfo(service *rayv1.RayService, ch chan<- prometheus.Metric) {
ch <- prometheus.MustNewConstMetric(
c.rayServiceInfo,
prometheus.GaugeValue,
1,
service.Name,
service.Namespace,
)
ready := meta.IsStatusConditionTrue(service.Status.Conditions, string(rayv1.RayServiceReady))
c.RayServiceReady.WithLabelValues(service.Name, service.Namespace, strconv.FormatBool(!ready)).Set(0)
c.RayServiceReady.WithLabelValues(service.Name, service.Namespace, strconv.FormatBool(ready)).Set(1)
} But just to make sure, is this what you're thinking in mind? |
Yeah that's it. Actually we can make it simpler. ch <- prometheus.MustNewConstMetric(
c.rayServiceReady,
prometheus.GaugeValue,
1,
service.Name,
service.Namespace,
condition, // strconv.FormatBool(...) in this case
) and
|
Signed-off-by: You-Cheng Lin <[email protected]>
Signed-off-by: You-Cheng Lin <[email protected]>
Signed-off-by: You-Cheng Lin <[email protected]>
Signed-off-by: You-Cheng Lin <[email protected]>
@@ -27,6 +30,12 @@ func NewRayServiceMetricsManager(ctx context.Context, client client.Client) *Ray | |||
[]string{"name", "namespace"}, | |||
nil, | |||
), | |||
RayServiceReady: prometheus.NewDesc( | |||
"kuberay_service_ready", |
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.
can we use kuberay_service_condition_ready?
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.
RayServiceReady RayServiceConditionType = "Ready" |
kuberay_service_ready
should be enough?
But, I think it's just a matter of choice. Both are fine to me.
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 think it would be more clear. In kube-state-metrics, they use kube_pod_info and kube_pod_status_ready
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.
Updated.
Signed-off-by: You-Cheng Lin <[email protected]>
Cc @kevin85421 PTAL🙏🙏 |
Why are these changes needed?
Added
kuberay_service_ready
as written in KubeRay v1.4.0 SLI proposalRelated issue number
Checks