Skip to content

chore(scm-multi-platform-detetion): Adding metrics for single platform detector.#117060

Merged
Abdkhan14 merged 7 commits into
masterfrom
abdk/multi-platform-detection-v2
Jun 9, 2026
Merged

chore(scm-multi-platform-detetion): Adding metrics for single platform detector.#117060
Abdkhan14 merged 7 commits into
masterfrom
abdk/multi-platform-detection-v2

Conversation

@Abdkhan14

@Abdkhan14 Abdkhan14 commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Adds Sentry metrics to the current single-platform detector

.single.duration (timing) measures detector wall-time from the first GitHub call through ranking, emitted on successful completion.

.single.completed (incr) counts detections and carries three tags:

confidence: the top result's confidence, high / medium / none (high means a framework matched, medium means base-language fallback).
languages_count: distinct Sentry base platforms across the repo's languages (SDK-less languages ignored, TypeScript+JavaScript collapsed to one), bucketed. This sizes how often repos are actually multi-platform even though today we only return the top one.
content_reads: number of file-content API calls made, bucketed. Excludes the two fixed calls (languages + root listing).

@Abdkhan14 Abdkhan14 requested review from a team as code owners June 7, 2026 20:00
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 7, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d78b905. Configure here.

Comment thread src/sentry/integrations/github/platform_detection.py
Comment thread src/sentry/integrations/github/platform_detection.py
Comment thread src/sentry/integrations/github/platform_detection.py

metrics.timing(
f"{_SINGLE_METRICS_PREFIX}.duration",
time.monotonic() - start_time,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unclear to me if this should be passed to metrics.timing in seconds or ms? looks like both variants are used within the repo, might be worth investigating.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jaydgoss I switched over to sentry metrics, just more familiar with the querying UI. Passed the millisecond unit along

Abdkhan14 and others added 2 commits June 8, 2026 17:04
…int (#117094)

Adds a measurement-only endpoint to size up the tree-based
(multi-platform) detector before we build it, without touching the live
detection path.

**Why a separate endpoint**: it runs in parallel with the current
detection request, fully off the live path, so it can't slow down or
break onboarding. Faster revert, we just remove the FE call.

It reuses the existing endpoint's guarding, makes a single recursive git
tree call off HEAD, and returns 204 (no body). We call the GitHub client
directly instead of `get_tree` because that helper hides the truncated
flag, which we need.

Metrics (onboarding-scm.platform_detection.multi):

`duration`: tree fetch latency, to compare against the current detector.
`completed`: counter of successful runs, tagged is_truncated to see how
often GitHub truncates the tree.
`tree.entry_count`: number of tree entries (repo size signal).
`repo_size_bytes`: total blob bytes (compute/cost signal).

On any GitHub error (incl. empty-repo 409) we log and bail without
emitting completed, so failures don't skew the data.

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
@Abdkhan14 Abdkhan14 requested a review from a team as a code owner June 8, 2026 22:18
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 8, 2026
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@Abdkhan14 Abdkhan14 merged commit 9b0cbdb into master Jun 9, 2026
65 checks passed
@Abdkhan14 Abdkhan14 deleted the abdk/multi-platform-detection-v2 branch June 9, 2026 17:43
Abdkhan14 added a commit that referenced this pull request Jun 10, 2026
… the FE (#117113)

Depends on: #117060

Documentation:
https://app.notion.com/p/sentry/Sub-dir-Multi-Platform-Detection-Plan-3738b10e4b5d80b8a297d307e454db7f

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
amy-chen23 pushed a commit that referenced this pull request Jun 10, 2026
…m detector. (#117060)

Adds Sentry metrics to the current single-platform detector

`.single.duration` (timing) measures detector wall-time from the first
GitHub call through ranking, emitted on successful completion.

`.single.completed` (incr) counts detections and carries three tags:

`confidence`: the top result's confidence, high / medium / none (high
means a framework matched, medium means base-language fallback).
`languages_count`: distinct Sentry base platforms across the repo's
languages (SDK-less languages ignored, TypeScript+JavaScript collapsed
to one), bucketed. This sizes how often repos are actually
multi-platform even though today we only return the top one.
`content_reads`: number of file-content API calls made, bucketed.
Excludes the two fixed calls (languages + root listing).

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
amy-chen23 pushed a commit that referenced this pull request Jun 10, 2026
… the FE (#117113)

Depends on: #117060

Documentation:
https://app.notion.com/p/sentry/Sub-dir-Multi-Platform-Detection-Plan-3738b10e4b5d80b8a297d307e454db7f

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants