Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[red-knot] Add metrics collection #16005

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft

[red-knot] Add metrics collection #16005

wants to merge 18 commits into from

Conversation

dcreager
Copy link
Member

@dcreager dcreager commented Feb 6, 2025

This adds metrics collection to red-knot.

[rendered README]

Work in progress

@dcreager dcreager added the red-knot Multi-file analysis & type inference label Feb 6, 2025
@dcreager
Copy link
Member Author

dcreager commented Feb 6, 2025

I still want to add more actual metrics (and verify that there aren't any performance regressions), but I'm pushing this up for visibility.

Overview documentation available in the README.

Collect metrics by passing the --metrics flag:

$ ./red_knot check --project ~/git/py/black --venv-path .venv --extra-search-path src --metrics

Then generate some graphs!

Total scopes created over time:

$ uv run crates/ruff_metrics/plot_metrics.py counter semantic_index.scope_count

counter

Total scopes over time, per file:

$ uv run crates/ruff_metrics/plot_metrics.py counter semantic_index.scope_count --group-by file

counter-by-file

Histogram of total scopes per file:

$ uv run crates/ruff_metrics/plot_metrics.py histogram semantic_index.scope_count --group-by file

histogram

Copy link
Contributor

github-actions bot commented Feb 6, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant