sentry-java
AGENTS.md1.4k starsChanged 7 months agoMITView on GitHub
This file covers the whole repository. Before working on a specific area, read the matching rule file in .cursor/rules/: Rules can be combined — a tracing scope issue may need both scopes and opentelemetry. There is no rule for Android profiling yet; read the sentry-android-core profiling code directly and fetch related rules such as options, offline, or api as needed. This is the Sentry Java/Android SDK - a comprehensive error monitoring and performance tracking SDK for Java and Android applications.…
Trending
Quiet this year.about the whole repository
Who's talking about getsentry/sentry-java
- getsentry/sentry“[Mobile Replay] Capture Network request/response bodies”GitHub · Feb 5, 2025 · 48 reactions
- quarkusio/quarkus“Sentry tracing with automatic instrumentation”GitHub · Aug 31, 2021 · 19 reactions
- getsentry/sentry-dart“Support Source Context”GitHub · Oct 25, 2020 · 18 reactions
- getsentry/sentry-dotnet“OpenTelemetry Support”GitHub · Nov 25, 2022 · 11 reactions
- getsentry/sentry-dotnet“Feature: Session Replay support for .NET MAUI”GitHub · Jan 30, 2023 · 8 reactions
The biggest 5 of 18 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 18
Talked about on GitHub (18 times).
On GitHub · 18
- Feb 5, 2025[Mobile Replay] Capture Network request/response bodies — getsentry/sentry48 reactions · 13 comments
- Aug 31, 2021Sentry tracing with automatic instrumentation — quarkusio/quarkus19 reactions · 20 comments
- Oct 25, 2020Support Source Context — getsentry/sentry-dart18 reactions · 24 comments
- Nov 25, 2022OpenTelemetry Support — getsentry/sentry-dotnet11 reactions · 4 comments
- Jan 30, 2023Feature: Session Replay support for .NET MAUI — getsentry/sentry-dotnet8 reactions · 9 comments
13 more on GitHub
- Mar 19, 2025Add UI Profiling Support (converted to project) — getsentry/sentry-react-native5 reactions · 3 comments
- Jan 20, 2021Proposal (Performance): Some convenience API to wrap a Promise with a Span/Transaction — getsentry/sentry-javascript5 reactions · 2 comments
- May 1, 2025feat: Initial Android support — getsentry/sentry-godot4 reactions · 3 comments
- Mar 25, 2024feat(replay): Add Mobile Replay Alpha — getsentry/sentry-react-native4 reactions · 8 comments
- Feb 8, 2023Add support for Sentry — spring-io/start.spring.io4 reactions · 6 comments
- May 4, 2022Figure out how to implement hints — getsentry/sentry-javascript4 reactions · 5 comments
- Dec 10, 2020Add basic support for attachments — getsentry/sentry-cocoa4 reactions
- Jul 17, 2025Bump io.sentry.android.gradle from 4.10.0 to 5.8.0 — woocommerce/woocommerce-android3 reactions · 2 comments
- Jul 23, 2024feat: User Feedback widget/form — getsentry/sentry-cocoa3 reactions · 5 comments
- May 1, 2024Remove `enableTracing` (and update docs accordingly) — getsentry/team-sdks3 reactions · 7 comments
- Feb 1, 2024[Epic] Mobile Session Replay — getsentry/sentry3 reactions · 2 comments
- Nov 20, 2023Tracing: W3C Trace Context Support — getsentry/team-sdks3 reactions · 9 comments
- Jan 12, 2023Allow more granular auto installation — getsentry/sentry-android-gradle-plugin3 reactions · 3 comments
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository17 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .cursor/rules/api.mdcCursor rule
- .cursor/rules/continuous_profiling_jvm.mdcCursor rule
- .cursor/rules/deduplication.mdcCursor rule
- .cursor/rules/e2e_tests.mdcCursor rule
- .cursor/rules/feature_flags.mdcCursor rule
- .cursor/rules/metrics.mdcCursor rule
- .cursor/rules/new_module.mdcCursor rule
- .cursor/rules/offline.mdcCursor rule
- .cursor/rules/opentelemetry.mdcCursor rule
- .cursor/rules/options.mdcCursor rule
- .cursor/rules/queues.mdcCursor rule
- .cursor/rules/scopes.mdcCursor rule
- btrace-perfettoSkill
- check-code-attributionSkill
- create-java-prSkill
- testSkill
The file
We split this AGENTS.md into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 72
First think through the problem: Read the codebase for relevant files and propose a plan
- Distinctive: line 73
Check in before beginning: Verify the plan before starting implementation
- Distinctive: line 159
Write comprehensive unit tests for new features
- Distinctive: line 166
Follow existing code style and language
- Distinctive: line 172
When adapting code from third-party libraries:
- Very specific: line 173
Add a license header at the top of the adapted file (before the package statement):
- Very specific: line 180
Add a full attribution entry to THIRD_PARTY_NOTICES.md following the existing format (Source, License, Copyright, Scope, full license text)
- Very specific: line 182
Run the check-code-attribution skill locally or wait for it to be auto-run against your PR to check for required fields and verify new …
- Very specific: line 186
Use gh pr view to get PR details from the current branch.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file provides guidance to AI coding agents when working with code in this repository.
Domain-Specific Rules
This file covers the whole repository. Before working on a specific area, read the matching
rule file in .cursor/rules/:
| Rule | Read it when working on |
api | Public API surface, binary compatibility, .api files, apiDump, IScope/IScopes/Sentry static API, protocol classes |
options | SentryOptions, namespaced options, ExternalOptions, sentry.properties, ManifestMetadataReader, Spring Boot properties |
scopes | Scope management, forking, lifecycle, ScopeType, thread-local storage, scope bleeding, Hub → Scopes migration |
deduplication | Duplicate event detection, DuplicateEventDetectionEventProcessor, enableDeduplication |
offline | Caching, envelope storage, network failure handling, retries, AsyncHttpTransport, EnvelopeCache, rate limiting |
feature_flags | addFeatureFlag, FeatureFlagBuffer, maxFeatureFlags, LaunchDarkly and OpenFeature integrations |
metrics | Sentry.metrics(), IMetricsApi, count/distribution/gauge, MetricsBatchProcessor |
queues | Queue tracing, queue.publish/queue.process, enableQueueTracing, Kafka instrumentation, messaging span data |
continuous_profiling_jvm | sentry-async-profiler, IContinuousProfiler, ProfileChunk, JFR files, ProfileLifecycle |
opentelemetry | sentry-opentelemetry-*, agent vs agentless, span processing, sampling, context propagation |
new_module | Adding a new integration or sample module |
e2e_tests | System tests, sample applications, system-test-runner.py, mock Sentry server |
Rules can be combined — a tracing scope issue may need both scopes and opentelemetry.
There is no rule for Android profiling yet; read the sentry-android-core profiling code
directly and fetch related rules such as options, offline, or api as needed.
Project Overview
This is the Sentry Java/Android SDK - a comprehensive error monitoring and performance tracking SDK for Java and Android applications. The repository contains multiple modules for different integrations and platforms.
Build System
The project uses Gradle with Kotlin DSL. Key build files:
build.gradle.kts- Root build configurationsettings.gradle.kts- Multi-module project structurebuildSrc/andbuild-logic/- Custom build logic and pluginsMakefile- High-level build commands
Essential Commands
# Format code and regenerate .api files (REQUIRED before committing)
./gradlew spotlessApply apiDump
# Run all tests and linter
./gradlew check
# Generate documentation
./gradlew aggregateJavadocs
# Dependency updates check
./gradlew dependencyUpdates -Drevision=releaseTo run tests, use the test skill rather than composing the Gradle invocation by hand — it
resolves the per-module test task and the unit-test vs system-test split for you.
Android-Specific Commands
# Assemble Android test APKs
./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest
# Run critical UI tests
./scripts/test-ui-critical.shDevelopment Workflow Rules
Planning and Implementation Process
- First think through the problem: Read the codebase for relevant files and propose a plan
- Check in before beginning: Verify the plan before starting implementation
- Use todo tracking: Work through todo items, marking them as complete as you go
- High-level communication: Give high-level explanations of changes made, not step-by-step descriptions
- Simplicity first: Make every task and code change as simple as possible. Avoid massive or complex changes. Impact as little code as possible.
- Format and regenerate: Once done, format code and regenerate .api files:
./gradlew spotlessApply apiDump - Propose commit: As final step, git stage relevant files and propose (but not execute) a single git commit command. This applies to implementation work; when the task is to open a PR, the
create-java-prskill takes over from here and does commit, push, and open it.
Repository Skills
This repo ships task-specific skills, declared in agents.toml with sources under
.agents/skills. Your harness already lists them with their descriptions — prefer them over
performing the steps manually.
Module Architecture
The repository is organized into multiple modules:
Core Modules
sentry- Core Java SDK implementationsentry-android-core- Core Android SDK implementationsentry-android- High-level Android SDKsentry-android-ndk- Native (NDK) crash handling
Integration Modules
- Spring Framework:
sentry-spring*,sentry-spring-boot* - Logging:
sentry-logback,sentry-log4j2,sentry-jul,sentry-android-timber - Web:
sentry-servlet*,sentry-okhttp,sentry-openfeign,sentry-apache-http-client-5 - GraphQL:
sentry-graphql*,sentry-apollo* - Android UI:
sentry-android-fragment,sentry-android-navigation,sentry-android-navigation3,sentry-compose - Session Replay:
sentry-android-replay - Database:
sentry-jdbc,sentry-android-sqlite,sentry-jcache - Reactive:
sentry-reactor,sentry-ktor-client - Feature Flags:
sentry-launchdarkly-android,sentry-launchdarkly-server,sentry-openfeature - Queues:
sentry-kafka - Profiling:
sentry-async-profiler(JVM continuous profiling) - Monitoring:
sentry-opentelemetry*,sentry-quartz - Other:
sentry-spotlight,sentry-kotlin-extensions,sentry-android-distribution
Utility Modules
sentry-test-support- Shared test utilitiessentry-system-test-support- System testing infrastructuresentry-samples- Example applicationssentry-bom- Bill of Materials for dependency management
Key Architectural Patterns
- Multi-platform: Supports JVM, Android, and Kotlin Multiplatform (Compose modules)
- Modular Design: Each integration is a separate module with minimal dependencies
- Options Pattern: Features are opt-in via
SentryOptionsand similar configuration classes - Transport Layer: Pluggable transport implementations for different environments
- Scope Management: Thread-safe scope/context management for error tracking
Development Guidelines
Code Style
- Languages: Java 8+ and Kotlin
- Formatting: Enforced via Spotless
- API Compatibility: Binary compatibility is enforced.
.apifiles are generated, never hand-edited
Exception Handling
Never introduce a new catch (Throwable). Catch the narrowest type the guarded code can
actually throw. The repository still contains many pre-existing broad catches; they are legacy,
not a precedent to follow.
A broad catch swallows OutOfMemoryError, StackOverflowError, ThreadDeath and LinkageError —
conditions the JVM/ART cannot recover from and that leave the process in an undefined state — and
it hides real bugs in our own code behind a log line.
"The SDK must never crash the host application" is not a reason to catch Throwable. That goal is
served by io.sentry.util.ExceptionUtils.rethrowIfFatal, which lets the non-recoverable throwables
through while leaving everything else for the caller to log or ignore:
try {
doSomethingRisky();
} catch (Throwable t) {
ExceptionUtils.rethrowIfFatal(t);
options.getLogger().log(SentryLevel.ERROR, "Failed to do something risky", t);
}Apply that pattern only where a broad catch is genuinely unavoidable — an entry point that runs arbitrary user code or third-party callbacks. Everywhere else, name the exception types. Say in the PR description why the broad catch is necessary.
Testing Requirements
- Write comprehensive unit tests for new features
- Android modules require both unit tests and instrumented tests where applicable
- System tests validate end-to-end functionality with sample applications
- Assertions: For new unit tests, prefer Google Truth (
com.google.common.truth.Truth.assertThat) overkotlin.test/JUnit assertions for its readable, fluent API. Keep usingkotlin.testfor test structure (@Test,assertFailsWith). Seesentry/src/test/java/io/sentry/DsnTest.ktfor the style. Don't rewrite existingkotlin.testassertions solely to switch libraries. - Truth is wired into the
sentrymodule. When adding Truth-based tests to another module, addtestImplementation(libs.google.truth)to that module'sbuild.gradle.kts.
Contributing Guidelines
- Follow existing code style and language
- Write comprehensive tests
- New features must be opt-in by default - extend
SentryOptionsor similar Option classes with getters/setters - Consider backwards compatibility
Third-Party Code Attribution
When adapting code from third-party libraries:
- Add a license header at the top of the adapted file (before the
packagestatement):// Adapted from <Library Name>. // Copyright <year> <copyright holder>. // Licensed under the <License Name>. // <source URL> - Add a full attribution entry to
THIRD_PARTY_NOTICES.mdfollowing the existing format (Source, License, Copyright, Scope, full license text) - Run the
check-code-attributionskill locally or wait for it to be auto-run against your PR to check for required fields and verify new licenses against Sentry's Open Source Legal Policy.
Getting PR Information
Use gh pr view to get PR details from the current branch. This is needed when adding changelog entries, which require the PR number.
# Get PR number for current branch
gh pr view --json number -q '.number'
# Get PR number for a specific branch
gh pr view <branch-name> --json number -q '.number'
# Get PR URL
gh pr view --json url -q '.url'Changelog
User-facing changes get an entry under the ## Unreleased section of CHANGELOG.md. The
create-java-pr skill is the source of truth for the full changelog and PR workflow, including
subsection selection and the rebase caveat when a release renames ## Unreleased.
Useful Resources
- Main SDK documentation: https://develop.sentry.dev/sdk/overview/
- Internal contributing guide: https://docs.sentry.io/internal/contributing/
- Git commit message conventions: https://develop.sentry.dev/engineering-practices/commit-messages/
This SDK is production-ready and used by thousands of applications. Changes should be thoroughly tested and maintain backwards compatibility.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

