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 {
RecordL1Ref(name string, ref eth.L1BlockRef)
RecordL2Ref(name string, ref eth.L2BlockRef)
RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID)
RecordDerivedSingularBatches()
RecordDerivedSpanBatches()
RecordDerivedBatches(batchType string)
CountSequencedTxs(count int)
RecordL1ReorgDepth(d uint64)
RecordSequencerInconsistentL1Origin(from eth.BlockID, to eth.BlockID)
......@@ -95,8 +94,7 @@ type Metrics struct {
SequencingErrors *metrics.Event
PublishingErrors *metrics.Event
DerivedSingularBatches *metrics.Event
DerivedSpanBatches *metrics.Event
DerivedBatches metrics.EventVec
P2PReqDurationSeconds *prometheus.HistogramVec
P2PReqTotal *prometheus.CounterVec
......@@ -197,8 +195,7 @@ func NewMetrics(procName string) *Metrics {
SequencingErrors: metrics.NewEvent(factory, ns, "", "sequencing_errors", "sequencing errors"),
PublishingErrors: metrics.NewEvent(factory, ns, "", "publishing_errors", "p2p publishing errors"),
DerivedSingularBatches: metrics.NewEvent(factory, ns, "", "derived_singular_batches", "derived singular batches"),
DerivedSpanBatches: metrics.NewEvent(factory, ns, "", "derived_span_batches", "derived span batches"),
DerivedBatches: metrics.NewEventVec(factory, ns, "", "derived_batches", "derived batches", []string{"type"}),
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"),
......@@ -457,12 +454,8 @@ func (m *Metrics) RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next
m.UnsafePayloadsBufferMemSize.Set(float64(memSize))
}
func (m *Metrics) RecordDerivedSingularBatches() {
m.DerivedSingularBatches.Record()
}
func (m *Metrics) RecordDerivedSpanBatches() {
m.DerivedSpanBatches.Record()
func (m *Metrics) RecordDerivedBatches(batchType string) {
m.DerivedBatches.Record(batchType)
}
func (m *Metrics) CountSequencedTxs(count int) {
......@@ -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) RecordDerivedSingularBatches() {
}
func (n *noopMetricer) RecordDerivedSpanBatches() {
func (n *noopMetricer) RecordDerivedBatches(batchType string) {
}
func (n *noopMetricer) CountSequencedTxs(count int) {
......
......@@ -97,7 +97,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (Batch, error) {
return nil, NewCriticalError(errors.New("failed type assertion to SingularBatch"))
}
cr.log.Debug("decoded singular batch from channel")
cr.metrics.RecordDerivedSingularBatches()
cr.metrics.RecordDerivedBatches("singular")
return singularBatch, nil
case SpanBatchType:
if origin := cr.Origin(); !cr.cfg.IsDelta(origin.Time) {
......@@ -116,7 +116,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (Batch, error) {
return nil, err
}
cr.log.Debug("decoded span batch from channel")
cr.metrics.RecordDerivedSpanBatches()
cr.metrics.RecordDerivedBatches("span")
return spanBatch, nil
default:
// error is bubbled up to user, but pipeline can skip the batch and continue after.
......
......@@ -21,8 +21,7 @@ type Metrics interface {
RecordHeadChannelOpened()
RecordChannelTimedOut()
RecordFrame()
RecordDerivedSingularBatches()
RecordDerivedSpanBatches()
RecordDerivedBatches(batchType string)
}
type L1Fetcher interface {
......
......@@ -27,8 +27,7 @@ type Metrics interface {
RecordChannelTimedOut()
RecordFrame()
RecordDerivedSingularBatches()
RecordDerivedSpanBatches()
RecordDerivedBatches(batchType string)
RecordUnsafePayloadsBuffer(length uint64, memSize uint64, next eth.BlockID)
......
......@@ -53,10 +53,7 @@ func (t *TestDerivationMetrics) RecordChannelTimedOut() {
func (t *TestDerivationMetrics) RecordFrame() {
}
func (n *TestDerivationMetrics) RecordDerivedSingularBatches() {
}
func (n *TestDerivationMetrics) RecordDerivedSpanBatches() {
func (n *TestDerivationMetrics) RecordDerivedBatches(batchType string) {
}
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