MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / updateMetrics

Method updateMetrics

sqlchain/chain.go:1208–1225  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1206}
1207
1208func (c *Chain) updateMetrics() {
1209 head := c.rt.getHead()
1210 c.expVars.Get(mwMinerChainBlockCount).(*expvar.Int).Set(int64(head.node.count))
1211 c.expVars.Get(mwMinerChainBlockHeight).(*expvar.Int).Set(int64(head.Height))
1212 c.expVars.Get(mwMinerChainBlockHash).(*expvar.String).Set(head.Head.String())
1213
1214 b := head.node.load()
1215 if b == nil {
1216 // load manually
1217 var err error
1218 b, err = c.FetchBlock(head.Height)
1219 if err != nil {
1220 return
1221 }
1222 }
1223
1224 c.expVars.Get(mwMinerChainBlockTimestamp).(*expvar.String).Set(b.Timestamp().String())
1225}
1226
1227func (c *Chain) getCurrentHeight() int32 {
1228 return c.rt.getHead().Height

Callers 2

pushBlockMethod · 0.95
NewChainWithContextFunction · 0.80

Calls 7

FetchBlockMethod · 0.95
GetMethod · 0.65
getHeadMethod · 0.45
SetMethod · 0.45
StringMethod · 0.45
loadMethod · 0.45
TimestampMethod · 0.45

Tested by

no test coverage detected