Skip to content

feat(byoo-perf): measure a baseline and report results - #637

Open
shobham-nv wants to merge 1 commit into
mainfrom
shobham/420-byoo-perf-measure
Open

feat(byoo-perf): measure a baseline and report results#637
shobham-nv wants to merge 1 commit into
mainfrom
shobham/420-byoo-perf-measure

Conversation

@shobham-nv

@shobham-nv shobham-nv commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the measurement + reporting milestone to the BYOO collector performance suite. perf run now drives telemetrygen load against the authentic collector (rendered through the shared icms-translate library), scrapes the collector and in-cluster OTLP sink via the API-server proxy, and computes a reproducible baseline (throughput, drops, end-to-end delivery, CPU/memory, pod health).

  • Loops the profile's repetitions (dev = 1, baseline = 3); each run is persisted separately (<shape>.json, or <shape>-run<N>.json for several).
  • Every result carries a status: ok, partial (a metric series or pod health was missing), or invalid (load generators did not complete cleanly), so a failed run is never mistaken for a clean baseline.
  • Metric snapshots are scraped concurrently and timestamped after both responses return; each scrape is bounded by a timeout so an unresponsive pod cannot stall the run.
  • run waits for the load-generator pods to start before the warmup so pod scheduling / image-pull latency stays out of the measurement window.
  • No pass/fail thresholds yet; the numbers establish a reproducible baseline.

Testing

  • GOWORK=off go build/vet/test ./... for the perf module: all green.
  • End-to-end validated in managed k3d mode (suite provisions and deletes the cluster automatically):
cd src/compute-plane-services/byoo-otel-collector/perf
GOWORK=off go run ./cmd/perf run --shape container --import-images --results-dir ./results

Result: PASS (status ok) — collector accepted the generated telemetry and delivered ~100% to the in-cluster sink, with no restarts and no OOM kills over a ~30s window (container shape, dev profile).

Metric Logs Metrics
Collector accepted 26,083 26,170
Sink received 26,124 26,185
Throughput (per sec) 870.5 872.5
Delivery ratio ~1.00 ~1.00
Exporter failed 0 0
Collector refused 0 0
Resource / health Value
CPU (avg cores over window) 0.136
Memory RSS ~118 MiB (123,772,928 bytes)
Pod phase / restarts / OOM Running / 0 / false
Report status ok
Raw baseline (perf/results/container.json)
{
  "shape": "container",
  "profile": "dev",
  "run": 1,
  "repetitions": 1,
  "status": "ok",
  "window_seconds": 30.010872708,
  "logs": {
    "generated_expected": 30010.872708000003,
    "collector_accepted": 26083,
    "collector_refused": 0,
    "exporter_sent": 26124,
    "exporter_failed": 0,
    "sink_accepted": 26124,
    "throughput_per_sec": 870.4845158680148,
    "delivery_ratio": 1.0015719050722693
  },
  "metrics": {
    "generated_expected": 30010.872708000003,
    "collector_accepted": 26170,
    "collector_refused": 0,
    "exporter_sent": 26185,
    "exporter_failed": 0,
    "sink_accepted": 26185,
    "throughput_per_sec": 872.5171125403448,
    "delivery_ratio": 1.0005731753916698
  },
  "resources": {
    "cpu_cores_avg": 0.13628394081688028,
    "mem_rss_bytes": 123772928
  },
  "health": {
    "phase": "Running",
    "restarts": 0,
    "oom_killed": false
  }
}

Summary by CodeRabbit

  • New Features

    • Added structured performance baseline reports with throughput, delivery, resource, and health metrics.
    • Added repeated test runs, per-run status tracking, human-readable summaries, and optional JSON result files.
    • Added support for collecting workload and service metrics with timeout handling.
    • Improved credential handling and workload startup monitoring.
    • Preserved workload ownership metadata for more accurate test identification.
  • Documentation

    • Updated performance testing documentation with reporting, baselines, result storage, and metric handling details.
  • Chores

    • Updated the BYOO OTEL Collector version to 0.157.18.

@shobham-nv
shobham-nv requested a review from a team as a code owner August 3, 2026 18:57
@shobham-nv
shobham-nv requested a review from balajinvda August 3, 2026 18:57
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The performance suite now executes repeated load and measurement cycles. It parses collector and sink metrics, computes baseline reports with pod health, records partial or invalid results, and optionally persists JSON output.

