Skip to content
Open
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
1 change: 1 addition & 0 deletions config/local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ checks:
download-timeout: 1m
iteration-wait: 5m
duration: 10m
r-levels: [0, 2, 4]
timeout: 11m
type: smoke
ci-load:
Expand Down
4 changes: 4 additions & 0 deletions pkg/bee/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
swarmFeedIndexNextHeader = "Swarm-Feed-Index-Next"
swarmIndexDocumentHeader = "Swarm-Index-Document"
swarmErrorDocumentHeader = "Swarm-Error-Document"
swarmRedundancyLevelHeader = "Swarm-Redundancy-Level"
)

// Client manages communication with the Bee API.
Expand Down Expand Up @@ -223,6 +224,9 @@ func (c *Client) requestDataGetHeader(ctx context.Context, method, path string,
if opts != nil && opts.Cache != nil {
req.Header.Set(swarmCacheDownloadHeader, strconv.FormatBool(*opts.Cache))
}
if opts != nil && opts.RLevel != nil {
req.Header.Set(swarmRedundancyLevelHeader, strconv.Itoa(int(*opts.RLevel)))
}
if opts != nil && opts.RedundancyFallbackMode != nil {
req.Header.Set(swarmRedundancyFallbackMode, strconv.FormatBool(*opts.RedundancyFallbackMode))
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/bee/api/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func (b *BytesService) Upload(ctx context.Context, data io.Reader, o UploadOptio
}
h.Add(deferredUploadHeader, strconv.FormatBool(!o.Direct))
h.Add(postageStampBatchHeader, o.BatchID)
if o.RLevel != nil {
h.Add(swarmRedundancyLevelHeader, strconv.Itoa(int(*o.RLevel)))
}

err := b.client.requestWithHeader(ctx, http.MethodPost, "/"+apiVersion+"/bytes", h, data, &resp)
return resp, err
}
7 changes: 6 additions & 1 deletion pkg/bee/api/options.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package api

import "github.com/ethersphere/bee/v2/pkg/swarm"
import (
"github.com/ethersphere/bee/v2/pkg/file/redundancy"
"github.com/ethersphere/bee/v2/pkg/swarm"
)

type UploadOptions struct {
Act bool
Expand All @@ -9,6 +12,7 @@ type UploadOptions struct {
BatchID string
Direct bool
ActHistoryAddress swarm.Address
RLevel *redundancy.Level

// Dirs
IndexDocument string
Expand All @@ -21,6 +25,7 @@ type DownloadOptions struct {
ActPublicKey *swarm.Address
ActTimestamp *uint64
Cache *bool
RLevel *redundancy.Level
RedundancyFallbackMode *bool
OnlyRootChunk *bool
}
4 changes: 2 additions & 2 deletions pkg/check/load/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (c *Check) run(ctx context.Context, cluster orchestration.Cluster, o Option

c.logger.WithField("batch_id", batchID).Infof("node %s: using batch", uploader.Name())

address, duration, err = test.Upload(ctx, uploader, txData, batchID)
address, duration, err = test.Upload(ctx, uploader, txData, batchID, nil)
if err != nil {
c.metrics.UploadErrors.WithLabelValues(sizeLabel).Inc()
c.logger.Errorf("upload failed: %v", err)
Expand Down Expand Up @@ -246,7 +246,7 @@ func (c *Check) run(ctx context.Context, cluster orchestration.Cluster, o Option

c.metrics.DownloadAttempts.WithLabelValues(sizeLabel).Inc()

rxData, rxDuration, err = test.Download(ctx, downloader, address)
rxData, rxDuration, err = test.Download(ctx, downloader, address, nil)
if err != nil {
c.metrics.DownloadErrors.WithLabelValues(sizeLabel).Inc()
c.logger.Errorf("download failed for size %d: %v", contentSize, err)
Expand Down
67 changes: 54 additions & 13 deletions pkg/check/smoke/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,23 @@ type metrics struct {
BatchCreateAttempts prometheus.Counter
UploadErrors *prometheus.CounterVec
UploadAttempts *prometheus.CounterVec
UploadSuccess *prometheus.CounterVec
DownloadErrors *prometheus.CounterVec
DownloadMismatch *prometheus.CounterVec
DownloadAttempts *prometheus.CounterVec
DownloadSuccess *prometheus.CounterVec
UploadDuration *prometheus.HistogramVec
DownloadDuration *prometheus.HistogramVec
UploadThroughput *prometheus.GaugeVec
DownloadThroughput *prometheus.GaugeVec
UploadedBytes *prometheus.CounterVec
DownloadedBytes *prometheus.CounterVec
}

const (
labelSizeBytes = "size_bytes"
labelNodeName = "node_name"
labelSizeBytes = "size_bytes"
labelNodeName = "node_name"
labelRedundancyLevel = "redundancy_level"
)

func newMetrics(subsystem string) metrics {
Expand Down Expand Up @@ -49,7 +54,7 @@ func newMetrics(subsystem string) metrics {
Name: "upload_attempts",
Help: "Number of upload attempts.",
},
[]string{labelSizeBytes, labelNodeName},
[]string{labelSizeBytes, labelNodeName, labelRedundancyLevel},
),
DownloadAttempts: prometheus.NewCounterVec(
prometheus.CounterOpts{
Expand All @@ -58,7 +63,7 @@ func newMetrics(subsystem string) metrics {
Name: "download_attempts",
Help: "Number of download attempts.",
},
[]string{labelSizeBytes, labelNodeName},
[]string{labelSizeBytes, labelNodeName, labelRedundancyLevel},
),
UploadErrors: prometheus.NewCounterVec(
prometheus.CounterOpts{
Expand All @@ -67,7 +72,7 @@ func newMetrics(subsystem string) metrics {
Name: "upload_errors_count",
Help: "The total number of errors encountered before successful upload.",
},
[]string{labelSizeBytes, labelNodeName},
[]string{labelSizeBytes, labelNodeName, labelRedundancyLevel},
),
DownloadErrors: prometheus.NewCounterVec(
prometheus.CounterOpts{
Expand All @@ -76,7 +81,7 @@ func newMetrics(subsystem string) metrics {
Name: "download_errors_count",
Help: "The total number of errors encountered before successful download.",
},
[]string{labelSizeBytes, labelNodeName},
[]string{labelSizeBytes, labelNodeName, labelRedundancyLevel},
),
DownloadMismatch: prometheus.NewCounterVec(
prometheus.CounterOpts{
Expand All @@ -85,27 +90,27 @@ func newMetrics(subsystem string) metrics {
Name: "download_mismatch",
Help: "The total number of times uploaded data is different from downloaded data.",
},
[]string{labelSizeBytes, labelNodeName},
[]string{labelSizeBytes, labelNodeName, labelRedundancyLevel},
),
UploadDuration: prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "data_upload_duration",
Help: "Data upload duration through the /bytes endpoint.",
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10, 25, 50, 100, 250, 600, 1200},
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10, 25, 50, 100, 250, 600, 1200, 1800, 3600},
},
[]string{labelSizeBytes, labelNodeName},
[]string{labelSizeBytes, labelNodeName, labelRedundancyLevel},
),
DownloadDuration: prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "data_download_duration",
Help: "Data download duration through the /bytes endpoint.",
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10, 25, 50, 100, 250, 600, 1200},
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10, 25, 50, 100, 250, 600, 1200, 1800, 3600},
},
[]string{labelSizeBytes, labelNodeName},
[]string{labelSizeBytes, labelNodeName, labelRedundancyLevel},
),
UploadThroughput: prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Expand All @@ -114,7 +119,7 @@ func newMetrics(subsystem string) metrics {
Name: "upload_throughput_bytes_per_second",
Help: "Upload throughput in bytes per second.",
},
[]string{labelSizeBytes, labelNodeName},
[]string{labelSizeBytes, labelNodeName, labelRedundancyLevel},
),
DownloadThroughput: prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Expand All @@ -123,7 +128,43 @@ func newMetrics(subsystem string) metrics {
Name: "download_throughput_bytes_per_second",
Help: "Download throughput in bytes per second.",
},
[]string{labelSizeBytes, labelNodeName},
[]string{labelSizeBytes, labelNodeName, labelRedundancyLevel},
),
UploadSuccess: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "upload_success",
Help: "Number of successful uploads.",
},
[]string{labelSizeBytes, labelNodeName, labelRedundancyLevel},
),
DownloadSuccess: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "download_success",
Help: "Number of successful downloads with matching data.",
},
[]string{labelSizeBytes, labelNodeName, labelRedundancyLevel},
),
UploadedBytes: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "uploaded_bytes_total",
Help: "Total bytes successfully uploaded.",
},
[]string{labelNodeName, labelRedundancyLevel},
),
DownloadedBytes: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "downloaded_bytes_total",
Help: "Total bytes successfully downloaded.",
},
[]string{labelNodeName, labelRedundancyLevel},
),
}
}
Expand Down
Loading
Loading