metrics.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (C) 2017 Dgraph Labs, Inc. and Contributors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package y
  17. import "expvar"
  18. var (
  19. // LSMSize has size of the LSM in bytes
  20. LSMSize *expvar.Map
  21. // VlogSize has size of the value log in bytes
  22. VlogSize *expvar.Map
  23. // PendingWrites tracks the number of pending writes.
  24. PendingWrites *expvar.Map
  25. // These are cumulative
  26. // NumReads has cumulative number of reads
  27. NumReads *expvar.Int
  28. // NumWrites has cumulative number of writes
  29. NumWrites *expvar.Int
  30. // NumBytesRead has cumulative number of bytes read
  31. NumBytesRead *expvar.Int
  32. // NumBytesWritten has cumulative number of bytes written
  33. NumBytesWritten *expvar.Int
  34. // NumLSMGets is number of LMS gets
  35. NumLSMGets *expvar.Map
  36. // NumLSMBloomHits is number of LMS bloom hits
  37. NumLSMBloomHits *expvar.Map
  38. // NumGets is number of gets
  39. NumGets *expvar.Int
  40. // NumPuts is number of puts
  41. NumPuts *expvar.Int
  42. // NumBlockedPuts is number of blocked puts
  43. NumBlockedPuts *expvar.Int
  44. // NumMemtableGets is number of memtable gets
  45. NumMemtableGets *expvar.Int
  46. )
  47. // These variables are global and have cumulative values for all kv stores.
  48. func init() {
  49. NumReads = expvar.NewInt("badger_disk_reads_total")
  50. NumWrites = expvar.NewInt("badger_disk_writes_total")
  51. NumBytesRead = expvar.NewInt("badger_read_bytes")
  52. NumBytesWritten = expvar.NewInt("badger_written_bytes")
  53. NumLSMGets = expvar.NewMap("badger_lsm_level_gets_total")
  54. NumLSMBloomHits = expvar.NewMap("badger_lsm_bloom_hits_total")
  55. NumGets = expvar.NewInt("badger_gets_total")
  56. NumPuts = expvar.NewInt("badger_puts_total")
  57. NumBlockedPuts = expvar.NewInt("badger_blocked_puts_total")
  58. NumMemtableGets = expvar.NewInt("badger_memtable_gets_total")
  59. LSMSize = expvar.NewMap("badger_lsm_size_bytes")
  60. VlogSize = expvar.NewMap("badger_vlog_size_bytes")
  61. PendingWrites = expvar.NewMap("badger_pending_writes_total")
  62. }