Changes

Performance baseline measurement

Layer / File(s) Summary
Prometheus metric parsing
src/compute-plane-services/byoo-otel-collector/perf/pkg/report/prom.go, src/compute-plane-services/byoo-otel-collector/perf/pkg/report/prom_test.go
Adds tolerant Prometheus parsing, label handling, candidate metric matching, summation, and gauge selection with tests.
Baseline report construction
src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report.go, src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report_test.go
Adds report models and calculations for throughput, delivery, resource usage, pod health, completeness status, JSON output, and text summaries.
Load lifecycle and pod telemetry
src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/*, src/compute-plane-services/byoo-otel-collector/perf/pkg/sink/sink.go
Separates load start from load wait, changes credential injection to accounts-secrets.json, adds bounded pod-metric scraping and pod-health reporting, and exports the sink metrics port.
Repeated baseline execution and persistence
src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/*, src/compute-plane-services/byoo-otel-collector/perf/README.md
Runs configured repetitions, collects measurements, handles failures per run, writes optional result files, and documents the workflow.
Host metadata preservation
src/compute-plane-services/byoo-otel-collector/perf/pkg/render/*
Preserves host pod labels and annotations on translated collector workloads.
Collector version update
src/compute-plane-services/byoo-otel-collector/VERSION
Updates the collector version from 0.157.14 to 0.157.18.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PerfRunner
  participant DeployClient
  participant Collector
  participant Sink
  participant ReportBuilder
  participant ResultsDir
  PerfRunner->>DeployClient: StartLoad jobs
  PerfRunner->>Collector: Scrape collector metrics
  PerfRunner->>Sink: Scrape sink metrics
  PerfRunner->>DeployClient: WaitLoad jobs
  PerfRunner->>DeployClient: Collect pod health
  PerfRunner->>ReportBuilder: Build baseline report
  ReportBuilder->>ResultsDir: Persist JSON result
Loading

Suggested reviewers: balajinvda

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 43.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and accurately describes the primary baseline measurement and reporting changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch shobham/420-byoo-perf-measure

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies"


Comment @coderabbitai help to get the list of available commands.

@sbaum1994 sbaum1994 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Go review findings from the performance-reporting changes.

Comment thread src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go Outdated
Comment thread src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report.go Outdated
Comment thread src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go Outdated
Comment thread src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy.go Outdated
@shobham-nv
shobham-nv force-pushed the shobham/419-byoo-perf-loadgen-sink branch from 89ae4fa to 833b809 Compare August 10, 2026 15:51
Base automatically changed from shobham/419-byoo-perf-loadgen-sink to main August 10, 2026 19:32
@shobham-nv
shobham-nv force-pushed the shobham/420-byoo-perf-measure branch from c64a39d to 01f5652 Compare August 11, 2026 04:53

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go`:
- Line 162: Update the help text for the results-dir flag in the command’s flag
definition to state that structured JSON output includes one file per shape and
repetition, matching the filenames generated by the multi-repetition write path.
- Around line 372-383: Update the repetition flow around StartLoad and measure
so it waits for every load-generator pod to reach started/running state before
measurement warmup begins. Use a bounded timeout context for this readiness
wait, propagate timeout or startup errors, and add a delayed-start test covering
pods that become ready after job creation.
- Around line 441-453: Update the flow around PodHealth and report.Build to
record health-query errors in Notes and mark the report partial when health is
unavailable, instead of passing an indistinguishable zero-value health result.
Ensure a later load-completion failure still takes precedence and preserves
invalid status, and add a test covering PodHealth failure.
- Around line 419-439: Update the snap function so Snapshot.At reflects when the
metric samples are captured, not when scraping begins. Perform the collector and
sink scrapes concurrently, then apply an explicit common timestamp after
successful responses are received; preserve warning handling for scrape errors.
Add coverage for delayed successful scrapes verifying the resulting window
duration and throughput denominator use the aligned snapshot timestamps.

In `@src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report.go`:
- Around line 164-176: Update Build in
src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report.go (lines
164-176) to capture and pass the ok result from counterDelta to note for every
refused, sent, and failed logs and metrics counter. In
src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report_test.go
(lines 69-112), add all required reported counters to the complete fixture or
assert the resulting notes and partial status; in lines 129-140, require every
reported counter for completeness.

In `@src/compute-plane-services/byoo-otel-collector/perf/README.md`:
- Around line 10-12: Replace the em dash in the README sentence describing
pass/fail thresholds with ASCII punctuation, such as a period or semicolon,
while preserving the sentence’s meaning.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5e8e3159-f345-4146-bff0-ed433eb4e2a4

📥 Commits

Reviewing files that changed from the base of the PR and between f711515 and 01f5652.

📒 Files selected for processing (11)
  • src/compute-plane-services/byoo-otel-collector/VERSION
  • src/compute-plane-services/byoo-otel-collector/perf/README.md
  • src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go
  • src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main_test.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy_test.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/report/prom.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/report/prom_test.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report_test.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/sink/sink.go

Comment thread src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go Outdated
Comment thread src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go Outdated
Comment thread src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report.go Outdated
Comment thread src/compute-plane-services/byoo-otel-collector/perf/README.md Outdated
@shobham-nv
shobham-nv force-pushed the shobham/420-byoo-perf-measure branch from 01f5652 to d6ca79e Compare August 11, 2026 13:06

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (3)
src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy_loadgen_test.go (1)

274-284: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Join the pod-creation goroutine before the subtest ends.

The goroutine writes to the fake clientset without synchronization with the test body. If WaitLoadStarted fails, the subtest can finish while the goroutine still creates pods. That leaks a goroutine into the next subtest and can log after the test completes. Use a channel or sync.WaitGroup to join before returning.

♻️ Proposed change
+			done := make(chan struct{})
 			go func() {
+				defer close(done)
 				time.Sleep(50 * time.Millisecond)
 				for _, j := range jobs {
 					_, _ = cs.CoreV1().Pods("byoo-perf").Create(ctx, runningLoadPod("byoo-perf", j.Name, jobLabelKey), metav1.CreateOptions{})
 				}
 			}()
+			defer func() { <-done }()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy_loadgen_test.go`
around lines 274 - 284, Synchronize the pod-creation goroutine in the test
around WaitLoadStarted by adding a completion channel or sync.WaitGroup, and
wait for it before the subtest can return, including when WaitLoadStarted fails.
Keep the existing delayed creation behavior and ensure the fake clientset writes
finish before test cleanup.
src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go (1)

581-589: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

sleep hides context cancellation.

If the context is cancelled, sleep returns at once and measure continues to the next snapshot. The report is then built from a truncated window but still carries status="ok". Return the cancellation to the caller and mark the report invalid.

♻️ Proposed change
-func sleep(ctx context.Context, d time.Duration) {
+func sleep(ctx context.Context, d time.Duration) error {
 	t := time.NewTimer(d)
 	defer t.Stop()
 	select {
 	case <-ctx.Done():
+		return ctx.Err()
 	case <-t.C:
+		return nil
 	}
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go` around
lines 581 - 589, Update sleep to return the context cancellation error when
ctx.Done() fires, while returning nil after the timer completes. In measure,
propagate that error and mark the generated report invalid instead of continuing
with the truncated snapshot window or leaving status="ok".
src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy.go (1)

378-385: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

WaitLoadStarted applies timeout per Job, not to the whole wait.

The loop calls waitJobPodStarted for each Job with the full timeout. With two generator Jobs the worst-case wait is 2 * timeout. The caller passes cfg.readyTimeout (default 3m), so a stuck run can block for 6 minutes before the measurement window starts. Derive one deadline for the whole set if you want a bounded startup wait.

♻️ Proposed change to bound the total wait
 func (c *Client) WaitLoadStarted(ctx context.Context, namespace string, jobs []*batchv1.Job, timeout time.Duration) error {
+	deadline := time.Now().Add(timeout)
 	for _, j := range jobs {
-		if err := c.waitJobPodStarted(ctx, namespace, j.Name, timeout); err != nil {
+		remaining := time.Until(deadline)
+		if remaining <= 0 {
+			return fmt.Errorf("timed out waiting for load generator job %q pod to start", j.Name)
+		}
+		if err := c.waitJobPodStarted(ctx, namespace, j.Name, remaining); err != nil {
 			return err
 		}
 	}
 	return nil
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy.go`
around lines 378 - 385, Update Client.WaitLoadStarted to enforce timeout across
all jobs rather than per job: derive a single deadline from the initial timeout,
pass each waitJobPodStarted call only the remaining duration, and return the
existing error when the overall deadline is exhausted.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go`:
- Around line 370-394: Adjust the load duration used by the generator Jobs in
the baseline and corresponding measurement paths so it includes the startup
delay between client.StartLoad and WaitLoadStarted, ensuring measure’s warmup
and measurement window finish before generators stop. Preserve the existing
profile warmup and measurement values, and add a test covering that the measured
window ends before generator termination.

In `@src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy.go`:
- Around line 397-415: Update waitJobPodStarted to ignore pods belonging to
previous Job runs while polling. Use the current Job’s UID as the pod owner
filter, or otherwise restrict pods by creation time, before evaluating phases;
only return failure for a Failed pod owned by the current job while continuing
to detect Running or Succeeded pods.

In `@src/compute-plane-services/byoo-otel-collector/perf/pkg/render/render.go`:
- Around line 160-167: Add regression tests covering the Render-to-BenchPod
flow: verify owner labels and annotations propagate, suite labels override only
intended keys, and mutating the returned Pod does not mutate Result. Use the
existing Render and BenchPod test symbols and run the repository-native Go test
runner.

---

Nitpick comments:
In `@src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go`:
- Around line 581-589: Update sleep to return the context cancellation error
when ctx.Done() fires, while returning nil after the timer completes. In
measure, propagate that error and mark the generated report invalid instead of
continuing with the truncated snapshot window or leaving status="ok".

In
`@src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy_loadgen_test.go`:
- Around line 274-284: Synchronize the pod-creation goroutine in the test around
WaitLoadStarted by adding a completion channel or sync.WaitGroup, and wait for
it before the subtest can return, including when WaitLoadStarted fails. Keep the
existing delayed creation behavior and ensure the fake clientset writes finish
before test cleanup.

In `@src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy.go`:
- Around line 378-385: Update Client.WaitLoadStarted to enforce timeout across
all jobs rather than per job: derive a single deadline from the initial timeout,
pass each waitJobPodStarted call only the remaining duration, and return the
existing error when the overall deadline is exhausted.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 773a4179-4f0e-4293-a3cc-b175848c6dce

📥 Commits

Reviewing files that changed from the base of the PR and between 01f5652 and d6ca79e.

📒 Files selected for processing (9)
  • src/compute-plane-services/byoo-otel-collector/VERSION
  • src/compute-plane-services/byoo-otel-collector/perf/README.md
  • src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go
  • src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main_test.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy_loadgen_test.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/render/render.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/compute-plane-services/byoo-otel-collector/VERSION
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/report/report.go
  • src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main_test.go
  • src/compute-plane-services/byoo-otel-collector/perf/README.md

run now measures the collector over the profile's window and emits a baseline
(there are no pass/fail thresholds yet).

- pkg/report: a small Prometheus text parser plus baseline computation. It
  matches candidate metric names per concept (suffixes vary across
  collector-contrib versions), computes per-signal throughput, drops,
  end-to-end delivery (sink accepted / collector accepted), collector CPU
  (avg cores) and RSS, and records pod restart/OOM health. Missing series are
  noted, not fatal. Emits a human summary and JSON.
- deploy: ScrapePodMetrics via the API-server proxy (no metrics-server or
  port-forward needed), PodHealth, and a StartLoad/WaitLoad split so metrics
  can be sampled while load is in flight.
- run: after warmup, snapshots the collector + sink at the start and end of the
  measurement window, builds the report, prints the summary, and writes
  <results-dir>/<shape>.json when --results-dir is set.

Signed-off-by: shobham <shobham@nvidia.com>
@shobham-nv
shobham-nv force-pushed the shobham/420-byoo-perf-measure branch from d6ca79e to 4603cd3 Compare August 11, 2026 13:21
@shobham-nv
shobham-nv requested a review from sbaum1994 August 11, 2026 13:24

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/compute-plane-services/byoo-otel-collector/perf/pkg/render/render_test.go (1)

105-130: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the metrics egress label overlay.

common.BYOOMetricsEgressTargetLabelKey is a suite override in Lines 105-109. The test only asserts the other two suite labels. Add an assertion for its expected value so a removed or incorrect metrics-egress overlay fails the test.

Proposed test addition
  if pod.Labels[common.K8sAppNameLabelKey] != common.ByooOTelCollectorPodNameBase {
    t.Errorf("suite app-name label = %q, want %q", pod.Labels[common.K8sAppNameLabelKey], common.ByooOTelCollectorPodNameBase)
  }
+ if pod.Labels[common.BYOOMetricsEgressTargetLabelKey] != common.BYOOMetricsEgressTargetLabelValue {
+   t.Errorf("suite metrics-egress label = %q, want %q", pod.Labels[common.BYOOMetricsEgressTargetLabelKey], common.BYOOMetricsEgressTargetLabelValue)
+ }

As per coding guidelines, “Code changes must include tests,” and as per path instructions, “Add or update tests for code changes.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/compute-plane-services/byoo-otel-collector/perf/pkg/render/render_test.go`
around lines 105 - 130, The test around the suite label assertions in the
relevant render test must also validate the metrics egress overlay. Add an
assertion for pod.Labels[common.BYOOMetricsEgressTargetLabelKey] against its
expected suite value, alongside the existing app-name and part-of label checks,
so an incorrect or missing overlay fails the test.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy_loadgen_test.go`:
- Around line 82-90: Update the fake client setup used by the deployment test to
add a create reactor that converts Secret.StringData entries into Secret.Data
and clears StringData, matching Kubernetes API conversion behavior. In the
credential assertion around accountsSecretsFile, read and unmarshal
secret.Data[accountsSecretsFile] instead of secret.StringData.

---

Nitpick comments:
In
`@src/compute-plane-services/byoo-otel-collector/perf/pkg/render/render_test.go`:
- Around line 105-130: The test around the suite label assertions in the
relevant render test must also validate the metrics egress overlay. Add an
assertion for pod.Labels[common.BYOOMetricsEgressTargetLabelKey] against its
expected suite value, alongside the existing app-name and part-of label checks,
so an incorrect or missing overlay fails the test.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7e090cb9-8636-46c5-b1b5-ef19387799df

📥 Commits

Reviewing files that changed from the base of the PR and between d6ca79e and 4603cd3.

📒 Files selected for processing (7)
  • src/compute-plane-services/byoo-otel-collector/VERSION
  • src/compute-plane-services/byoo-otel-collector/perf/README.md
  • src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go
  • src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main_test.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy_loadgen_test.go
  • src/compute-plane-services/byoo-otel-collector/perf/pkg/render/render_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/compute-plane-services/byoo-otel-collector/perf/README.md
  • src/compute-plane-services/byoo-otel-collector/VERSION
  • src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main_test.go
  • src/compute-plane-services/byoo-otel-collector/perf/cmd/perf/main.go

Comment on lines +82 to +90
// The secret carries a single accounts-secrets.json holding the name->token
// map; the collector's extractor flattens it into per-signal token files.
raw, ok := secret.StringData[accountsSecretsFile]
if !ok {
t.Fatalf("secret missing %q key: %+v", accountsSecretsFile, secret.StringData)
}
var got map[string]string
if err := json.Unmarshal([]byte(raw), &got); err != nil {
t.Fatalf("accounts-secrets.json is not valid JSON: %v", err)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

For Kubernetes v1.34, does corev1.Secret.StringDatapersist in GET responses, or does the API server merge it intocorev1.Secret.Data?

💡 Result:

For Kubernetes v1.34, the corev1.Secret.StringData field does not persist in GET responses, and the API server merges it into the corev1.Secret.Data field at write time [1][2][3]. Key behaviors regarding this field include: - Write-Only Nature: StringData is a convenience field intended for write-only input [1][4]. It allows users to specify non-binary secret data in plaintext strings, which the API server then automatically encodes and merges into the Data field [5][6]. - No Persistence: The StringData field is not stored in etcd and is never returned in responses when reading (GET) from the API [1][2][7]. When you retrieve a Secret via a GET request, you will see the populated Data field with base64-encoded values, but the StringData field will be absent from the output [6][4]. - Merging Logic: During a create or update operation, if both Data and StringData are provided, the values in StringData take precedence and are merged into the Data field, overwriting any existing values for those keys [1][5][6]. Because of this one-way conversion and the lack of persistence, using StringData can be problematic for workflows that rely on observing the original input field, such as certain GitOps diffing or admission control processes [7][4].

Citations:


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- guidance files ---'
find .. -name AGENTS.md -print
printf '%s\n' '--- target file outline ---'
ast-grep outline src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy_loadgen_test.go
printf '%s\n' '--- target lines ---'
sed -n '1,150p' src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy_loadgen_test.go
printf '%s\n' '--- Secret construction and fake-client setup ---'
rg -n -C 4 'StringData|accountsSecretsFile|fake\.NewSimpleClientset|NewClient|Secret' src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy_loadgen_test.go

Repository: NVIDIA/nvcf

Length of output: 15111


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- repository guidance ---'
cat -n AGENTS.md
printf '%s\n' '--- byoo-otel-collector guidance ---'
cat -n src/compute-plane-services/byoo-otel-collector/AGENTS.md
printf '%s\n' '--- relevant deploy symbols ---'
rg -n -C 8 'WithExportCredentials|accountsSecretsFile|StringData|Secret\{' src/compute-plane-services/byoo-otel-collector/perf/pkg
printf '%s\n' '--- module and cached fake-client sources ---'
rg -n 'k8s.io/client-go|k8s.io/api' go.mod src/compute-plane-services/byoo-otel-collector/go.mod 2>/dev/null || true
fd -i 'fake' ../go/pkg/mod/k8s.io/client-go* 2>/dev/null | head -20 || true

Repository: NVIDIA/nvcf

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -eu
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
cat >"$tmpdir/go.mod" <<'EOF'
module secret-field-probe

go 1.23

require (
	k8s.io/api v0.34.2
	k8s.io/client-go v0.34.2
)
EOF
cat >"$tmpdir/main.go" <<'EOF'
package main

import (
	"context"
	"fmt"

	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes/fake"
)

func main() {
	cs := fake.NewSimpleClientset()
	in := &corev1.Secret{
		ObjectMeta: metav1.ObjectMeta{Name: "credentials", Namespace: "test"},
		StringData: map[string]string{"accounts-secrets.json": `{"perf-logs":"tok-a"}`},
	}
	if _, err := cs.CoreV1().Secrets("test").Create(context.Background(), in, metav1.CreateOptions{}); err != nil {
		panic(err)
	}
	out, err := cs.CoreV1().Secrets("test").Get(context.Background(), "credentials", metav1.GetOptions{})
	if err != nil {
		panic(err)
	}
	fmt.Printf("StringData key present: %t\n", out.StringData["accounts-secrets.json"] != "")
	fmt.Printf("Data key present: %t\n", len(out.Data["accounts-secrets.json"]) != 0)
}
EOF
(
	cd "$tmpdir"
	GOTOOLCHAIN=local GOPROXY=off go run .
)

Repository: NVIDIA/nvcf

Length of output: 575


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- fake client create/get implementation ---'
rg -n -C 8 'func \(.*\) Create|func \(.*\) Get|ObjectTracker|Add\(obj' ../go/pkg/mod/k8s.io/client-go@v0.34.2/testing ../go/pkg/mod/k8s.io/client-go@v0.34.2/kubernetes/fake | head -240
printf '%s\n' '--- Secret StringData/Data definitions ---'
rg -n -C 6 'type Secret struct|StringData|Data map' ../go/pkg/mod/k8s.io/api@v0.34.2/core/v1/types.go ../go/pkg/mod/k8s.io/api@v0.34.2/core/v1/generated.proto 2>/dev/null | head -180
printf '%s\n' '--- cached module checksums ---'
find ../go/pkg/mod/cache/download/k8s.io -path '*api*0.34.2*' -o -path '*client-go*0.34.2*' | head -80

Repository: NVIDIA/nvcf

Length of output: 28961


Model Secret conversion in the fake client before asserting credentials.

fake.NewSimpleClientset stores objects as-is, so this GET returns the StringData supplied by applyCredentialsSecret. Add a create reactor that merges StringData into Data and clears StringData, then assert secret.Data[accountsSecretsFile].

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/compute-plane-services/byoo-otel-collector/perf/pkg/deploy/deploy_loadgen_test.go`
around lines 82 - 90, Update the fake client setup used by the deployment test
to add a create reactor that converts Secret.StringData entries into Secret.Data
and clears StringData, matching Kubernetes API conversion behavior. In the
credential assertion around accountsSecretsFile, read and unmarshal
secret.Data[accountsSecretsFile] instead of secret.StringData.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants