| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I think we can abstract a Metrics interface and add an implementation called NoMetrics, where all methods are empty. When metrics are not needed, we can use an instance of NoMetrics, so we don't have to check metrics.Enable every time. |
Sorry, something went wrong.
| count, _ := res.RowsAffected() | ||
| count, err := res.RowsAffected() | ||
| p.log.Trace("delete items", "count", count) | ||
| if metrics.Enabled && err != nil { |
There was a problem hiding this comment.
The condition probably be err == nil
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, thanks, fixed locally, I will commit soon
Sorry, something went wrong.
Definitely will make the code more clear, but I am not sure if a function call to the interface is computationally cheapper than an if verification. As alternative, what about replace the duplicate code: if metrics.Enabled {
portalStorageMetrics.EntriesCount.Dec(count)
}in a function that verify: func verifyDec(metric){
if metrics.Enabled {
metric.Dec(count)
}
}and it is more clear in the code to call simple: verifyDec(metric)EDIT: Nevermind, It is the worst solution, uses an function call and an if comparison, higher computationally cost |
Sorry, something went wrong.
Just follow the geth style is OK. |
Sorry, something went wrong.
|
By the way, the code of storage is according from the early version of the trin. Now, the trin has update the storage code, maybe we can check there code to decide if we should do some update. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Implementation/fix of the following metrics:
portal/<NETWORK>/radius_ratio
portal/<NETWORK>/entry_count
portal/<NETWORK>/content_storage
portal/<NETWORK>/total_storage