Skip to content

feat(redundancy): add redundancy level configuration for smoke check#556

Open
akrem-chabchoub wants to merge 12 commits intomasterfrom
feat/smoke-redundancy-option
Open

feat(redundancy): add redundancy level configuration for smoke check#556
akrem-chabchoub wants to merge 12 commits intomasterfrom
feat/smoke-redundancy-option

Conversation

@akrem-chabchoub
Copy link
Contributor

@akrem-chabchoub akrem-chabchoub commented Jan 2, 2026

Smoke check redundancy level option

Summary

Adds configurable redundancy levels to the smoke check so upload/download can be tested at different r-levels (0, 2, 4). The Bee API is extended to send the Swarm-Redundancy-Level header on upload and download, and smoke metrics are extended with a redundancy_level dimension plus success/bytes counters.


What changed

Config and API

  • config/local.yaml – Smoke check gains r-levels: [0, 2, 4] so each file size is tested for each level.
  • pkg/bee/api/ – New Swarm-Redundancy-Level header:
    • Upload: UploadOptions.RLevel and header set in bytes upload.
    • Download: DownloadOptions.RLevel and header set in requestDataGetHeader; optional RedundancyFallbackMode used in tests.
  • pkg/config/check.go – New RLevels option: YAML r-levels is decoded and applied to the smoke check options.

Smoke check

  • pkg/check/smoke/smoke.go – Smoke runs over file sizes × redundancy levels: for each size, it iterates over r-levels, uploads with that level, then downloads with the same level (and fallback). Retries and error handling (upload skip on failure, topology logging on download failure) are preserved; metrics use a redundancy_level label.
  • pkg/check/smoke/metrics.go – New metrics: upload_success, download_success, uploaded_bytes_total, downloaded_bytes_total. Existing smoke metrics get a redundancy_level label. Duration histograms get extra buckets (e.g. 1800, 3600 s) for long-running runs.

Copilot AI review requested due to automatic review settings January 2, 2026 14:07
@akrem-chabchoub akrem-chabchoub self-assigned this Jan 2, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for configuring erasure coding redundancy levels in smoke tests to enable testing of Bee's redundancy features. The implementation adds a new r-level configuration option that can be set from 0 (NONE) to 4 (PARANOID), allowing smoke tests to verify proper redundancy behavior.

Key changes:

  • Added RLevel field to smoke test options with configurable YAML parameter r-level
  • Extended upload/download test methods to accept and handle redundancy levels
  • Added conditional Swarm-Redundancy-Level HTTP header for uploads when redundancy is enabled
  • Enabled redundancy fallback mode for downloads when using redundancy levels

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/check/smoke/smoke.go Added RLevel option field with default value of redundancy.NONE and logging of redundancy level during test execution
pkg/config/check.go Added YAML parsing for r-level option with uint8-to-Level type conversion in applyCheckConfig
pkg/test/test.go Updated Upload and Download methods to accept redundancy level parameter and conditionally set download options
pkg/bee/api/options.go Added RLevel field to UploadOptions struct to pass redundancy level to API
pkg/bee/api/bytes.go Added conditional Swarm-Redundancy-Level HTTP header when redundancy level is not NONE
pkg/bee/api/api.go Added redundancyLevelHeader constant definition
pkg/check/load/load.go Updated to pass redundancy.NONE to maintain backward compatibility for load tests
config/local.yaml Added example configuration with r-level: 2 (STRONG) for ci-smoke check

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +750 to +762
case "RLevel":
if !lv.Field(i).IsNil() { // set locally
fieldValue := lv.FieldByName(fieldName).Elem()
level := uint8(fieldValue.Uint())
rLevel := beeRedundancy.Level(level)
ft, ok := ot.FieldByName(fieldName)
if ok {
v := reflect.ValueOf(rLevel)
if v.Type().AssignableTo(ft.Type) {
ov.FieldByName(fieldName).Set(v)
}
}
}
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing validation for the redundancy level value. The configuration accepts any uint8 value (0-255), but only values 0-4 are valid according to the PR description. Values outside this range will silently create invalid redundancy.Level values. Consider adding validation in the applyCheckConfig function to ensure the value is within the valid range of 0-4.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally omitted validation in Beekeeper.
The Bee API validates redundancy levels, so invalid values (e.g., 5+) are rejected with clear errors.
This keeps Beekeeper future-proof: if Bee adds level 5 or higher, Beekeeper supports it without code changes.

@bcsorvasi bcsorvasi added this to the bee-v2.7.0 milestone Jan 6, 2026
UploadTimeout: 60 * time.Minute,
DownloadTimeout: 60 * time.Minute,
IterationWait: 5 * time.Minute,
RLevels: []redundancy.Level{redundancy.PARANOID},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe best to leave it empty (wihout specifying any level), and ensure that default behaviour is used (and that check is working like it worked before)

if rLevel != nil && *rLevel != redundancy.NONE {
fallbackMode := true
downloadOpts = &api.DownloadOptions{
RLevel: rLevel,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RLevel should be assigned only if it is defined in the yaml file where is the configuration for the checks.


address, duration, err = test.Upload(ctx, uploader, txData, batchID)
rLevel := redundancy.NONE
address, duration, err = test.Upload(ctx, uploader, txData, batchID, &rLevel)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need to have default value for the rLevel, we should take it from configuration directly as is, to be backwards compatibile. If the rLevel is defined we should forward it. If not, use nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can set it to nil and later we do proper update to load check ? because it will require some modification to the check itself, wdyt ?

@gacevicljubisa
Copy link
Member

Also, we should add label for the metrics because the results depending on the specified redundancy-level. Current metrics do not have this label, so if we add it, probably we will break the current dashboards. But we can update them in Grafana. Also, /bytes endpoint, currently is using None as default for upload, but Paranoid for download. So if not specified maybe we should use that values? Wdyt?

@gacevicljubisa gacevicljubisa linked an issue Mar 12, 2026 that may be closed by this pull request
gacevicljubisa and others added 4 commits March 12, 2026 11:27
…#575)

Add redundancy_level label to all smoke check metrics to enable
per-redundancy-level and per-file-size analysis in Grafana dashboards.

- Add redundancy_level label to all per-operation metric vectors
- Change throughput metrics from Gauge to Histogram for quantile support
- Add upload_success/download_success counters
- Add uploaded_bytes_total/downloaded_bytes_total counters
@gacevicljubisa
Copy link
Member

gacevicljubisa commented Mar 13, 2026

Grafana Dashboard Beekeeper - Smoke Check Performance for bee-light-testnet with this changes included

@gacevicljubisa gacevicljubisa self-assigned this Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Draft] Add different file sizes to Milestone Smoke Test

6 participants