浏览代码

ethdb: fully disable metrics if not requested (oops?)

Péter Szilágyi 9 年之前
父节点
当前提交
f1ddb1a7ad
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      ethdb/database.go

+ 4 - 0
ethdb/database.go

@@ -168,6 +168,10 @@ func (self *LDBDatabase) LDB() *leveldb.DB {
 
 // Meter configures the database metrics collectors and
 func (self *LDBDatabase) Meter(prefix string) {
+	// Short circuit metering if the metrics system is disabled
+	if !metrics.Enabled {
+		return
+	}
 	// Initialize all the metrics collector at the requested prefix
 	self.getTimer = metrics.NewTimer(prefix + "user/gets")
 	self.putTimer = metrics.NewTimer(prefix + "user/puts")