Skip to content

Add JSON output writer and Hydra output=json config#51

Open
izzet wants to merge 3 commits intollnl:developfrom
izzet:feature/json-output-file
Open

Add JSON output writer and Hydra output=json config#51
izzet wants to merge 3 commits intollnl:developfrom
izzet:feature/json-output-file

Conversation

@izzet
Copy link
Collaborator

@izzet izzet commented Mar 5, 2026

This pull request adds support for exporting analysis results in JSON format, including configuration, implementation, and end-to-end tests. The changes introduce a new JSONOutput class, update configuration and type definitions to support the new output type, and document the new feature for users.

JSON Output Feature

  • Added a new JSONOutput class to python/dftracer/analyzer/output.py that saves analysis results as a structured JSON file, including raw stats, per-view summaries, per-layer metrics, and additional metric statistics. The output file path is configurable.
  • Created a corresponding JSONOutputConfig dataclass in python/dftracer/analyzer/config.py and registered it with Hydra's config store, enabling users to select JSON output via configuration. [1] [2]

Type and Import Updates

  • Updated the OutputType union and imports in python/dftracer/analyzer/__init__.py to include JSONOutput, ensuring proper typing and discoverability. [1] [2]

Documentation

  • Added documentation for JSON output in docs/configuration.rst, describing its contents, configuration parameters, and default behavior.

Testing

  • Added an end-to-end test in tests/test_e2e.py to verify that JSON output is correctly produced, contains expected fields, and is written to the specified file path. [1] [2]

@izzet izzet requested a review from Copilot March 5, 2026 21:24
@izzet izzet self-assigned this Mar 5, 2026
@izzet izzet added the enhancement New feature or request label Mar 5, 2026
Copy link
Contributor

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 adds JSON output support to the DFAnalyzer tool, allowing users to export analysis results as structured JSON files instead of (or in addition to) the default console output. It includes a new JSONOutput class, a corresponding Hydra configuration dataclass, updated type exports, documentation, and an end-to-end test.

Changes:

  • Introduces JSONOutput class and JSONOutputConfig dataclass, registered with Hydra's config store under output=json
  • Refactors _additional_metric_scale_and_unit from ConsoleOutput up to the base Output class so it can be shared with JSONOutput
  • Adds an end-to-end smoke test validating JSON file creation and schema structure

Reviewed changes

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

Show a summary per file
File Description
python/dftracer/analyzer/output.py Adds JSONOutput class with handle_result, _create_raw_stats, _create_summary_payload, _create_additional_metrics_payload, _resolve_output_path; moves _additional_metric_scale_and_unit to base Output class
python/dftracer/analyzer/config.py Adds JSONOutputConfig dataclass and registers it with Hydra config store
python/dftracer/analyzer/__init__.py Imports and exports JSONOutput, adds it to OutputType union
tests/test_e2e.py Adds test_json_output_file smoke test verifying JSON output creation and schema
docs/configuration.rst Documents JSON output parameters and default behavior

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

izzet and others added 2 commits March 5, 2026 15:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants