From 192d4999865893fe90bc56856fd0065d87cda460 Mon Sep 17 00:00:00 2001 From: Abdullah Khan Date: Fri, 19 Jun 2026 13:18:16 -0400 Subject: [PATCH 1/2] feat(scm-multi-platform-detection): Adding new metrics --- .../github/multi_platform_detection.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/sentry/integrations/github/multi_platform_detection.py b/src/sentry/integrations/github/multi_platform_detection.py index f93dc25da31f61..b80ea828018834 100644 --- a/src/sentry/integrations/github/multi_platform_detection.py +++ b/src/sentry/integrations/github/multi_platform_detection.py @@ -483,7 +483,9 @@ def detect_platforms_multi( languages: dict[str, int] = client.get_languages(repo) active_platforms = _select_active_platforms(languages) + tree_start = time.monotonic() entries, is_truncated = _get_tree(client, repo, ref) + tree_duration_ms = (time.monotonic() - tree_start) * 1000 index = _build_tree_index(entries) results: list[DetectedPlatform] = [] @@ -524,11 +526,13 @@ def detect_platforms_multi( # are always within the cap before subdirectory files from monorepo workspaces. capped_paths = sorted(needed_paths, key=lambda p: (p.count("/"), p))[:MAX_CONTENT_READS] + content_reads_start = time.monotonic() content_by_path: dict[str, str] = {} for path in capped_paths: content = _get_repo_file_content(client, repo, path, ref) if content is not None: content_by_path[path] = content + content_reads_duration_ms = (time.monotonic() - content_reads_start) * 1000 manifests_by_path: dict[str, _PackageManifest] = {} for path, content in content_by_path.items(): @@ -624,6 +628,21 @@ def detect_platforms_multi( f"{_MULTI_METRICS_PREFIX}.k_reads_realized", k_reads_realized, ) + sentry_sdk.metrics.distribution( + f"{_MULTI_METRICS_PREFIX}.tree.duration", + tree_duration_ms, + unit="millisecond", + ) + sentry_sdk.metrics.distribution( + f"{_MULTI_METRICS_PREFIX}.content_reads.duration", + content_reads_duration_ms, + unit="millisecond", + ) + for needed_path in needed_paths: + sentry_sdk.metrics.distribution( + f"{_MULTI_METRICS_PREFIX}.k_reads_needed_depth", + needed_path.count("/"), + ) sentry_sdk.metrics.count( f"{_MULTI_METRICS_PREFIX}.completed", 1, From 6c23be026314b61dcd77b27d06e148ad2b0f271d Mon Sep 17 00:00:00 2001 From: Abdullah Khan Date: Fri, 19 Jun 2026 13:22:34 -0400 Subject: [PATCH 2/2] feat(scm-multi-platform-detection): Iterating --- src/sentry/integrations/github/multi_platform_detection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sentry/integrations/github/multi_platform_detection.py b/src/sentry/integrations/github/multi_platform_detection.py index b80ea828018834..f728bd31e10878 100644 --- a/src/sentry/integrations/github/multi_platform_detection.py +++ b/src/sentry/integrations/github/multi_platform_detection.py @@ -640,7 +640,7 @@ def detect_platforms_multi( ) for needed_path in needed_paths: sentry_sdk.metrics.distribution( - f"{_MULTI_METRICS_PREFIX}.k_reads_needed_depth", + f"{_MULTI_METRICS_PREFIX}.needed_path_depth", needed_path.count("/"), ) sentry_sdk.metrics.count(