pbacsko commented on code in PR #641:
URL: https://github.com/apache/yunikorn-core/pull/641#discussion_r1394703211
##########
pkg/metrics/queue.go:
##########
@@ -27,8 +27,10 @@ import (
// QueueMetrics to declare queue metrics
type QueueMetrics struct {
- appMetrics *prometheus.GaugeVec
- ResourceMetrics *prometheus.GaugeVec
+ appMetricsLabel *prometheus.GaugeVec
+ appMetricsSubsystem *prometheus.GaugeVec
+ ResourceMetricsLabel *prometheus.GaugeVec
+ ResourceMetricsSubsystem *prometheus.GaugeVec
Review Comment:
Do we need to export these? If not, just start them with lowercase "r".
##########
pkg/metrics/queue.go:
##########
@@ -72,70 +92,89 @@ func InitQueueMetrics(name string) CoreQueueMetrics {
}
func (m *QueueMetrics) Reset() {
- m.appMetrics.Reset()
- m.ResourceMetrics.Reset()
+ m.appMetricsLabel.Reset()
+ m.appMetricsSubsystem.Reset()
+ m.ResourceMetricsLabel.Reset()
+ m.ResourceMetricsSubsystem.Reset()
}
func (m *QueueMetrics) IncQueueApplicationsRunning() {
- m.appMetrics.With(prometheus.Labels{"state": "running"}).Inc()
+ m.appMetricsLabel.With(prometheus.Labels{"state": "running"}).Inc()
+ m.appMetricsSubsystem.With(prometheus.Labels{"state": "running"}).Inc()
Review Comment:
As far as I understand, `appMetricsSubsystem` will be removed and now it's
kept for backward compatibility. If that's the case, please mark them with `"//
Deprecated"` in the struct, maybe add a short comment as well.
##########
pkg/metrics/queue.go:
##########
@@ -72,70 +92,89 @@ func InitQueueMetrics(name string) CoreQueueMetrics {
}
func (m *QueueMetrics) Reset() {
- m.appMetrics.Reset()
- m.ResourceMetrics.Reset()
+ m.appMetricsLabel.Reset()
+ m.appMetricsSubsystem.Reset()
+ m.ResourceMetricsLabel.Reset()
+ m.ResourceMetricsSubsystem.Reset()
}
func (m *QueueMetrics) IncQueueApplicationsRunning() {
- m.appMetrics.With(prometheus.Labels{"state": "running"}).Inc()
+ m.appMetricsLabel.With(prometheus.Labels{"state": "running"}).Inc()
+ m.appMetricsSubsystem.With(prometheus.Labels{"state": "running"}).Inc()
}
func (m *QueueMetrics) DecQueueApplicationsRunning() {
- m.appMetrics.With(prometheus.Labels{"state": "running"}).Dec()
+ m.appMetricsLabel.With(prometheus.Labels{"state": "running"}).Dec()
+ m.appMetricsSubsystem.With(prometheus.Labels{"state": "running"}).Dec()
+
}
func (m *QueueMetrics) IncQueueApplicationsAccepted() {
- m.appMetrics.With(prometheus.Labels{"state": "accepted"}).Inc()
+ m.appMetricsLabel.With(prometheus.Labels{"state": "accepted"}).Inc()
+ m.appMetricsSubsystem.With(prometheus.Labels{"state": "accepted"}).Inc()
}
func (m *QueueMetrics) IncQueueApplicationsRejected() {
- m.appMetrics.With(prometheus.Labels{"state": "rejected"}).Inc()
+ m.appMetricsLabel.With(prometheus.Labels{"state": "rejected"}).Inc()
+ m.appMetricsSubsystem.With(prometheus.Labels{"state": "rejected"}).Inc()
}
func (m *QueueMetrics) IncQueueApplicationsFailed() {
- m.appMetrics.With(prometheus.Labels{"state": "failed"}).Inc()
+ m.appMetricsLabel.With(prometheus.Labels{"state": "failed"}).Inc()
+ m.appMetricsSubsystem.With(prometheus.Labels{"state": "failed"}).Inc()
}
func (m *QueueMetrics) IncQueueApplicationsCompleted() {
- m.appMetrics.With(prometheus.Labels{"state": "completed"}).Inc()
+ m.appMetricsLabel.With(prometheus.Labels{"state": "completed"}).Inc()
+ m.appMetricsSubsystem.With(prometheus.Labels{"state":
"completed"}).Inc()
}
func (m *QueueMetrics) IncAllocatedContainer() {
- m.appMetrics.With(prometheus.Labels{"state": "allocated"}).Inc()
+ m.appMetricsLabel.With(prometheus.Labels{"state": "allocated"}).Inc()
+ m.appMetricsSubsystem.With(prometheus.Labels{"state":
"allocated"}).Inc()
}
func (m *QueueMetrics) IncReleasedContainer() {
- m.appMetrics.With(prometheus.Labels{"state": "released"}).Inc()
+ m.appMetricsLabel.With(prometheus.Labels{"state": "released"}).Inc()
+ m.appMetricsSubsystem.With(prometheus.Labels{"state": "released"}).Inc()
}
func (m *QueueMetrics) SetQueueGuaranteedResourceMetrics(resourceName string,
value float64) {
- m.ResourceMetrics.With(prometheus.Labels{"state": "guaranteed",
"resource": resourceName}).Set(value)
+ m.ResourceMetricsLabel.With(prometheus.Labels{"state": "guaranteed",
"resource": resourceName}).Set(value)
+ m.ResourceMetricsSubsystem.With(prometheus.Labels{"state":
"guaranteed", "resource": resourceName}).Set(value)
Review Comment:
Same here, if `ResourceMetricsSubsystem` will be removed, add a comment in
the struct.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]