-
Notifications
You must be signed in to change notification settings - Fork 39.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101292 from AliceZhang2016/job_controller_metrics
Graduate indexed job to beta
- Loading branch information
Showing
14 changed files
with
143 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
Copyright 2021 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package metrics | ||
|
||
import ( | ||
"sync" | ||
|
||
"k8s.io/component-base/metrics" | ||
"k8s.io/component-base/metrics/legacyregistry" | ||
) | ||
|
||
// JobControllerSubsystem - subsystem name used for this controller. | ||
const JobControllerSubsystem = "job_controller" | ||
|
||
var ( | ||
// JobSyncDurationSeconds tracks the latency of job syncs as | ||
// completion_mode = Indexed / NonIndexed and result = success / error. | ||
JobSyncDurationSeconds = metrics.NewHistogramVec( | ||
&metrics.HistogramOpts{ | ||
Subsystem: JobControllerSubsystem, | ||
Name: "job_sync_duration_seconds", | ||
Help: "The time it took to sync a job", | ||
StabilityLevel: metrics.ALPHA, | ||
Buckets: metrics.ExponentialBuckets(0.001, 2, 15), | ||
}, | ||
[]string{"completion_mode", "result"}, | ||
) | ||
// JobSyncNum tracks the number of job syncs as | ||
// completion_mode = Indexed / NonIndexed and result = success / error. | ||
JobSyncNum = metrics.NewCounterVec( | ||
&metrics.CounterOpts{ | ||
Subsystem: JobControllerSubsystem, | ||
Name: "job_sync_total", | ||
Help: "The number of job syncs", | ||
StabilityLevel: metrics.ALPHA, | ||
}, | ||
[]string{"completion_mode", "result"}, | ||
) | ||
// JobFinishedNum tracks the number of jobs that finish as | ||
// completion_mode = Indexed / NonIndexed and result = failed / succeeded. | ||
JobFinishedNum = metrics.NewCounterVec( | ||
&metrics.CounterOpts{ | ||
Subsystem: JobControllerSubsystem, | ||
Name: "job_finished_total", | ||
Help: "The number of finished job", | ||
StabilityLevel: metrics.ALPHA, | ||
}, | ||
[]string{"completion_mode", "result"}, | ||
) | ||
) | ||
|
||
var registerMetrics sync.Once | ||
|
||
// Register registers Job controller metrics. | ||
func Register() { | ||
registerMetrics.Do(func() { | ||
legacyregistry.MustRegister(JobSyncDurationSeconds) | ||
legacyregistry.MustRegister(JobSyncNum) | ||
legacyregistry.MustRegister(JobFinishedNum) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.