scheduler_bind_cache_metrics.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. Copyright 2018 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package scheduling
  14. import (
  15. "github.com/prometheus/client_golang/prometheus"
  16. )
  17. // VolumeSchedulerSubsystem - subsystem name used by scheduler
  18. const VolumeSchedulerSubsystem = "scheduler_volume"
  19. var (
  20. // VolumeBindingRequestSchedulerBinderCache tracks the number of volume binder cache operations.
  21. VolumeBindingRequestSchedulerBinderCache = prometheus.NewCounterVec(
  22. prometheus.CounterOpts{
  23. Subsystem: VolumeSchedulerSubsystem,
  24. Name: "binder_cache_requests_total",
  25. Help: "Total number for request volume binding cache",
  26. },
  27. []string{"operation"},
  28. )
  29. // VolumeSchedulingStageLatency tracks the latency of volume scheduling operations.
  30. VolumeSchedulingStageLatency = prometheus.NewHistogramVec(
  31. prometheus.HistogramOpts{
  32. Subsystem: VolumeSchedulerSubsystem,
  33. Name: "scheduling_duration_seconds",
  34. Help: "Volume scheduling stage latency",
  35. Buckets: prometheus.ExponentialBuckets(1000, 2, 15),
  36. },
  37. []string{"operation"},
  38. )
  39. // VolumeSchedulingStageFailed tracks the number of failed volume scheduling operations.
  40. VolumeSchedulingStageFailed = prometheus.NewCounterVec(
  41. prometheus.CounterOpts{
  42. Subsystem: VolumeSchedulerSubsystem,
  43. Name: "scheduling_stage_error_total",
  44. Help: "Volume scheduling stage error count",
  45. },
  46. []string{"operation"},
  47. )
  48. )
  49. // RegisterVolumeSchedulingMetrics is used for scheduler, because the volume binding cache is a library
  50. // used by scheduler process.
  51. func RegisterVolumeSchedulingMetrics() {
  52. prometheus.MustRegister(VolumeBindingRequestSchedulerBinderCache)
  53. prometheus.MustRegister(VolumeSchedulingStageLatency)
  54. prometheus.MustRegister(VolumeSchedulingStageFailed)
  55. }