diff --git a/collector/scraper.go b/collector/scraper.go index 0480e7257..5ec02d926 100644 --- a/collector/scraper.go +++ b/collector/scraper.go @@ -393,7 +393,11 @@ func (s *Scraper) sendBatch(ctx context.Context, wr *prompb.WriteRequest) error } } - logger.Infof("Sending %d timeseries to %d endpoints", len(wr.Timeseries), len(s.opts.Endpoints)) + start := time.Now() + defer func() { + logger.Infof("Sending %d timeseries to %d endpoints duration=%s", len(wr.Timeseries), len(s.opts.Endpoints), time.Since(start)) + }() + g, gCtx := errgroup.WithContext(ctx) for _, endpoint := range s.opts.Endpoints { endpoint := endpoint diff --git a/pkg/promremote/proxy.go b/pkg/promremote/proxy.go index 6b0f41ce3..64efb3da7 100644 --- a/pkg/promremote/proxy.go +++ b/pkg/promremote/proxy.go @@ -3,6 +3,7 @@ package promremote import ( "context" "strings" + "time" "github.com/Azure/adx-mon/pkg/logger" "github.com/Azure/adx-mon/pkg/prompb" @@ -50,8 +51,12 @@ func (r *RemoteWriteProxy) Write(ctx context.Context, wr prompb.WriteRequest) er } endpoint := r.Endpoints[i] - logger.Infof("Sending %d timeseries to %s", len(batch.Timeseries), endpoint) g.Go(func() error { + start := time.Now() + defer func() { + logger.Infof("Sending %d timeseries duration=%s", len((&batch).Timeseries), time.Since(start)) + }() + return r.Client.Write(gCtx, endpoint, &batch) }) }