Skip to content

feat(preprod): Record client attribution on snapshot read endpoints#118387

Merged
mtopo27 merged 1 commit into
masterfrom
maxtopolsky/eme-1215-mcp-snapshot-client-analytics
Jun 24, 2026
Merged

feat(preprod): Record client attribution on snapshot read endpoints#118387
mtopo27 merged 1 commit into
masterfrom
maxtopolsky/eme-1215-mcp-snapshot-client-analytics

Conversation

@mtopo27

@mtopo27 mtopo27 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

The three snapshot read endpoints now record an analytics client field that
classifies each caller as web, sentry-cli, or MCP (with client family, e.g.
mcp:cursor). This lets us see in analytics how much snapshot read traffic
comes from the MCP server and which client family, versus the web UI — the same
attribution issue.viewed already records.

  • get_snapshot (.../snapshots/{id}/) — existing
    preprod_artifact.api.get_snapshot_details event gains a client field.
  • get_snapshot_image (.../snapshots/{id}/images/{image}/) and
    get_latest_base_snapshot (.../snapshots/latest-base/) had no analytics;
    each now emits a new event recorded on the authorized-read path.

Classification reuses the existing resolve_action_source()
(sentry/issues/action_log), so the values match its scheme
(web / sentry-cli / mcp:<family> / api) rather than issue.viewed's
mcp - <family> format. No new helper, no change to the existing
issue.viewed call site.

New/changed event payloads:

Event Fields
preprod_artifact.api.get_snapshot_details + client
preprod_artifact.api.get_snapshot_image (new) org/project/user/artifact, image_identifier, client
preprod_artifact.api.get_latest_base_snapshot (new) org/project/user/artifact, app_id, client

Scope note: this covers the MCP-tool read endpoints only. sentry-cli download
attribution is intentionally out of scope — the CLI hits a
.../snapshots/{id}/download/ route that does not exist in sentry or getsentry
today, so it needs that route built/aliased before it can be instrumented.
latest-base traffic from the CLI is already captured here (classified as
sentry-cli) once the CLI uses it.

Refs EME-1215

The three snapshot read endpoints now record an analytics `client` field that
classifies each caller as web, sentry-cli, or MCP (with client family, e.g.
`mcp:cursor`), so we can see how much snapshot read traffic comes from the MCP
server and which client family versus the web UI.

The existing get_snapshot_details event gains a `client` field, and the image
and latest-base endpoints — which had no analytics — each emit a new event on
the authorized-read path. Classification reuses resolve_action_source() rather
than introducing a new helper; the issue.viewed call site is left unchanged.

Refs EME-1215
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 24, 2026

Copy link
Copy Markdown

EME-1215

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 24, 2026
@mtopo27 mtopo27 marked this pull request as ready for review June 24, 2026 20:03
@mtopo27 mtopo27 requested a review from a team as a code owner June 24, 2026 20:03
@mtopo27 mtopo27 merged commit 63e94cb into master Jun 24, 2026
65 checks passed
@mtopo27 mtopo27 deleted the maxtopolsky/eme-1215-mcp-snapshot-client-analytics branch June 24, 2026 20:42
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants