From 098d3397c211a717abad527be763242e652cb1ac Mon Sep 17 00:00:00 2001 From: Acha Bill Date: Tue, 19 Dec 2023 22:56:53 +0100 Subject: [PATCH 1/3] fix: wait for push and fix logs --- pkg/check/datadurability/datadurability.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/check/datadurability/datadurability.go b/pkg/check/datadurability/datadurability.go index 8ed721e9..446714cb 100644 --- a/pkg/check/datadurability/datadurability.go +++ b/pkg/check/datadurability/datadurability.go @@ -53,6 +53,10 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, o interf if !ok { return fmt.Errorf("invalid options type") } + if opts.Ref == "" { + return fmt.Errorf("reference is required") + } + ref, err := swarm.ParseHexAddress(opts.Ref) if err != nil { return fmt.Errorf("parse hex ref %s: %w", opts.Ref, err) @@ -107,7 +111,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, o interf return } dur := time.Since(chunkStart) - c.logger.Infof("download successful. %s (%d of %d) chunk=%s node=%s dur=%v", percentage(i, len(chunkRefs)), i, len(chunkRefs), ref, node.Name(), dur) + // c.logger.Infof("download successful. %s (%d of %d) chunk=%s node=%s dur=%v", percentage(i, len(chunkRefs)), i, len(chunkRefs), ref, node.Name(), dur) c.metrics.ChunkDownloadDuration.Observe(dur.Seconds()) c.metrics.FileSize.Add(float64(len(d))) }(i, ref, node) @@ -120,6 +124,9 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, o interf dur := time.Since(fileStart) c.logger.Infof("done. dur=%v", dur) c.metrics.FileDownloadDuration.Observe(dur.Seconds()) + // wait for metrics to be pushed + c.logger.Infof("waiting 1 minute for metrics to be pushed") + time.Sleep(1 * time.Minute) return nil } @@ -128,6 +135,7 @@ func percentage(a, b int) string { } func fetchFile(ctx context.Context, logger logging.Logger, ref swarm.Address, cluster orchestration.Cluster, maxAttempts int) ([]byte, error) { + logger.Infof("fetching file. ref=%s", ref) var nodes []orchestration.Node for _, node := range cluster.Nodes() { nodes = append(nodes, node) @@ -137,7 +145,7 @@ func fetchFile(ctx context.Context, logger logging.Logger, ref swarm.Address, cl node := nodes[i%len(nodes)] d, err := node.Client().DownloadFileBytes(ctx, ref, nil) if err != nil { - logger.Infof("node: %s failed to fetch file: %v", node.Name(), err) + logger.Errorf("node: %s failed to fetch file: %v", node.Name(), err) continue } return d, nil From 7231e5905d8c74c1c8f7b5ff91046103e6dffd09 Mon Sep 17 00:00:00 2001 From: Acha Bill Date: Tue, 19 Dec 2023 23:04:17 +0100 Subject: [PATCH 2/3] fix: . --- pkg/check/datadurability/datadurability.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/check/datadurability/datadurability.go b/pkg/check/datadurability/datadurability.go index 446714cb..593f5521 100644 --- a/pkg/check/datadurability/datadurability.go +++ b/pkg/check/datadurability/datadurability.go @@ -135,7 +135,7 @@ func percentage(a, b int) string { } func fetchFile(ctx context.Context, logger logging.Logger, ref swarm.Address, cluster orchestration.Cluster, maxAttempts int) ([]byte, error) { - logger.Infof("fetching file. ref=%s", ref) + logger.Infof("fetching file. ref=%s", ref.String()) var nodes []orchestration.Node for _, node := range cluster.Nodes() { nodes = append(nodes, node) From 3edf4ddcafb4f6336b53b7ce209636d6b94396be Mon Sep 17 00:00:00 2001 From: Acha Bill Date: Tue, 19 Dec 2023 23:05:19 +0100 Subject: [PATCH 3/3] fix: . --- pkg/check/datadurability/datadurability.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/check/datadurability/datadurability.go b/pkg/check/datadurability/datadurability.go index 593f5521..257cf856 100644 --- a/pkg/check/datadurability/datadurability.go +++ b/pkg/check/datadurability/datadurability.go @@ -111,7 +111,6 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, o interf return } dur := time.Since(chunkStart) - // c.logger.Infof("download successful. %s (%d of %d) chunk=%s node=%s dur=%v", percentage(i, len(chunkRefs)), i, len(chunkRefs), ref, node.Name(), dur) c.metrics.ChunkDownloadDuration.Observe(dur.Seconds()) c.metrics.FileSize.Add(float64(len(d))) }(i, ref, node)