Skip to content

Commit

Permalink
Add operatorId in attestation latency (#574)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix authored May 22, 2024
1 parent 27b4caa commit 1f91e4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions disperser/batcher/grpc/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (c *dispatcher) sendAllChunks(ctx context.Context, state *core.IndexedOpera
BatchHeaderHash: batchHeaderHash,
AttestationLatencyMs: latencyMs,
}
c.metrics.ObserveLatency(false, latencyMs)
c.metrics.ObserveLatency(id.Hex(), false, latencyMs)
} else {
update <- core.SigningMessage{
Signature: sig,
Expand All @@ -97,7 +97,7 @@ func (c *dispatcher) sendAllChunks(ctx context.Context, state *core.IndexedOpera
AttestationLatencyMs: latencyMs,
Err: nil,
}
c.metrics.ObserveLatency(true, latencyMs)
c.metrics.ObserveLatency(id.Hex(), true, latencyMs)
}

}(core.IndexedOperatorInfo{
Expand Down
6 changes: 3 additions & 3 deletions disperser/batcher/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func NewMetrics(httpPort string, logger logging.Logger) *Metrics {
Help: "attestation latency summary in milliseconds",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.95: 0.01, 0.99: 0.001},
},
[]string{"status"},
[]string{"operator_id", "status"},
),
}

Expand Down Expand Up @@ -252,12 +252,12 @@ func (g *Metrics) UpdateAttestation(operatorCount map[core.QuorumID]int, signerC
}
}

func (t *DispatcherMetrics) ObserveLatency(success bool, latencyMS float64) {
func (t *DispatcherMetrics) ObserveLatency(operatorId string, success bool, latencyMS float64) {
label := "success"
if !success {
label = "failure"
}
t.Latency.WithLabelValues(label).Observe(latencyMS)
t.Latency.WithLabelValues(operatorId, label).Observe(latencyMS)
}

// UpdateCompletedBlob increments the number and updates size of processed blobs.
Expand Down

0 comments on commit 1f91e4a

Please sign in to comment.