statediff: Metrics for latest block #44
@ -8,7 +8,7 @@ import (
|
||||
|
||||
)
|
||||
|
||||
const (
|
||||
indexerNamespace = "indexer"
|
||||
i-norden
commented
Yeah I think "statediff" would be more appropriate here Yeah I think "statediff" would be more appropriate here
|
||||
namespace = "statediff"
|
||||
i-norden
commented
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 {
|
||||
i-norden
commented
Yeah I think "statediff" would be more appropriate here Yeah I think "statediff" would be more appropriate here
i-norden
commented
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}
|
||||
i-norden
commented
Yeah I think "statediff" would be more appropriate here Yeah I think "statediff" would be more appropriate here
|
||||
parts := []string{namespace, name}
|
||||
i-norden
commented
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}
|
||||
i-norden
commented
Yeah I think "statediff" would be more appropriate here Yeah I think "statediff" would be more appropriate here
|
||||
parts = []string{namespace, subsystem, name}
|
||||
i-norden
commented
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 {
|
||||
i-norden
commented
Yeah I think "statediff" would be more appropriate here Yeah I think "statediff" would be more appropriate here
i-norden
commented
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
|
||||
i-norden
commented
Yeah I think "statediff" would be more appropriate here Yeah I think "statediff" would be more appropriate here
|
||||
subsys := "indexer"
|
||||
i-norden
commented
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)
|
||||
|
||||
i-norden
commented
Yeah I think "statediff" would be more appropriate here Yeah I think "statediff" would be more appropriate here
i-norden
commented
Yeah I think "statediff" would be more appropriate here Yeah I think "statediff" would be more appropriate here
|
54
statediff/metrics.go
Normal file
@ -0,0 +1,54 @@
|
||||
i-norden
commented
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)?
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
package statediff
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
import (
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
"strings"
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
"github.com/ethereum/go-ethereum/metrics"
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
)
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
const (
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
namespace = "statediff"
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
)
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
// Build a fully qualified metric name
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
func metricName(subsystem, name string) string {
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
if name == "" {
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
return ""
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
}
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
parts := []string{namespace, name}
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
if subsystem != "" {
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
parts = []string{namespace, subsystem, name}
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
}
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under 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
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
return strings.Join(parts, "/")
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
}
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
type statediffMetricsHandles struct {
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under 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
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
// FIXME
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
lastSyncHeight metrics.Gauge
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under 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
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
lastEventHeight metrics.Gauge
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
// Height of latest state diff
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
lastStatediffHeight metrics.Gauge
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
// Current length of chainEvent channels
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
serviceLoopChannelLen metrics.Gauge
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
writeLoopChannelLen metrics.Gauge
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
}
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
func RegisterStatediffMetrics(reg metrics.Registry) statediffMetricsHandles {
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
ctx := statediffMetricsHandles{
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
lastSyncHeight: metrics.NewGauge(),
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
lastEventHeight: metrics.NewGauge(),
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
lastStatediffHeight: metrics.NewGauge(),
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
serviceLoopChannelLen: metrics.NewGauge(),
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
writeLoopChannelLen: metrics.NewGauge(),
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
}
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
subsys := "service"
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under 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)
|
||||
i-norden
commented
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)?
i-norden
commented
Looks like Looks like `lastSyncHeight` still needs to be updated somewhere (from within core.BlockChain).
i-norden
commented
Doh yeah you mention that in the OP Doh yeah you mention that in the OP
roysc
commented
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.
roysc
commented
I pushed an update to name these under 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)
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under 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)
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under 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)
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under 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)
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
return ctx
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
||||
}
|
||||
i-norden
commented
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)?
roysc
commented
I pushed an update to name these under I pushed an update to name these under `statediff/service/`, and rename the indexer ones to `statediff/indexer`
|
@ -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 {
|
||||
|
Yeah I think "statediff" would be more appropriate here
Yeah I think "statediff" would be more appropriate here