mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 20:11:21 +00:00
add more sync stages to metrics (#5740)
hi! this pr adds more sync stages to the prometheus metrics. node now shows ``` sync{stage="account_history_index"} 15742138 sync{stage="block_hashes"} 15742138 sync{stage="bodies"} 15742138 sync{stage="call_traces"} 15742138 sync{stage="cumulative_index"} 15742138 sync{stage="execution"} 15742138 sync{stage="finish"} 15742138 sync{stage="hash_state"} 15742138 sync{stage="headers"} 15742138 sync{stage="intermediate_hashes"} 15742138 sync{stage="log_index"} 15742138 sync{stage="senders"} 15742138 sync{stage="snapshots"} 15742138 sync{stage="storage_history_index"} 15742138 sync{stage="translation"} 0 sync{stage="tx_lookup"} 15742138 sync{stage="verkle_trie"} 0 sync{stage="watch_the_burn"} 0 ``` Co-authored-by: a <a@a.a>
This commit is contained in:
parent
3aa97c57c1
commit
d1e9149c93
@ -1,15 +1,25 @@
|
|||||||
package stagedsync
|
package stagedsync
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/VictoriaMetrics/metrics"
|
"github.com/VictoriaMetrics/metrics"
|
||||||
|
"github.com/huandu/xstrings"
|
||||||
"github.com/ledgerwatch/erigon-lib/kv"
|
"github.com/ledgerwatch/erigon-lib/kv"
|
||||||
"github.com/ledgerwatch/erigon/eth/stagedsync/stages"
|
"github.com/ledgerwatch/erigon/eth/stagedsync/stages"
|
||||||
)
|
)
|
||||||
|
|
||||||
var syncMetrics = map[stages.SyncStage]*metrics.Counter{
|
var syncMetrics = map[stages.SyncStage]*metrics.Counter{}
|
||||||
stages.Headers: metrics.GetOrCreateCounter(`sync{stage="headers"}`),
|
|
||||||
stages.Execution: metrics.GetOrCreateCounter(`sync{stage="execution"}`),
|
func init() {
|
||||||
stages.Finish: metrics.GetOrCreateCounter(`sync{stage="finish"}`),
|
for _, v := range stages.AllStages {
|
||||||
|
syncMetrics[v] = metrics.GetOrCreateCounter(
|
||||||
|
fmt.Sprintf(
|
||||||
|
`sync{stage="%s"}`,
|
||||||
|
xstrings.ToSnakeCase(string(v)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateMetrics - need update metrics manually because current "metrics" package doesn't support labels
|
// UpdateMetrics - need update metrics manually because current "metrics" package doesn't support labels
|
||||||
|
Loading…
Reference in New Issue
Block a user