metrics.go 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. indexCompactionPauseDurations = prometheus.NewHistogram(
  48. prometheus.HistogramOpts{
  49. Namespace: "etcd",
  50. Subsystem: "storage",
  51. Name: "index_compaction_pause_duration_milliseconds",
  52. Help: "Bucketed histogram of index compaction puase duration.",
  53. // 0.5ms -> 1second
  54. Buckets: prometheus.ExponentialBuckets(0.5, 2, 12),
  55. })
  56. dbCompactionPauseDurations = prometheus.NewHistogram(
  57. prometheus.HistogramOpts{
  58. Namespace: "etcd",
  59. Subsystem: "storage",
  60. Name: "db_compaction_pause_duration_milliseconds",
  61. Help: "Bucketed histogram of db compaction puase duration.",
  62. // 1ms -> 4second
  63. Buckets: prometheus.ExponentialBuckets(1, 2, 13),
  64. })
  65. dbCompactionTotalDurations = prometheus.NewHistogram(
  66. prometheus.HistogramOpts{
  67. Namespace: "etcd",
  68. Subsystem: "storage",
  69. Name: "db_compaction_total_duration_milliseconds",
  70. Help: "Bucketed histogram of db compaction total duration.",
  71. // 100ms -> 800second
  72. Buckets: prometheus.ExponentialBuckets(100, 2, 14),
  73. })
  74. )
  75. func init() {
  76. prometheus.MustRegister(rangeCounter)
  77. prometheus.MustRegister(putCounter)
  78. prometheus.MustRegister(deleteCounter)
  79. prometheus.MustRegister(indexCompactionPauseDurations)
  80. prometheus.MustRegister(dbCompactionPauseDurations)
  81. prometheus.MustRegister(dbCompactionTotalDurations)
  82. }