statediff: Metrics for latest block #44

Merged
telackey merged 2 commits from statediff-metrics-latestblock into v1.9.24-statediff 2020-11-25 10:29:34 +00:00
3 changed files with 66 additions and 4 deletions

View File

@ -8,7 +8,7 @@ import (
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
)
const (
indexerNamespace = "indexer"
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
namespace = "statediff"
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
)
// Build a fully qualified metric name
@ -16,9 +16,9 @@ func metricName(subsystem, name string) string {
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
if name == "" {
return ""
}
parts := []string{indexerNamespace, name}
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
parts := []string{namespace, name}
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
if subsystem != "" {
parts = []string{indexerNamespace, subsystem, name}
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
parts = []string{namespace, subsystem, name}
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
}
// Prometheus uses _ but geth metrics uses / and replaces
return strings.Join(parts, "/")
@ -57,7 +57,7 @@ func RegisterIndexerMetrics(reg metrics.Registry) indexerMetricsHandles {
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
tTxAndRecProcessing: metrics.NewTimer(),
tStateStoreCodeProcessing: metrics.NewTimer(),
}
subsys := "" // todo
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
subsys := "indexer"
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
reg.Register(metricName(subsys, "blocks"), ctx.blocks)
reg.Register(metricName(subsys, "transactions"), ctx.transactions)
reg.Register(metricName(subsys, "receipts"), ctx.receipts)

Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here
Review

Yeah I think "statediff" would be more appropriate here

Yeah I think "statediff" would be more appropriate here

54
statediff/metrics.go Normal file
View File

@ -0,0 +1,54 @@
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
package statediff
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
import (
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
"strings"
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
"github.com/ethereum/go-ethereum/metrics"
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
)
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
const (
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
namespace = "statediff"
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
)
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
// Build a fully qualified metric name
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
func metricName(subsystem, name string) string {
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
if name == "" {
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
return ""
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
}
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
parts := []string{namespace, name}
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
if subsystem != "" {
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
parts = []string{namespace, subsystem, name}
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
}
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
// Prometheus uses _ but geth metrics uses / and replaces
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
return strings.Join(parts, "/")
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
}
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
type statediffMetricsHandles struct {
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
// Height of latest synced by core.BlockChain
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
// FIXME
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
lastSyncHeight metrics.Gauge
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
// Height of the latest block received from chainEvent channel
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
lastEventHeight metrics.Gauge
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
// Height of latest state diff
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
lastStatediffHeight metrics.Gauge
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
// Current length of chainEvent channels
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
serviceLoopChannelLen metrics.Gauge
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
writeLoopChannelLen metrics.Gauge
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
}
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
func RegisterStatediffMetrics(reg metrics.Registry) statediffMetricsHandles {
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
ctx := statediffMetricsHandles{
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
lastSyncHeight: metrics.NewGauge(),
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
lastEventHeight: metrics.NewGauge(),
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
lastStatediffHeight: metrics.NewGauge(),
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
serviceLoopChannelLen: metrics.NewGauge(),
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
writeLoopChannelLen: metrics.NewGauge(),
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
}
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
subsys := "service"
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
reg.Register(metricName(subsys, "last_sync_height"), ctx.lastSyncHeight)
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

Looks like lastSyncHeight still needs to be updated somewhere (from within core.BlockChain).

Looks like `lastSyncHeight` still needs to be updated somewhere (from within core.BlockChain).
Review

Doh yeah you mention that in the OP

Doh yeah you mention that in the OP
Review

Yeah, the chain/head/block metric seems to be what we want - at least, looking at the blockchain code I don't really see a more appropriate location to track head.

Yeah, the chain/head/block metric seems to be what we want - at least, looking at the blockchain code I don't really see a more appropriate location to track head.
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
reg.Register(metricName(subsys, "last_event_height"), ctx.lastEventHeight)
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
reg.Register(metricName(subsys, "last_statediff_height"), ctx.lastStatediffHeight)
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
reg.Register(metricName(subsys, "service_loop_channel_len"), ctx.serviceLoopChannelLen)
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
reg.Register(metricName(subsys, "write_loop_channel_len"), ctx.writeLoopChannelLen)
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
return ctx
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
}
Review

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the service?

Not sure what this would be since the namespace is already "statediff", maybe "service" since the type these metrics are coming from within is the [service](https://github.com/vulcanize/go-ethereum/blob/v1.9.24-statediff/statediff/service.go#L93)?
Review

I pushed an update to name these under statediff/service/, and rename the indexer ones to statediff/indexer

I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`

View File

@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
@ -55,6 +56,8 @@ var writeLoopParams = Params{
IncludeCode: true,
}
var statediffMetrics = RegisterStatediffMetrics(metrics.DefaultRegistry)
type blockChain interface {
SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription
GetBlockByHash(hash common.Hash) *types.Block
@ -193,8 +196,10 @@ func (sds *Service) WriteLoop(chainEventCh chan core.ChainEvent) {
select {
//Notify chain event channel of events
case chainEvent := <-chainEventCh:
statediffMetrics.writeLoopChannelLen.Update(int64(len(chainEventCh)))
log.Debug("(WriteLoop) Event received from chainEventCh", "event", chainEvent)
currentBlock := chainEvent.Block
statediffMetrics.lastEventHeight.Update(int64(currentBlock.Number().Uint64()))
parentBlock := sds.lastBlock.replace(currentBlock, sds.BlockChain)
if parentBlock == nil {
log.Error("Parent block is nil, skipping this block", "block height", currentBlock.Number())
@ -205,6 +210,8 @@ func (sds *Service) WriteLoop(chainEventCh chan core.ChainEvent) {
log.Error("statediff (DB write) processing error", "block height", currentBlock.Number().Uint64(), "error", err.Error())
continue
}
// TODO: how to handle with concurrent workers
statediffMetrics.lastStatediffHeight.Update(int64(currentBlock.Number().Uint64()))
case err := <-errCh:
log.Warn("Error from chain event subscription", "error", err)
sds.close()
@ -226,6 +233,7 @@ func (sds *Service) Loop(chainEventCh chan core.ChainEvent) {
select {
//Notify chain event channel of events
case chainEvent := <-chainEventCh:
statediffMetrics.serviceLoopChannelLen.Update(int64(len(chainEventCh)))
log.Debug("Event received from chainEventCh", "event", chainEvent)
// if we don't have any subscribers, do not process a statediff
if atomic.LoadInt32(&sds.subscribers) == 0 {