metrics.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // Copyright 2015 CoreOS, Inc.
  2. //
  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. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package storage
  15. import (
  16. "github.com/coreos/etcd/Godeps/_workspace/src/github.com/prometheus/client_golang/prometheus"
  17. )
  18. var (
  19. rangeCounter = prometheus.NewCounter(
  20. prometheus.CounterOpts{
  21. Namespace: "etcd",
  22. Subsystem: "storage",
  23. Name: "range_total",
  24. Help: "Total number of ranges seen by this member.",
  25. })
  26. putCounter = prometheus.NewCounter(
  27. prometheus.CounterOpts{
  28. Namespace: "etcd",
  29. Subsystem: "storage",
  30. Name: "put_total",
  31. Help: "Total number of puts seen by this member.",
  32. })
  33. deleteCounter = prometheus.NewCounter(
  34. prometheus.CounterOpts{
  35. Namespace: "etcd",
  36. Subsystem: "storage",
  37. Name: "delete_total",
  38. Help: "Total number of deletes seen by this member.",
  39. })
  40. txnCounter = prometheus.NewCounter(
  41. prometheus.CounterOpts{
  42. Namespace: "etcd",
  43. Subsystem: "storage",
  44. Name: "txn_total",
  45. Help: "Total number of txns seen by this member.",
  46. })
  47. keysGauge = prometheus.NewGauge(
  48. prometheus.GaugeOpts{
  49. Namespace: "etcd",
  50. Subsystem: "storage",
  51. Name: "keys_total",
  52. Help: "Total number of keys.",
  53. })
  54. indexCompactionPauseDurations = prometheus.NewHistogram(
  55. prometheus.HistogramOpts{
  56. Namespace: "etcd",
  57. Subsystem: "storage",
  58. Name: "index_compaction_pause_duration_milliseconds",
  59. Help: "Bucketed histogram of index compaction puase duration.",
  60. // 0.5ms -> 1second
  61. Buckets: prometheus.ExponentialBuckets(0.5, 2, 12),
  62. })
  63. dbCompactionPauseDurations = prometheus.NewHistogram(
  64. prometheus.HistogramOpts{
  65. Namespace: "etcd",
  66. Subsystem: "storage",
  67. Name: "db_compaction_pause_duration_milliseconds",
  68. Help: "Bucketed histogram of db compaction puase duration.",
  69. // 1ms -> 4second
  70. Buckets: prometheus.ExponentialBuckets(1, 2, 13),
  71. })
  72. dbCompactionTotalDurations = prometheus.NewHistogram(
  73. prometheus.HistogramOpts{
  74. Namespace: "etcd",
  75. Subsystem: "storage",
  76. Name: "db_compaction_total_duration_milliseconds",
  77. Help: "Bucketed histogram of db compaction total duration.",
  78. // 100ms -> 800second
  79. Buckets: prometheus.ExponentialBuckets(100, 2, 14),
  80. })
  81. )
  82. func init() {
  83. prometheus.MustRegister(rangeCounter)
  84. prometheus.MustRegister(putCounter)
  85. prometheus.MustRegister(deleteCounter)
  86. prometheus.MustRegister(txnCounter)
  87. prometheus.MustRegister(keysGauge)
  88. prometheus.MustRegister(indexCompactionPauseDurations)
  89. prometheus.MustRegister(dbCompactionPauseDurations)
  90. prometheus.MustRegister(dbCompactionTotalDurations)
  91. }