Add performance report generator pipeline - #116
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: siddardh-ra The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Two-stage pipeline for generating KB-style performance articles: - Stage 1 (generate_comparison.py): Fetches data from Horreum DB (read-only), applies MAD outlier detection, outputs structured JSON - Stage 2 (generate_article.py): Feeds JSON + prompt template to OpenAI API, produces a publishable markdown article Supports comparison, benchmark, and nightly modes. All DB connection details configured via HORREUM_DB_* environment variables. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3ec1f7a to
e2715d8
Compare
|
Since this PR touches around 11 files, here's a quick summary to make the review easier:
|
Stage 1 now saves raw_data_*.json (unprocessed DB rows) and mad_analysis_*.json (outlier detection results) so QE teams can trace report numbers back to source data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Use ROW_NUMBER() OVER (PARTITION BY group_key) to fetch N runs per group instead of N rows total, which was splitting across groups and leaving only 1 run per concurrency level. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
There was a problem hiding this comment.
Pull request overview
Adds a new reports/ pipeline that pulls performance data from a read-only Horreum PostgreSQL database, applies MAD-based outlier filtering plus summary statistics, then optionally generates Red Hat KB-style markdown articles via the OpenAI API.
Changes:
- Introduces Stage 1 data generation (
generate_comparison.py) with DB fetch, outlier exclusion, and structured JSON output (comparison + benchmark modes). - Introduces Stage 2 article generation (
generate_article.py) driven by markdown prompt templates for comparison and benchmark modes. - Adds a large, centralized
config.yamlfor metric/test/variant definitions and thresholds, plus documentation and gitignore entries.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| reports/README.md | Usage + operational documentation for the two-stage generator. |
| reports/generate_comparison.py | CLI entrypoint for DB→JSON generation and artifact writing. |
| reports/generate_article.py | CLI entrypoint for JSON→markdown KB article generation via OpenAI. |
| reports/lib/db.py | Horreum PostgreSQL query construction + run fetching (read-only). |
| reports/lib/stats.py | MAD outlier detection and benchmark/comparison statistics. |
| reports/lib/formatter.py | Shapes computed stats into LLM-friendly JSON, including top-N summaries. |
| reports/prompt_template.md | Comparison-mode KB article prompt template. |
| reports/prompt_template_benchmark.md | Benchmark-mode KB article prompt template. |
| reports/config.yaml | Metric, variant, test ID, and threshold configuration for the pipeline. |
| reports/lib/init.py | Marks reports/lib as a package. |
| .gitignore | Ignores generated report outputs and local artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Explain why Z-score and IQR fail at small sample sizes and why MAD was chosen, with configurable threshold documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use autocommit=True for read-only DB connection to avoid holding long-running transactions against production - Remove unused group_select variable left over from per-group refactor - Rename "CRITICAL" header in prompt templates to avoid echoing forbidden severity labels in generated articles - Add try/except around OpenAI API call for clearer error messages Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| return prompt | ||
|
|
||
|
|
||
| def call_openai(prompt, model, api_key): |
There was a problem hiding this comment.
I suggest we take this out to not depend on these big (?) libraries. We can just generate the prompt and then user can feed it into AI agent of their choice. We do not need this to be fully automated. Also is OpenAI approved thingy in RedHat?
There was a problem hiding this comment.
I had similar reservations while implementing this. My initial idea was to expose a report-generation API that managers or engineers could trigger to automatically generate the output, but that's more of a future enhancement. For now, I'm happy to keep this focused on prompt generation and let users use their preferred AI tool. If automation is needed later, we can revisit it using a Red Hat–approved LLM API.
There was a problem hiding this comment.
Updated the same on the latest commit
| @@ -0,0 +1,184 @@ | |||
| # Performance Comparison KB Article Generator | |||
There was a problem hiding this comment.
What is the difference between this file reports/prompt_template.md and reports/prompt_template_benchmark.md? Do we need both?
There was a problem hiding this comment.
The templates have some shared formatting and tone, but they serve different purposes.
prompt_template.mdis for version comparisons ({{VERSION_A}}vs{{VERSION_B}}), focusing on regressions, improvements, trade-offs, and percentage changes.prompt_template_benchmark.mdis for single-version benchmarking ({{VERSION}}), focusing on absolute performance, configuration comparisons, and deployment guidance.
So yes, I think both are needed. Comparison mode and benchmark mode produce different data, and each template is tailored to its respective output.
|
|
||
| Usage: | ||
| # Set DB connection via environment variables: | ||
| export HORREUM_DB_HOST="your-db-host" |
There was a problem hiding this comment.
I would rename this and remove all mentions of "Horreum" here as you are only talking to our PostgreSQL that contains mirror of Horreum data sets, not to actual Horreum PostgreSQL.
There was a problem hiding this comment.
Sure. And I've updated the corrected var name in the latest commit
- Rename HORREUM_DB_* env vars to POSTGRES_PIPELINE_DB_* and remove all Horreum mentions (connects to a PostgreSQL mirror, not Horreum) - Delete generate_article.py and OpenAI dependency — users feed the JSON + prompt template into their preferred LLM manually - Update README to reflect both changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…alues - Add static test setup section with repo links, scenario description, deployment configuration definitions, and all controller resource specs - Add anti-fabrication rules: never invent reasons for metric changes, never attribute changes to assumed code modifications - Add absolute value significance rules: do not highlight percentage changes on negligibly small values (e.g., millicores against 1-core limit) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…enarios Add prompt_template_internal_detailed_regression.md for generating internal engineering regression reports from comparison data. Update all three prompt templates with accurate per-component test scenarios (math for Pipelines, signing-tr-tekton-bigbang for Chains, timebased-sign-pruner for Results). Update generate_comparison.py to copy both templates in comparison mode. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Performance Report Generator Pipeline
Adds an automated two-stage pipeline for generating KB-style performance comparison articles for OpenShift Pipelines releases.
What it does
Supported modes
Statistical approach — MAD-based outlier detection
Performance CI runs 3-4 times per version. Infrastructure flakiness (noisy neighbors, node pressure) can produce one bad run that skews averages. Standard approaches (Z-score, IQR) are unreliable at this sample size.
We use Median Absolute Deviation (MAD) — a robust statistical method that uses the median instead of the mean, so a single outlier cannot shift the reference point. If a run has >50% of its metrics deviating beyond 2.5x MAD, the entire run is excluded as an infrastructure anomaly. A safety guardrail ensures at least 2 runs always survive.
Data Correctness and Validation
Stage 1 saves intermediate artifacts alongside the final output:
This allows teams to trace any number in the final report back to the source data.
Security