Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: create batch failures should not count toward upload error #358

Merged
merged 3 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions pkg/check/smoke/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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_attempts",
Help: "Number of batch create attempts.",
},
),
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,
Expand Down
5 changes: 3 additions & 2 deletions pkg/check/smoke/smoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
if err != nil {
c.logger.Errorf("create new batch: %v", err)
c.metrics.BatchCreateErrors.Inc()
continue
}
batches.Store(txName, batchID)
}

c.metrics.UploadAttempts.Inc()
address, txDuration, err = test.upload(txCtx, txName, txData, batchID)
if err != nil {
c.metrics.UploadErrors.Inc()
Expand Down