Commit afb80ec
✨ Add memory profiling plugin for e2e tests
Add comprehensive memory profiling and analysis tooling to help identify
and optimize memory usage during e2e test execution.
Features:
- Automatic heap profile collection during test runs
- Support for all e2e test types (test-e2e, test-experimental-e2e,
test-extension-developer-e2e, test-upgrade-e2e, test-upgrade-experimental-e2e)
- Detailed analysis of memory allocators and growth patterns
- Side-by-side comparison of test runs
- Integration with Claude Code via /memory-profile command
Usage:
./hack/tools/memory-profiling/memory-profile.sh run <test-name> [test-target]
./hack/tools/memory-profiling/memory-profile.sh analyze <test-name>
./hack/tools/memory-profiling/memory-profile.sh compare <test1> <test2>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
✨ Add Prometheus alerts tracking to memory profiling
Enhance memory profiling plugin to capture and analyze Prometheus alerts
during e2e test execution:
1. Set E2E_SUMMARY_OUTPUT environment variable during test runs
- Captures prometheus alerts, test failures, and other metrics
- Saved to e2e-summary.json in the profile directory
2. Updated analyze-profiles.sh to extract and display alerts
- Parses e2e-summary.json using jq (if available)
- Shows alert names, severities, and descriptions
- Includes test failures in the analysis report
3. Updated compare-profiles.sh to compare alerts between runs
- Shows alert counts for both tests
- Lists alerts detected in each test
- Helps identify if optimizations introduced new alerts
This allows correlating memory usage with system health metrics,
making it easier to identify if memory optimizations have any
negative side effects on system stability.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
🐛 Fix: Use absolute path for E2E_SUMMARY_OUTPUT
The e2e tests change directories during execution, causing the relative
path to e2e-summary.json to fail. Convert OUTPUT_DIR to an absolute path
before passing it to E2E_SUMMARY_OUTPUT.
This fixes the error:
'failed to write e2e test summary output: no such file or directory'
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
♻️ Rename e2e-summary.json to e2e-summary.md
The E2E test summary file contains Markdown content (with mermaid charts),
not JSON. This updates the file extension and parsing logic throughout the
memory profiling scripts to correctly handle the Markdown format.
Changes:
- run-profiled-test.sh: Output to e2e-summary.md instead of .json
- analyze-profiles.sh: Parse Markdown Alerts section instead of JSON
- compare-profiles.sh: Compare Markdown alert sections between tests
✨ Add multi-component memory profiling support
Refactored memory profiling tools to simultaneously analyze both
operator-controller and catalogd components:
**collect-profiles.sh:**
- Hardcoded dual-component collection (operator-controller + catalogd)
- Separate port forwards: localhost:6060 → operator-controller:6060,
localhost:6061 → catalogd:6060
- Creates component subdirectories for organized profile storage
- Collects profiles from both components simultaneously
**analyze-profiles.sh:**
- Removed backward compatibility for single-component analysis
- Now requires both component directories to exist
- Added analyze_component() function with stderr redirects to prevent
log pollution in captured output
- Generates combined analysis.md with sections for each component
- Executive Summary shows peak memory for both components
- Prometheus Alerts section remains test-wide (not per-component)
**run-profiled-test.sh:**
- Updated progress display to show both components:
"operator-controller: X, catalogd: Y"
- Enhanced summary output for dual-component results
Directory structure:
memory-profiles/
└── test-name/
├── operator-controller/
│ └── heap*.pprof
├── catalogd/
│ └── heap*.pprof
├── analysis.md
└── e2e-summary.md
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
🐛 Clean output directory before profiling runs
Previously, run-profiled-test.sh would create the output directory
with mkdir -p but not clean up existing files. This caused old profile
files to remain and potentially confuse analysis when mixing
single-component and multi-component data.
Now the script:
- Warns if the output directory already exists
- Removes the entire directory to start fresh
- Creates a clean directory for the new profiling run
This ensures each test run has clean, isolated data.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
🐛 Fix Prometheus alert parsing to include level-3 headers
The sed pattern '/^##/' was incorrectly matching both level-2 (##) and
level-3 (###) markdown headers, causing it to stop at "### Firing Alerts"
instead of continuing to "## Performance". This resulted in empty alert
sections even when alerts were present.
Changed pattern to '/^## /' (with space) to match only level-2 headers.
**Impact:**
- analyze-profiles.sh now correctly extracts and displays all alerts
- compare-profiles.sh now correctly detects alerts in both test runs
**Example:**
Before: "No Prometheus alerts detected" (incorrect)
After: Shows both pending alerts:
- operator-controller-memory-growth: 132.4kB/sec
- operator-controller-memory-usage: 107.9MB
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
♻️ Delete empty heap profiles after collection
Empty heap profiles (0 bytes) are created when the cluster is torn down
and the pod is killed during the final profile collection attempt. These
empty files skew analysis results by showing memory as 0K at the end,
incorrectly suggesting all memory was freed.
Now collect-profiles.sh deletes any empty heap*.pprof files at the end
of collection, ensuring analysis only processes valid profiles captured
during actual test execution.
**Impact:**
- Profile counts now reflect actual valid profiles (e.g., 25 instead of 26)
- Memory growth tables no longer show misleading "0K" final entry
- Peak memory correctly identified from real execution data
**Example:**
Before: heap24 (160K) → heap25 (0K) - misleading
After: heap24 (160K) as actual peak
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 1f6612c commit afb80ec
File tree
16 files changed
+2588
-3
lines changed- .claude
- commands
- hack/tools/memory-profiling
- helm/olmv1/templates
- manifests
16 files changed
+2588
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 41 | | |
45 | 42 | | |
46 | 43 | | |
| |||
50 | 47 | | |
51 | 48 | | |
52 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments