@@ -60,8 +60,10 @@ func (c *LoadCheck) run(ctx context.Context, cluster orchestration.Cluster, o Op
6060 return errors .New ("max committed depth is not set" )
6161 }
6262
63+ contentSize := o .ContentSize
64+
6365 c .logger .Infof ("random seed: %v" , o .RndSeed )
64- c .logger .Infof ("content size: %v" , o . ContentSize )
66+ c .logger .Infof ("content size: %v" , contentSize )
6567 c .logger .Infof ("max committed depth: %v" , o .MaxCommittedDepth )
6668 c .logger .Infof ("committed depth check wait time: %v" , o .CommittedDepthCheckWait )
6769 c .logger .Infof ("total duration: %s" , o .Duration .String ())
@@ -82,18 +84,20 @@ func (c *LoadCheck) run(ctx context.Context, cluster orchestration.Cluster, o Op
8284 c .logger .Info ("we are done" )
8385 return nil
8486 default :
85- c .logger .Infof ("starting iteration: #%d" , i )
87+ c .logger .Infof ("starting iteration: #%d bytes (%.2f KB) " , contentSize , float64 ( contentSize ) / 1024 )
8688 }
8789
90+ sizeLabel := fmt .Sprintf ("%d" , contentSize )
91+
8892 var (
8993 txDuration time.Duration
9094 txData []byte
9195 address swarm.Address
9296 )
9397
94- txData = make ([]byte , o . ContentSize )
98+ txData = make ([]byte , contentSize )
9599 if _ , err := crand .Read (txData ); err != nil {
96- c .logger .Infof ("unable to create random content: %v" , err )
100+ c .logger .Infof ("unable to create random content for size %d : %v" , contentSize , err )
97101 continue
98102 }
99103
@@ -125,7 +129,7 @@ func (c *LoadCheck) run(ctx context.Context, cluster orchestration.Cluster, o Op
125129 return
126130 }
127131
128- c .metrics .UploadAttempts .Inc ()
132+ c .metrics .UploadAttempts .WithLabelValues ( sizeLabel ). Inc ()
129133 var duration time.Duration
130134 c .logger .Infof ("uploading to: %s" , txName )
131135
@@ -139,7 +143,7 @@ func (c *LoadCheck) run(ctx context.Context, cluster orchestration.Cluster, o Op
139143
140144 address , duration , err = test .upload (ctx , txName , txData , batchID )
141145 if err != nil {
142- c .metrics .UploadErrors .Inc ()
146+ c .metrics .UploadErrors .WithLabelValues ( sizeLabel ). Inc ()
143147 c .logger .Infof ("upload failed: %v" , err )
144148 c .logger .Infof ("retrying in: %v" , o .TxOnErrWait )
145149 time .Sleep (o .TxOnErrWait )
@@ -183,11 +187,11 @@ func (c *LoadCheck) run(ctx context.Context, cluster orchestration.Cluster, o Op
183187 default :
184188 }
185189
186- c .metrics .DownloadAttempts .Inc ()
190+ c .metrics .DownloadAttempts .WithLabelValues ( sizeLabel ). Inc ()
187191
188192 rxData , rxDuration , err = test .download (ctx , rxName , address )
189193 if err != nil {
190- c .metrics .DownloadErrors .Inc ()
194+ c .metrics .DownloadErrors .WithLabelValues ( sizeLabel ). Inc ()
191195 c .logger .Infof ("download failed: %v" , err )
192196 c .logger .Infof ("retrying in: %v" , o .RxOnErrWait )
193197 time .Sleep (o .RxOnErrWait )
@@ -202,7 +206,7 @@ func (c *LoadCheck) run(ctx context.Context, cluster orchestration.Cluster, o Op
202206 if ! bytes .Equal (rxData , txData ) {
203207 c .logger .Info ("uploaded data does not match downloaded data" )
204208
205- c .metrics .DownloadMismatch .Inc ()
209+ c .metrics .DownloadMismatch .WithLabelValues ( sizeLabel ). Inc ()
206210
207211 rxLen , txLen := len (rxData ), len (txData )
208212 if rxLen != txLen {
@@ -225,8 +229,16 @@ func (c *LoadCheck) run(ctx context.Context, cluster orchestration.Cluster, o Op
225229
226230 // We want to update the metrics when no error has been
227231 // encountered in order to avoid counter mismatch.
228- c .metrics .UploadDuration .Observe (txDuration .Seconds ())
229- c .metrics .DownloadDuration .Observe (rxDuration .Seconds ())
232+ c .metrics .UploadDuration .WithLabelValues (sizeLabel ).Observe (txDuration .Seconds ())
233+ c .metrics .DownloadDuration .WithLabelValues (sizeLabel ).Observe (rxDuration .Seconds ())
234+ if txDuration .Seconds () > 0 {
235+ uploadThroughput := float64 (contentSize ) / txDuration .Seconds ()
236+ c .metrics .UploadThroughput .WithLabelValues (sizeLabel ).Set (uploadThroughput )
237+ }
238+ if rxDuration .Seconds () > 0 {
239+ downloadThroughput := float64 (contentSize ) / rxDuration .Seconds ()
240+ c .metrics .DownloadThroughput .WithLabelValues (sizeLabel ).Set (downloadThroughput )
241+ }
230242 }()
231243 }
232244
0 commit comments