Skip to content

feat[next]: add atexit handler to dump the performance metrics at exit#2481

Merged
egparedes merged 8 commits intoGridTools:mainfrom
egparedes:feature/autodump_metrics
Feb 19, 2026
Merged

feat[next]: add atexit handler to dump the performance metrics at exit#2481
egparedes merged 8 commits intoGridTools:mainfrom
egparedes:feature/autodump_metrics

Conversation

@egparedes
Copy link
Copy Markdown
Contributor

@egparedes egparedes commented Feb 13, 2026

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).

@egparedes egparedes marked this pull request as ready for review February 16, 2026 12:21
Copilot AI review requested due to automatic review settings February 16, 2026 12:21
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

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_EXIT with optional auto-generated output filename.
  • Registers an atexit handler in gt4py.next.instrumentation.metrics to 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.

Comment thread src/gt4py/next/config.py Outdated
Comment thread src/gt4py/next/config.py Outdated
Comment thread src/gt4py/next/instrumentation/metrics.py Outdated
Comment thread src/gt4py/next/instrumentation/metrics.py Outdated
Comment thread src/gt4py/next/instrumentation/metrics.py
Comment thread tests/next_tests/unit_tests/instrumentation_tests/test_metrics.py
Copy link
Copy Markdown
Contributor

@iomaganaris iomaganaris left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@egparedes egparedes merged commit 34b097f into GridTools:main Feb 19, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants