metrics.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2016 The etcd Authors
  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 backend
  15. import "github.com/prometheus/client_golang/prometheus"
  16. var (
  17. commitDurations = prometheus.NewHistogram(prometheus.HistogramOpts{
  18. Namespace: "etcd",
  19. Subsystem: "disk",
  20. Name: "backend_commit_duration_seconds",
  21. Help: "The latency distributions of commit called by backend.",
  22. Buckets: prometheus.ExponentialBuckets(0.001, 2, 14),
  23. })
  24. snapshotDurations = prometheus.NewHistogram(prometheus.HistogramOpts{
  25. Namespace: "etcd",
  26. Subsystem: "disk",
  27. Name: "backend_snapshot_duration_seconds",
  28. Help: "The latency distribution of backend snapshots.",
  29. // 10 ms -> 655 seconds
  30. Buckets: prometheus.ExponentialBuckets(.01, 2, 17),
  31. })
  32. )
  33. func init() {
  34. prometheus.MustRegister(commitDurations)
  35. prometheus.MustRegister(snapshotDurations)
  36. }