Skip to content

docs(cli): Add code mappings documentation page#17196

Open
romtsn wants to merge 3 commits intomasterfrom
rz/feat/code-mappings-cli-docs
Open

docs(cli): Add code mappings documentation page#17196
romtsn wants to merge 3 commits intomasterfrom
rz/feat/code-mappings-cli-docs

Conversation

@romtsn
Copy link
Copy Markdown
Member

@romtsn romtsn commented Mar 31, 2026

Summary

  • Add new CLI docs page at /cli/code-mappings/ covering the sentry-cli code-mappings upload command
  • Document JSON format, options, batching behavior, and CI/CD integration
  • Use real sentry-java monorepo as example (including duplicate stack roots for opentelemetry modules)
  • Add backlinks from:
    • Suspect commits page
    • Java source context page
    • GitHub integration page
    • CLI index page

Test plan

  • Verify page renders correctly at /cli/code-mappings/
  • Verify backlinks work from all updated pages

🤖 Generated with Claude Code

@codeowner-assignment codeowner-assignment bot requested a review from a team March 31, 2026 15:59
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sentry-docs Ready Ready Preview, Comment Apr 1, 2026 1:55pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
develop-docs Ignored Ignored Preview Apr 1, 2026 1:55pm

Request Review

@codeowner-assignment codeowner-assignment bot requested a review from a team March 31, 2026 15:59
@romtsn romtsn requested a review from szokeasaurusrex March 31, 2026 16:02
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

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 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Unrelated Android session replay changes included in PR
    • Removed the accidental Android session replay beforeErrorSampling docs from both affected files and pushed a single focused commit.

Create PR

Or push these changes by commenting:

@cursor push b8f666ce65
Preview (b8f666ce65)
diff --git a/docs/platforms/android/session-replay/configuration.mdx b/docs/platforms/android/session-replay/configuration.mdx
--- a/docs/platforms/android/session-replay/configuration.mdx
+++ b/docs/platforms/android/session-replay/configuration.mdx
@@ -29,7 +29,6 @@
 | networkRequestHeaders | `io.sentry.session-replay.network-request-headers`     | List<String>                                                       | `['Content-Type', 'Content-Length', 'Accept']`                         | Request header names to capture for enabled URLs.                                                                                       |
 | networkResponseHeaders| `io.sentry.session-replay.network-response-headers`    | List<String>                                                       | `['Content-Type', 'Content-Length', 'Accept']`                         | Response header names to capture for enabled URLs. |
 | debug              | `io.sentry.session-replay.debug`                        | boolean                                                            | `false`                              | Enables Session Replay debug logging, which prints diagnostic information when a replay is recorded.                                                                                                                          |
