Commit 0d78ad65 authored by protolambda's avatar protolambda

op-node: singular/span batch metric as eventvec with type label

parent bc663a4f
...@@ -46,8 +46,7 @@ type Metricer interface { ...@@ -46,8 +46,7 @@ type Metricer interface {
RecordL1Ref(name string, ref eth.L1BlockRef) RecordL1Ref(name string, ref eth.L1BlockRef)
RecordL2Ref(name string, ref eth.L2BlockRef) RecordL2Ref(name string, ref eth.L2BlockRef)
RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID) RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID)
RecordDerivedSingularBatches() RecordDerivedBatches(batchType string)
RecordDerivedSpanBatches()
CountSequencedTxs(count int) CountSequencedTxs(count int)
RecordL1ReorgDepth(d uint64) RecordL1ReorgDepth(d uint64)
RecordSequencerInconsistentL1Origin(from eth.BlockID, to eth.BlockID) RecordSequencerInconsistentL1Origin(from eth.BlockID, to eth.BlockID)
...@@ -95,8 +94,7 @@ type Metrics struct { ...@@ -95,8 +94,7 @@ type Metrics struct {
SequencingErrors *metrics.Event SequencingErrors *metrics.Event
PublishingErrors *metrics.Event PublishingErrors *metrics.Event
DerivedSingularBatches *metrics.Event DerivedBatches metrics.EventVec
DerivedSpanBatches *metrics.Event
P2PReqDurationSeconds *prometheus.HistogramVec P2PReqDurationSeconds *prometheus.HistogramVec
P2PReqTotal *prometheus.CounterVec P2PReqTotal *prometheus.CounterVec
...@@ -197,8 +195,7 @@ func NewMetrics(procName string) *Metrics { ...@@ -197,8 +195,7 @@ func NewMetrics(procName string) *Metrics {
SequencingErrors: metrics.NewEvent(factory, ns, "", "sequencing_errors", "sequencing errors"), SequencingErrors: metrics.NewEvent(factory, ns, "", "sequencing_errors", "sequencing errors"),
PublishingErrors: metrics.NewEvent(factory, ns, "", "publishing_errors", "p2p publishing errors"), PublishingErrors: metrics.NewEvent(factory, ns, "", "publishing_errors", "p2p publishing errors"),
DerivedSingularBatches: metrics.NewEvent(factory, ns, "", "derived_singular_batches", "derived singular batches"), DerivedBatches: metrics.NewEventVec(factory, ns, "", "derived_batches", "derived batches", []string{"type"}),
DerivedSpanBatches: metrics.NewEvent(factory, ns, "", "derived_span_batches", "derived span batches"),
SequencerInconsistentL1Origin: metrics.NewEvent(factory, ns, "", "sequencer_inconsistent_l1_origin", "events when the sequencer selects an inconsistent L1 origin"), SequencerInconsistentL1Origin: metrics.NewEvent(factory, ns, "", "sequencer_inconsistent_l1_origin", "events when the sequencer selects an inconsistent L1 origin"),
SequencerResets: metrics.NewEvent(factory, ns, "", "sequencer_resets", "sequencer resets"), SequencerResets: metrics.NewEvent(factory, ns, "", "sequencer_resets", "sequencer resets"),
...@@ -457,12 +454,8 @@ func (m *Metrics) RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next ...@@ -457,12 +454,8 @@ func (m *Metrics) RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next
m.UnsafePayloadsBufferMemSize.Set(float64(memSize)) m.UnsafePayloadsBufferMemSize.Set(float64(memSize))
} }
func (m *Metrics) RecordDerivedSingularBatches() { func (m *Metrics) RecordDerivedBatches(batchType string) {
m.DerivedSingularBatches.Record() m.DerivedBatches.Record(batchType)
}
func (m *Metrics) RecordDerivedSpanBatches() {
m.DerivedSpanBatches.Record()
} }
func (m *Metrics) CountSequencedTxs(count int) { func (m *Metrics) CountSequencedTxs(count int) {
...@@ -662,10 +655,7 @@ func (n *noopMetricer) RecordL2Ref(name string, ref eth.L2BlockRef) { ...@@ -662,10 +655,7 @@ func (n *noopMetricer) RecordL2Ref(name string, ref eth.L2BlockRef) {
func (n *noopMetricer) RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID) { func (n *noopMetricer) RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID) {
} }
func (n *noopMetricer) RecordDerivedSingularBatches() { func (n *noopMetricer) RecordDerivedBatches(batchType string) {
}
func (n *noopMetricer) RecordDerivedSpanBatches() {
} }
func (n *noopMetricer) CountSequencedTxs(count int) { func (n *noopMetricer) CountSequencedTxs(count int) {
......
...@@ -97,7 +97,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (Batch, error) { ...@@ -97,7 +97,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (Batch, error) {
return nil, NewCriticalError(errors.New("failed type assertion to SingularBatch")) return nil, NewCriticalError(errors.New("failed type assertion to SingularBatch"))
} }
cr.log.Debug("decoded singular batch from channel") cr.log.Debug("decoded singular batch from channel")
cr.metrics.RecordDerivedSingularBatches() cr.metrics.RecordDerivedBatches("singular")
return singularBatch, nil return singularBatch, nil
case SpanBatchType: case SpanBatchType:
if origin := cr.Origin(); !cr.cfg.IsDelta(origin.Time) { if origin := cr.Origin(); !cr.cfg.IsDelta(origin.Time) {
...@@ -116,7 +116,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (Batch, error) { ...@@ -116,7 +116,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (Batch, error) {
return nil, err return nil, err
} }
cr.log.Debug("decoded span batch from channel") cr.log.Debug("decoded span batch from channel")
cr.metrics.RecordDerivedSpanBatches() cr.metrics.RecordDerivedBatches("span")
return spanBatch, nil return spanBatch, nil
default: default:
// error is bubbled up to user, but pipeline can skip the batch and continue after. // error is bubbled up to user, but pipeline can skip the batch and continue after.
......
...@@ -21,8 +21,7 @@ type Metrics interface { ...@@ -21,8 +21,7 @@ type Metrics interface {
RecordHeadChannelOpened() RecordHeadChannelOpened()
RecordChannelTimedOut() RecordChannelTimedOut()
RecordFrame() RecordFrame()
RecordDerivedSingularBatches() RecordDerivedBatches(batchType string)
RecordDerivedSpanBatches()
} }
type L1Fetcher interface { type L1Fetcher interface {
......
...@@ -27,8 +27,7 @@ type Metrics interface { ...@@ -27,8 +27,7 @@ type Metrics interface {
RecordChannelTimedOut() RecordChannelTimedOut()
RecordFrame() RecordFrame()
RecordDerivedSingularBatches() RecordDerivedBatches(batchType string)
RecordDerivedSpanBatches()
RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID) RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID)
......
...@@ -53,10 +53,7 @@ func (t *TestDerivationMetrics) RecordChannelTimedOut() { ...@@ -53,10 +53,7 @@ func (t *TestDerivationMetrics) RecordChannelTimedOut() {
func (t *TestDerivationMetrics) RecordFrame() { func (t *TestDerivationMetrics) RecordFrame() {
} }
func (n *TestDerivationMetrics) RecordDerivedSingularBatches() { func (n *TestDerivationMetrics) RecordDerivedBatches(batchType string) {
}
func (n *TestDerivationMetrics) RecordDerivedSpanBatches() {
} }
type TestRPCMetrics struct{} type TestRPCMetrics struct{}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment