zhuqi-lucas commented on code in PR #951:
URL: https://github.com/apache/yunikorn-core/pull/951#discussion_r1722811773
##########
pkg/metrics/scheduler.go:
##########
@@ -241,27 +241,49 @@ func (m *SchedulerMetrics) GetSchedulingErrors() (int,
error) {
return -1, err
}
+func (m *SchedulerMetrics) IncTotalApplicationsNew() {
+ m.applicationSubmission.WithLabelValues(AppNew).Inc()
+}
+
+func (m *SchedulerMetrics) DecTotalApplicationsNew() {
+ m.applicationSubmission.WithLabelValues(AppNew).Dec()
+}
+
+func (m *SchedulerMetrics) GetTotalApplicationsNew() (int, error) {
+ metricDto := &dto.Metric{}
+ err := m.applicationSubmission.WithLabelValues(AppNew).Write(metricDto)
+ if err == nil {
+ return int(*metricDto.Gauge.Value), nil
+ }
+ return -1, err
+}
+
func (m *SchedulerMetrics) IncTotalApplicationsAccepted() {
m.applicationSubmission.WithLabelValues(AppAccepted).Inc()
}
-func (m *SchedulerMetrics) AddTotalApplicationsAccepted(value int) {
- m.applicationSubmission.WithLabelValues(AppAccepted).Add(float64(value))
+func (m *SchedulerMetrics) DecTotalApplicationsAccepted() {
+ m.applicationSubmission.WithLabelValues(AppAccepted).Dec()
}
-func (m *SchedulerMetrics) IncTotalApplicationsRejected() {
- m.applicationSubmission.WithLabelValues(ContainerRejected).Inc()
+func (m *SchedulerMetrics) GetTotalApplicationsAccepted() (int, error) {
+ metricDto := &dto.Metric{}
+ err :=
m.applicationSubmission.WithLabelValues(AppAccepted).Write(metricDto)
+ if err == nil {
+ return int(*metricDto.Gauge.Value), nil
+ }
+ return -1, err
}
-func (m *SchedulerMetrics) AddTotalApplicationsRejected(value int) {
-
m.applicationSubmission.WithLabelValues(ContainerRejected).Add(float64(value))
Review Comment:
The name was wrong, it should be applicationReject, and also remove this
logic because it will be all handled in state machine changes, it will be
duplicated.
--
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]