- | beforeErrorSampling | `—`                                                     | `BeforeErrorSamplingCallback`                                      | `null`                               | A callback invoked before the `onErrorSampleRate` is checked. Return `false` to skip replay capture for this error, or `true` to proceed with the normal sample rate check. If the callback throws, replay capture proceeds normally (fail-open). Only configurable in code. See [Ignore Certain Errors from Error Sampling](/platforms/android/session-replay/#ignore-certain-errors-from-error-sampling). |
 
 
 ## Network Details

diff --git a/docs/platforms/android/session-replay/index.mdx b/docs/platforms/android/session-replay/index.mdx
--- a/docs/platforms/android/session-replay/index.mdx
+++ b/docs/platforms/android/session-replay/index.mdx
@@ -121,37 +121,6 @@
 
 Sampling begins as soon as a session starts. `sessionSampleRate` is evaluated first. If it's sampled, the replay recording will begin. Otherwise, `onErrorSampleRate` is evaluated and if it's sampled, the integration will begin buffering the replay and will only upload it to Sentry if an error occurs. The remainder of the replay will behave similarly to a whole-session replay.
 
-### Ignore Certain Errors from Error Sampling
-
-Once you've enabled `onErrorSampleRate`, you can further customize which errors should trigger a replay capture by using the `beforeErrorSampling` callback. This is useful if you want to capture replays only for unhandled errors, or exclude certain error types from replay capture.
-
-The `beforeErrorSampling` callback is called when an error occurs and receives the event and hint as arguments. Returning `false` will prevent the replay from being captured for that specific error. If the callback throws an exception, replay capture proceeds normally (fail-open).
-
-```kotlin {tabTitle:Kotlin}
-SentryAndroid.init(context) { options ->
-  options.dsn = "___PUBLIC_DSN___"
-  options.sessionReplay.onErrorSampleRate = 1.0
-
-  options.sessionReplay.beforeErrorSampling =
-    SentryReplayOptions.BeforeErrorSamplingCallback { event, hint ->
-      // Only capture replays for unhandled/crashed events
-      event.isCrashed
-    }
-}
-```
-
-```java {tabTitle:Java}
-SentryAndroid.init(context, options -> {
-  options.setDsn("___PUBLIC_DSN___");
-  options.getSessionReplay().setOnErrorSampleRate(1.0);
-
-  options.getSessionReplay().setBeforeErrorSampling((event, hint) -> {
-    // Only capture replays for unhandled/crashed events
-    return event.isCrashed();
-  });
-});
-```
-
 ## Privacy
 
 The SDK is recording and aggressively masking all text, images, and webviews by default. If your app has any sensitive data, you should only turn the default masking off after explicitly masking out the sensitive data, using the APIs described below.

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Add a new CLI docs page for code mappings with upload command usage,
JSON format, options, batching, and CI/CD integration. Also add
backlinks from suspect commits, Java source context, and GitHub
integration pages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

Left some suggestions. I think we can and should omit several of the items that were added here; please see comments.

| `--repo` | Optional | The repository name (e.g. `getsentry/sentry`). Defaults to the git remote origin. Required if not running from within a git repository. |
| `--default-branch` | Optional | The default branch name. Defaults to the git remote HEAD or `main`. Required if not running from within a git repository. |

### JSON File Format
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.

Is there a standardized way to generate such files? If so, I think we should mention it.

Copy link
Copy Markdown
Member Author

@romtsn romtsn Apr 1, 2026

Choose a reason for hiding this comment

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

nope, not really. I was thinking to add a sentry.io/changelog entry where I'd provide an example snippet on how to do this in Gradle, but I could also add it here if you prefer. Although, the next step would be to do this automatically in the Sentry Gradle plugin so this would make the snippet redundant.

- Simplify command example to minimal invocation
- Remove options table, point to --help instead
- Remove batching, output, CI/CD, and stack trace root sections
- Reorder JSON format (description first, then example)
- Mention CI usage at the top instead of separate section
- Keep code mappings mention in CLI index without link
- Fix broken link in Java source context page

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment on lines +6 to +7

Code mappings link stack trace paths to source code paths in your repository. They enable features like [source context](/platforms/java/source-context/), [suspect commits](/product/issues/suspect-commits/), [stack trace linking](/organization/integrations/source-code-mgmt/github/#stack-trace-linking), and [code owners](/product/issues/ownership-rules/).
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
Code mappings link stack trace paths to source code paths in your repository. They enable features like [source context](/platforms/java/source-context/), [suspect commits](/product/issues/suspect-commits/), [stack trace linking](/organization/integrations/source-code-mgmt/github/#stack-trace-linking), and [code owners](/product/issues/ownership-rules/).
_Available in version 3.3.4 of Sentry CLI_
Code mappings link stack trace paths to source code paths in your repository. They enable features like [source context](/platforms/java/source-context/), [suspect commits](/product/issues/suspect-commits/), [stack trace linking](/organization/integrations/source-code-mgmt/github/#stack-trace-linking), and [code owners](/product/issues/ownership-rules/).

@szokeasaurusrex not sure if we should mention the min supported version here?

Copy link
Copy Markdown
Contributor

@coolguyzone coolguyzone left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants