satellite/metainfo/piecedeletion: add metrics for deletion requests
Change-Id: I48ad96e78dab84b9238c63d62bda679fc65c2072
This commit is contained in:
parent
d91cf5f4de
commit
bdaabd611d
@ -131,6 +131,8 @@ func (combiner *Combiner) Enqueue(node storj.NodeURL, job Job) {
|
||||
func (worker *worker) start(combiner *Combiner) {
|
||||
// Try to add to worker pool, this may fail when we are shutting things down.
|
||||
workerStarted := combiner.workers.Go(func() {
|
||||
|
||||
defer mon.TaskNamed("worker_start")(nil)(nil)
|
||||
defer close(worker.done)
|
||||
// Ensure we fail any jobs that the handler didn't handle.
|
||||
defer FailPending(worker.jobs)
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/spacemonkeygo/monkit/v3"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"storj.io/common/errs2"
|
||||
@ -45,6 +46,7 @@ func NewDialer(log *zap.Logger, dialer rpc.Dialer, requestTimeout, failThreshold
|
||||
|
||||
// Handle tries to send the deletion requests to the specified node.
|
||||
func (dialer *Dialer) Handle(ctx context.Context, node storj.NodeURL, queue Queue) {
|
||||
defer mon.Task()(&ctx, node.ID.String())(nil)
|
||||
defer FailPending(queue)
|
||||
|
||||
if dialer.recentlyFailed(ctx, node) {
|
||||
@ -69,12 +71,21 @@ func (dialer *Dialer) Handle(ctx context.Context, node storj.NodeURL, queue Queu
|
||||
}
|
||||
|
||||
jobs, ok := queue.PopAll()
|
||||
// Add metrics on to the span
|
||||
s := monkit.SpanFromCtx(ctx)
|
||||
s.Annotate("delete jobs size", string(len(jobs)))
|
||||
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
for len(jobs) > 0 {
|
||||
batch, promises, rest := batchJobs(jobs, dialer.piecesPerRequest)
|
||||
// Aggregation metrics
|
||||
mon.IntVal("delete batch size").Observe(int64(len(batch)))
|
||||
// Tracing metrics
|
||||
s.Annotate("delete batch size", string(len(batch)))
|
||||
|
||||
jobs = rest
|
||||
|
||||
requestCtx, cancel := context.WithTimeout(ctx, dialer.requestTimeout)
|
||||
|
Loading…
Reference in New Issue
Block a user