fix namespace
This commit is contained in:
parent
3d3e68c0ae
commit
f207284e3a
@ -23,7 +23,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
namespace = "eth-statediff-service"
|
namespace = "eth_statediff_service"
|
||||||
subsystem = "connections"
|
subsystem = "connections"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,43 +38,52 @@ var (
|
|||||||
tTxCommit prometheus.Histogram
|
tTxCommit prometheus.Histogram
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
LOADED_HEIGHT = "loaded_height"
|
||||||
|
PROCESSED_HEIGHT = "processed_height"
|
||||||
|
T_BLOCK_LOAD = "t_block_load"
|
||||||
|
T_BLOCK_PROCESSING = "t_block_processing"
|
||||||
|
T_STATE_PROCESSING = "t_state_processing"
|
||||||
|
T_POSTGRES_TX_COMMIT = "t_postgres_tx_commit"
|
||||||
|
)
|
||||||
|
|
||||||
// Init module initialization
|
// Init module initialization
|
||||||
func Init() {
|
func Init() {
|
||||||
metrics = true
|
metrics = true
|
||||||
|
|
||||||
lastLoadedHeight = promauto.NewGauge(prometheus.GaugeOpts{
|
lastLoadedHeight = promauto.NewGauge(prometheus.GaugeOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Name: "loaded_height",
|
Name: LOADED_HEIGHT,
|
||||||
Help: "The last block that was loaded for processing",
|
Help: "The last block that was loaded for processing",
|
||||||
})
|
})
|
||||||
lastProcessedHeight = promauto.NewGauge(prometheus.GaugeOpts{
|
lastProcessedHeight = promauto.NewGauge(prometheus.GaugeOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Name: "processed_height",
|
Name: PROCESSED_HEIGHT,
|
||||||
Help: "The last block that was processed",
|
Help: "The last block that was processed",
|
||||||
})
|
})
|
||||||
|
|
||||||
tBlockLoad = promauto.NewHistogram(prometheus.HistogramOpts{
|
tBlockLoad = promauto.NewHistogram(prometheus.HistogramOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Subsystem: statsSubsystem,
|
Subsystem: statsSubsystem,
|
||||||
Name: "t_block_load",
|
Name: T_BLOCK_LOAD,
|
||||||
Help: "Block loading time",
|
Help: "Block loading time",
|
||||||
})
|
})
|
||||||
tBlockProcessing = promauto.NewHistogram(prometheus.HistogramOpts{
|
tBlockProcessing = promauto.NewHistogram(prometheus.HistogramOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Subsystem: statsSubsystem,
|
Subsystem: statsSubsystem,
|
||||||
Name: "t_block_processing",
|
Name: T_BLOCK_PROCESSING,
|
||||||
Help: "Block (header, uncles, txs, rcts, tx trie, rct trie) processing time",
|
Help: "Block (header, uncles, txs, rcts, tx trie, rct trie) processing time",
|
||||||
})
|
})
|
||||||
tStateProcessing = promauto.NewHistogram(prometheus.HistogramOpts{
|
tStateProcessing = promauto.NewHistogram(prometheus.HistogramOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Subsystem: statsSubsystem,
|
Subsystem: statsSubsystem,
|
||||||
Name: "t_state_processing",
|
Name: T_STATE_PROCESSING,
|
||||||
Help: "State (state trie, storage tries, and code) processing time",
|
Help: "State (state trie, storage tries, and code) processing time",
|
||||||
})
|
})
|
||||||
tTxCommit = promauto.NewHistogram(prometheus.HistogramOpts{
|
tTxCommit = promauto.NewHistogram(prometheus.HistogramOpts{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Subsystem: statsSubsystem,
|
Subsystem: statsSubsystem,
|
||||||
Name: "t_postgres_tx_commit",
|
Name: T_POSTGRES_TX_COMMIT,
|
||||||
Help: "Postgres tx commit time",
|
Help: "Postgres tx commit time",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -107,13 +116,13 @@ func SetTimeMetric(name string, t time.Duration) {
|
|||||||
}
|
}
|
||||||
tAsF64 := t.Seconds()
|
tAsF64 := t.Seconds()
|
||||||
switch name {
|
switch name {
|
||||||
case "t_block_load":
|
case T_BLOCK_LOAD:
|
||||||
tBlockLoad.Observe(tAsF64)
|
tBlockLoad.Observe(tAsF64)
|
||||||
case "t_block_processing":
|
case T_BLOCK_PROCESSING:
|
||||||
tBlockProcessing.Observe(tAsF64)
|
tBlockProcessing.Observe(tAsF64)
|
||||||
case "t_state_processing":
|
case T_STATE_PROCESSING:
|
||||||
tStateProcessing.Observe(tAsF64)
|
tStateProcessing.Observe(tAsF64)
|
||||||
case "t_postgres_tx_commit":
|
case T_POSTGRES_TX_COMMIT:
|
||||||
tTxCommit.Observe(tAsF64)
|
tTxCommit.Observe(tAsF64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ func (sds *Service) writeStateDiff(block *types.Block, parentRoot common.Hash, p
|
|||||||
}
|
}
|
||||||
height := block.Number().Int64()
|
height := block.Number().Int64()
|
||||||
prom.SetLastLoadedHeight(height)
|
prom.SetLastLoadedHeight(height)
|
||||||
prom.SetTimeMetric("t_block_load", time.Now().Sub(t))
|
prom.SetTimeMetric(prom.T_BLOCK_LOAD, time.Now().Sub(t))
|
||||||
t = time.Now()
|
t = time.Now()
|
||||||
tx, err := sds.indexer.PushBlock(block, receipts, totalDifficulty)
|
tx, err := sds.indexer.PushBlock(block, receipts, totalDifficulty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -322,16 +322,16 @@ func (sds *Service) writeStateDiff(block *types.Block, parentRoot common.Hash, p
|
|||||||
codeOutput := func(c sdtypes.CodeAndCodeHash) error {
|
codeOutput := func(c sdtypes.CodeAndCodeHash) error {
|
||||||
return sds.indexer.PushCodeAndCodeHash(tx, c)
|
return sds.indexer.PushCodeAndCodeHash(tx, c)
|
||||||
}
|
}
|
||||||
prom.SetTimeMetric("t_block_processing", time.Now().Sub(t))
|
prom.SetTimeMetric(prom.T_BLOCK_PROCESSING, time.Now().Sub(t))
|
||||||
t = time.Now()
|
t = time.Now()
|
||||||
err = sds.Builder.WriteStateDiffObject(sd.StateRoots{
|
err = sds.Builder.WriteStateDiffObject(sd.StateRoots{
|
||||||
NewStateRoot: block.Root(),
|
NewStateRoot: block.Root(),
|
||||||
OldStateRoot: parentRoot,
|
OldStateRoot: parentRoot,
|
||||||
}, params, output, codeOutput)
|
}, params, output, codeOutput)
|
||||||
prom.SetTimeMetric("t_state_processing", time.Now().Sub(t))
|
prom.SetTimeMetric(prom.T_STATE_PROCESSING, time.Now().Sub(t))
|
||||||
t = time.Now()
|
t = time.Now()
|
||||||
err = tx.Close(err)
|
err = tx.Close(err)
|
||||||
prom.SetLastProcessedHeight(height)
|
prom.SetLastProcessedHeight(height)
|
||||||
prom.SetTimeMetric("t_postgres_tx_commit", time.Now().Sub(t))
|
prom.SetTimeMetric(prom.T_POSTGRES_TX_COMMIT, time.Now().Sub(t))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user