Python: Add various kinds of extractor telemetry - #22502
Draft
tausbn wants to merge 3 commits into
Draft
Conversation
Here' `python_analysis_version` is the version of Python that we are analysing the code as. In practice, all we care about is the major version, but we might as well include the full thing (since it can be overridden on the command line). The `python_runtime_version` is the actual version of Python that ran the extractor.
tausbn
force-pushed
the
tausbn/python-add-various-kinds-of-extractor-telemetry
branch
from
September 3, 2026 15:14
84fc2d3 to
bc3b4e1
Compare
Adds statistics on how many files were extracted using the old parser and using the tree-sitter parser. Because parsing is done in parallel across many workers, I opted not to consolidate these statistics for the entire run. Instead, we emit the statistics for each worker and then need to aggregate themselves after the telemetry has been ingested. (In practice the number of workers is ~16 at most, so is unlikely to be an issue.) In terms of implementation, I opted to simply extend the existing `DiagnosticsWriter` object (instantiatied once per worker) with methods for counting the number of parsed files, and then thread this object through to `modules.py` where the magic happens. Finally, this also required instantiating such an object in cases where we call directly into the extractor for debugging purposes (e.g. dumping the AST or CFG). Note that in these cases we do not actually print any diagnostics, so it's harmless to create these objects.
Records any non-default extractor flags (without their arguments) as a normalised string. This will enable us to determine which flags are actually used (and which ones we might therefore get rid of). When there are no flags other than the ones the autobuilder injects, we simply report the string `"default"`. That way, there's no need to remember exactly which flags are enabled by default during extraction.
tausbn
force-pushed
the
tausbn/python-add-various-kinds-of-extractor-telemetry
branch
from
September 3, 2026 15:21
bc3b4e1 to
f728505
Compare
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.
Extends the extractor so as to emit the following kinds of telemetry:
Each of the above extensions is in its own commit, so I recommend going commit-by-commit.