diff --git a/pkg/check/smoke/metrics.go b/pkg/check/smoke/metrics.go index 554c0740..62a9aefb 100644 --- a/pkg/check/smoke/metrics.go +++ b/pkg/check/smoke/metrics.go @@ -6,17 +6,35 @@ import ( ) type metrics struct { - UploadErrors prometheus.Counter - UploadAttempts prometheus.Counter - DownloadErrors prometheus.Counter - DownloadMismatch prometheus.Counter - DownloadAttempts prometheus.Counter - UploadDuration prometheus.Histogram - DownloadDuration prometheus.Histogram + BatchCreateErrors prometheus.Counter + BatchCreateAttempts prometheus.Counter + UploadErrors prometheus.Counter + UploadAttempts prometheus.Counter + DownloadErrors prometheus.Counter + DownloadMismatch prometheus.Counter + DownloadAttempts prometheus.Counter + UploadDuration prometheus.Histogram + DownloadDuration prometheus.Histogram } func newMetrics(subsystem string) metrics { return metrics{ + BatchCreateAttempts: prometheus.NewCounter( + prometheus.CounterOpts{ + Namespace: m.Namespace, + Subsystem: subsystem, + Name: "batch_create_attemps", + Help: "Number of batch create attemps.", + }, + ), + BatchCreateErrors: prometheus.NewCounter( + prometheus.CounterOpts{ + Namespace: m.Namespace, + Subsystem: subsystem, + Name: "batch_create_errors", + Help: "Total errors encountered while creating batches.", + }, + ), UploadAttempts: prometheus.NewCounter( prometheus.CounterOpts{ Namespace: m.Namespace, diff --git a/pkg/check/smoke/smoke.go b/pkg/check/smoke/smoke.go index 0a586321..9316c10d 100644 --- a/pkg/check/smoke/smoke.go +++ b/pkg/check/smoke/smoke.go @@ -146,20 +146,21 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int case <-time.After(o.TxOnErrWait): } - c.metrics.UploadAttempts.Inc() - - txCtx, txCancel = context.WithTimeout(ctx, o.UploadTimeout) - + c.metrics.BatchCreateAttempts.Inc() batchID := batches.Get(txName) if batchID == "" { - batchID, err = clients[txName].CreatePostageBatch(txCtx, o.PostageAmount, o.PostageDepth, "load-test", true) + batchID, err = clients[txName].CreatePostageBatch(context.Background(), o.PostageAmount, o.PostageDepth, "load-test", true) if err != nil { c.logger.Errorf("create new batch: %v", err) + c.metrics.BatchCreateErrors.Inc() continue } batches.Store(txName, batchID) } + txCtx, txCancel = context.WithTimeout(ctx, o.UploadTimeout) + + c.metrics.UploadAttempts.Inc() address, txDuration, err = test.upload(txCtx, txName, txData, batchID) if err != nil { c.metrics.UploadErrors.Inc()