metrics.go 459 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
package fromda

type Metrics interface {
	RecordDBDerivedEntryCount(count int64)
}

type ChainMetrics interface {
	RecordDBEntryCount(kind string, count int64)
}

type delegate struct {
	inner ChainMetrics
	kind  string
}

func (d *delegate) RecordDBDerivedEntryCount(count int64) {
	d.inner.RecordDBEntryCount(d.kind, count)
}

func AdaptMetrics(chainMetrics ChainMetrics, kind string) Metrics {
	return &delegate{
		kind:  kind,
		inner: chainMetrics,
	}
}