feat[next]: add atexit handler to dump the performance metrics at exit#2481
Merged
egparedes merged 8 commits intoGridTools:mainfrom Feb 19, 2026
Merged
feat[next]: add atexit handler to dump the performance metrics at exit#2481egparedes merged 8 commits intoGridTools:mainfrom
egparedes merged 8 commits intoGridTools:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an automatic (atexit-based) metrics dump facility to GT4Py Next so collected performance metrics can be written to JSON on interpreter shutdown, controlled via a new config flag/env var.
Changes:
- Introduces
GT4PY_DUMP_METRICS_AT_EXIT/config.DUMP_METRICS_AT_EXITwith optional auto-generated output filename. - Registers an
atexithandler ingt4py.next.instrumentation.metricsto dump metrics to JSON at exit. - Adds a unit test covering the new
_dump_metrics_at_exit()behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
src/gt4py/next/config.py |
Adds configuration/env-var handling to enable dumping metrics at exit and generate a default filename. |
src/gt4py/next/instrumentation/metrics.py |
Implements and registers the atexit dump handler that writes metrics JSON to disk. |
tests/next_tests/unit_tests/instrumentation_tests/test_metrics.py |
Adds coverage for the new exit-dump handler under enabled/disabled modes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an automatic (atexit-based) metrics dump facility to GT4Py so collected performance metrics can be written to disk on interpreter shutdown, controlled via a new config flag/env var (
GT4PY_DUMP_METRICS_AT_EXIT).