metrics namespace/subsystem = statediff/{indexer,service}

This commit is contained in:
Roy Crihfield 2020-11-24 18:19:39 +08:00
parent c1c41ef530
commit 72a47729bb
2 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@ import (
) )
const ( const (
indexerNamespace = "indexer" namespace = "statediff"
) )
// Build a fully qualified metric name // Build a fully qualified metric name
@ -16,9 +16,9 @@ func metricName(subsystem, name string) string {
if name == "" { if name == "" {
return "" return ""
} }
parts := []string{indexerNamespace, name} parts := []string{namespace, name}
if subsystem != "" { if subsystem != "" {
parts = []string{indexerNamespace, subsystem, name} parts = []string{namespace, subsystem, name}
} }
// Prometheus uses _ but geth metrics uses / and replaces // Prometheus uses _ but geth metrics uses / and replaces
return strings.Join(parts, "/") return strings.Join(parts, "/")
@ -57,7 +57,7 @@ func RegisterIndexerMetrics(reg metrics.Registry) indexerMetricsHandles {
tTxAndRecProcessing: metrics.NewTimer(), tTxAndRecProcessing: metrics.NewTimer(),
tStateStoreCodeProcessing: metrics.NewTimer(), tStateStoreCodeProcessing: metrics.NewTimer(),
} }
subsys := "" // todo subsys := "indexer"
reg.Register(metricName(subsys, "blocks"), ctx.blocks) reg.Register(metricName(subsys, "blocks"), ctx.blocks)
reg.Register(metricName(subsys, "transactions"), ctx.transactions) reg.Register(metricName(subsys, "transactions"), ctx.transactions)
reg.Register(metricName(subsys, "receipts"), ctx.receipts) reg.Register(metricName(subsys, "receipts"), ctx.receipts)

View File

@ -44,7 +44,7 @@ func RegisterStatediffMetrics(reg metrics.Registry) statediffMetricsHandles {
serviceLoopChannelLen: metrics.NewGauge(), serviceLoopChannelLen: metrics.NewGauge(),
writeLoopChannelLen: metrics.NewGauge(), writeLoopChannelLen: metrics.NewGauge(),
} }
subsys := "" // todo subsys := "service"
reg.Register(metricName(subsys, "last_sync_height"), ctx.lastSyncHeight) reg.Register(metricName(subsys, "last_sync_height"), ctx.lastSyncHeight)
reg.Register(metricName(subsys, "last_event_height"), ctx.lastEventHeight) reg.Register(metricName(subsys, "last_event_height"), ctx.lastEventHeight)
reg.Register(metricName(subsys, "last_statediff_height"), ctx.lastStatediffHeight) reg.Register(metricName(subsys, "last_statediff_height"), ctx.lastStatediffHeight)