Add unified metrics collection framework (v1)#16064
Add unified metrics collection framework (v1)#16064Kangyan-Zhou merged 12 commits intosgl-project:mainfrom
Conversation
Implement dump_metric() function for test metrics collection:
- Outputs to JSONL (${SGLANG_TEST_METRICS_OUTPUT}.${pid}.jsonl)
- Outputs to stdout ([METRIC] format)
- Schema: required {filename, test_case, metric_name, value}
- Optional: {ts, labels}
- Supports int/float/str, coerces bool to int
- Auto-captures test context via PYTEST_CURRENT_TEST or inspect
- Never fails tests, all errors silently caught
Includes comprehensive unit tests covering:
- JSONL format validation
- Value type conversions
- Labels serialization handling
- Environment variable behavior
Part of sgl-project#15996 - unified CI metrics collection framework.
Summary of ChangesHello @harvenstar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request establishes a foundational, unified framework for collecting test metrics within the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable framework for unified metrics collection in tests, which will be very useful for CI performance tracking. The implementation is robust, featuring silent error handling to prevent test failures and a comprehensive set of unit tests. I have a few suggestions to enhance it further:
- In
test_dump_metric.py, I recommend refactoring to avoid code duplication insetUpandtearDownfor better maintainability. - In
dump_metric, I suggest adding logging for caught exceptions. This will significantly aid debugging when metrics are not being reported, without violating the "never fail" contract. - To improve the consistency and parsability of stdout logs, I propose using JSON serialization for the
labelsdictionary.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Per reviewer feedback, integrate the unified metrics collection framework
into run_eval() function to automatically report eval metrics in both
single-run and repeat-run scenarios.
This enables all evaluations using run_eval() to automatically output
metrics to the standardized JSONL format for CI performance tracking.
Metrics reported:
- {eval_name}_score: evaluation score (single-run mode)
- {eval_name}_latency: evaluation latency (single-run mode)
- {eval_name}_mean_score: mean score across runs (repeat mode)
All metrics include labels with model name, eval name, and repeat count
(when applicable) for better tracking and analysis.
|
/tag-and-rerun-ci |
|
/tag-and-rerun-ci |
- Add scripts/ci/merge_metrics.py to merge per-process JSONL files - Configure SGLANG_TEST_METRICS_OUTPUT in stage-b jobs - Upload metrics artifacts with if: always() for flaky test diagnosis - Include both merged and raw per-worker files for debugging Related to sgl-project#15996, follows up on sgl-project#16064
- Add scripts/ci/merge_metrics.py to merge per-process JSONL files - Configure SGLANG_TEST_METRICS_OUTPUT in stage-b jobs - Upload metrics artifacts with if: always() for flaky test diagnosis - Include both merged and raw per-worker files for debugging Related to sgl-project#15996, follows up on sgl-project#16064
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Implement dump_metric() function for test metrics collection:
Includes comprehensive unit tests covering:
Part of #15996 - unified CI metrics collection framework.
cc @Kangyan-Zhou @merrymercy