Skip to content

feature: Change csv to json events#77

Merged
arekay-nv merged 6 commits intomainfrom
arekay/json_events_log
Jan 2, 2026
Merged

feature: Change csv to json events#77
arekay-nv merged 6 commits intomainfrom
arekay/json_events_log

Conversation

@arekay-nv
Copy link
Copy Markdown
Collaborator

What does this PR do?

The CSV output for events contains the response text which may include commas and hence break the delimiters. A json output format seems more appropriate to represent the data.
This PR changes the CSV output for events to JSON.

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor/cleanup

Related issues

Testing

  • Tests added/updated
  • All tests pass locally
  • Manual testing completed

Checklist

  • Code follows project style
  • Pre-commit hooks pass
  • Documentation updated (if needed)

Signed-off-by: Rashid Kaleem <230885705+arekay-nv@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 24, 2025 19:37
@arekay-nv arekay-nv requested a review from a team as a code owner December 24, 2025 19:37
@arekay-nv arekay-nv requested review from nv-alicheng and viraatc and removed request for Copilot December 24, 2025 19:37
@github-actions github-actions bot requested a review from nvzhihanj December 24, 2025 19:37
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 24, 2025

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @arekay-nv, 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 refactors the event logging mechanism within the inference endpoint, moving from a CSV-based output to a more resilient JSON format. This change prevents data corruption caused by special characters in event payloads and provides a more structured and flexible way to store and process event logs, ultimately improving the reliability of benchmark data collection.

Highlights

  • Event Output Format Change: The primary change in this PR is the transition of event logging from CSV to JSON format. This addresses issues where commas within event data (like response text) could break CSV delimiters, ensuring more robust data integrity.
  • Parameter Renaming: The boolean parameter dump_events_csv has been renamed to dump_events_log across relevant functions (_run_test and start in session.py), reflecting the new, more general logging approach.
  • Reporter Method Update: The reporter.py file now includes a dump_to_json method, replacing the previous dump_to_csv. This new method writes events in JSON Lines (JSONL) format, with each line being a valid JSON object, and includes options for pretty-printing.
  • Benchmark Command Integration: The _run_benchmark function in benchmark.py has been updated to enable the new event logging by passing dump_events_log=True.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully replaces the CSV event output with a more robust JSONL format. The changes are well-contained and correctly update the parameter names and function calls across the affected files. I have one suggestion to ensure the generated JSONL file strictly adheres to the format's specification.

Copilot AI review requested due to automatic review settings December 31, 2025 17:40
Copy link
Copy Markdown

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 changes the event output format from CSV to JSON (JSONL) to properly handle response text containing commas that would break CSV delimiters.

Key Changes:

  • Renamed the dump_to_csv method to dump_to_json and updated it to output JSONL format (one JSON object per line)
  • Renamed the dump_events_csv parameter to dump_events_log throughout the codebase
  • Enabled event logging by default in the benchmark command

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/inference_endpoint/metrics/reporter.py Refactored CSV dumping to JSON output using orjson with formatted and sorted keys
src/inference_endpoint/load_generator/session.py Updated parameter names from dump_events_csv to dump_events_log and changed file extension to .json
src/inference_endpoint/commands/benchmark.py Enabled event logging by setting dump_events_log=True

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

Signed-off-by: Rashid Kaleem <230885705+arekay-nv@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 2, 2026 18:48
Copy link
Copy Markdown

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 2, 2026 20:54
Copy link
Copy Markdown

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

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


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

Comment on lines +1182 to 1183
+ "\n"
)
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.

String concatenation with + "\n" creates unnecessary intermediate string objects. Consider using f.write() twice (once for the JSON and once for the newline) or using an f-string for better performance in tight loops.

Suggested change
+ "\n"
)
)
f.write("\n")

Copilot uses AI. Check for mistakes.
@arekay-nv arekay-nv merged commit ddf2da3 into main Jan 2, 2026
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 2, 2026
@arekay-nv arekay-nv deleted the arekay/json_events_log branch January 2, 2026 21:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants