### Install Debug Build Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/README.md Installs the debug version of the sample app on a device or emulator. ```bash ./gradlew :sentry-samples:sentry-samples-android:installDebug ``` -------------------------------- ### Install Git Commit Hook Source: https://github.com/getsentry/sentry-java/blob/main/CONTRIBUTING.md Installs the spotlessCheck pre-commit hook to ensure code formatting consistency. ```shell git config core.hooksPath hooks/ ``` -------------------------------- ### Install Debug Build with SAGP Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/README.md Installs the debug version of the sample app, applying the Sentry Android Gradle Plugin (SAGP). ```bash ./gradlew :sentry-samples:sentry-samples-android:installDebug -PuseSagp ``` -------------------------------- ### Run Maestro Flow Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/maestro/README.md Execute a Maestro flow by replacing `.yaml` with the specific flow file. Ensure Maestro CLI is installed. ```bash maestro run .yaml ``` -------------------------------- ### GraphQL Add Project Mutation Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot/README.md A GraphQL mutation to add a new project. This example shows how to define and execute mutations with variables. ```graphql mutation AddProjectMutation($slug: ID!) { addProject(slug: $slug) } ``` ```json { "slug": "nocrash", "name": "nocrash" } ``` -------------------------------- ### Notify New Show Subscription Variables Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-netflix-dgs/README.md Variables for the 'SubscriptionNotifyNewShow'. This example sets the release year to -1, which might be used for testing or specific scenarios. ```json { "releaseYear": -1 } ``` -------------------------------- ### Add Show Mutation Variables Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-netflix-dgs/README.md Variables to be used with the 'AddShowMutation'. This example provides a title for the new show. ```json { "title": "A new show" } ``` -------------------------------- ### Start Android Foreground Service Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/sdkperf/README.md Launch an Android application process with foreground service importance using ADB. This is used to test SDK behavior when the app process is not initially in the foreground. ```bash adb shell am start-foreground-service -n io.sentry.samples.android/io.sentry.samples.android.DummyService ``` -------------------------------- ### GraphQL Subscription Notify New Task Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot/README.md Example of a GraphQL subscription to be notified when a new task is added to a project. Requires a project slug as a variable. ```graphql subscription SubscriptionNotifyNewTask($slug: ID!) { notifyNewTask(projectSlug: $slug) { id name assigneeId assignee { id name } } } ``` ```json { "slug": "crash" } ``` -------------------------------- ### Get PR URL using GitHub CLI Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Fetch the URL of a pull request using the `gh pr view` command with the `--json url` flag. This can be used for linking or referencing PRs. ```bash # Get PR URL gh pr view --json url -q '.url' ``` -------------------------------- ### Build Sample Servlet Application Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-servlet/README.md Execute this command from the module directory to build the sample servlet application. ```bash ../../gradlew build ``` -------------------------------- ### Run Sentry Sample Console Application Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-console/README.md Execute the sample application using Gradle. Ensure you have replaced the placeholder DSN in `Main.java` with your actual Sentry DSN before running. ```bash ../../gradlew run ``` -------------------------------- ### Prepare and Run Benchmark Tests on SauceLabs Source: https://github.com/getsentry/sentry-java/blob/main/sentry-android-integration-tests/sentry-uitest-android/README.md Build release and test artifacts for benchmarks, then run them on SauceLabs. Requires SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables. ```bash ./gradlew :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleRelease :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleAndroidTest saucectl run -c .sauce/sentry-uitest-android-benchmark.yml ``` -------------------------------- ### Run System Tests Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Initiates system tests, which require a Python virtual environment to be set up. ```bash # Run system tests (requires Python virtual env) make systemTest ``` -------------------------------- ### Run Spring Application Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring/README.md Execute this command from the module directory to run the Spring application. ```bash ../../gradlew appRun ``` -------------------------------- ### Apply Code Formatting Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Applies code formatting to Java and Kotlin files using the spotless Gradle plugin. ```bash # Apply code formatting ./gradlew spotlessApply ``` -------------------------------- ### Prepare and Run End-to-End Tests on SauceLabs Source: https://github.com/getsentry/sentry-java/blob/main/sentry-android-integration-tests/sentry-uitest-android/README.md Build release and test artifacts for end-to-end tests, then run them on SauceLabs. Requires SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables. ```bash ./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest saucectl run -c .sauce/sentry-uitest-android-end2end.yml ``` -------------------------------- ### Sentry Initialization Source: https://github.com/getsentry/sentry-java/blob/main/sentry-opentelemetry/README.md Initialize Sentry using the standard `Sentry.init` method after configuring OpenTelemetry. Provide your DSN and any other necessary Sentry options. ```java Sentry.init( options -> { options.setDsn("..."); ... } ) ``` -------------------------------- ### Build Entire Project Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Compiles and builds the entire Sentry Java/Android SDK project using Gradle. ```bash # Build entire project ./gradlew build ``` -------------------------------- ### Get PR Number for a Specific Branch using GitHub CLI Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Retrieve the pull request number for a specified branch using the `gh pr view` command. This is useful when working with branches other than the current one. ```bash # Get PR number for a specific branch gh pr view --json number -q '.number' ``` -------------------------------- ### Get PR Number for Current Branch using GitHub CLI Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Use the GitHub CLI command `gh pr view` to retrieve the pull request number for the current branch. This is essential for adding changelog entries. ```bash # Get PR number for current branch gh pr view --json number -q '.number' ``` -------------------------------- ### Run Build and Tests Source: https://github.com/getsentry/sentry-java/blob/main/CONTRIBUTING.md Executes the build process and runs all project tests. ```shell make compile ``` -------------------------------- ### Initialize Sentry Programmatically Source: https://github.com/getsentry/sentry-java/blob/main/sentry-opentelemetry/sentry-opentelemetry-agentless/README.md Initialize Sentry programmatically when not using properties files or environment variables. Provide your DSN and other options. ```java // Initialize Sentry Sentry.init( options -> { options.setDsn("..."); ... } ) ``` -------------------------------- ### Run All Tests and Linter Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Executes all unit tests and linter checks for the project using Gradle. ```bash # Run all tests and linter ./gradlew check ``` -------------------------------- ### Initialize OpenTelemetry SDK Programmatically Source: https://github.com/getsentry/sentry-java/blob/main/sentry-opentelemetry/sentry-opentelemetry-agentless/README.md Initialize the OpenTelemetry SDK programmatically, automatically registering Sentry processors and propagators. Disable default OTEL exporters if not in use. ```java // Initialize OpenTelemetry by using the AutoConfiguredOpenTelemetrySdk which automatically // registers the `SentrySpanProcessor` and `SentryPropagator` and others. // Also, you need to disable the OTEL exporters if you do not use them. AutoConfiguredOpenTelemetrySdk.builder() .setResultAsGlobal() .addPropertiesSupplier(() -> { final Map properties = new HashMap<>(); properties.put("otel.logs.exporter", "none"); properties.put("otel.metrics.exporter", "none"); properties.put("otel.traces.exporter", "none"); return properties; }) .build(); ``` -------------------------------- ### Initialize sentry-android (New - Manual) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md Manually initialize the Sentry SDK for Android by providing the context and an options lambda to configure the DSN. ```java SentryAndroid.init(context, options -> { options.setDsn("___PUBLIC_DSN___"); }); ``` -------------------------------- ### GraphQL Greeting Query with Variables Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot/README.md Demonstrates how to use variables with a GraphQL query for dynamic input. This allows for more flexible query execution. ```graphql query GreetingQuery($name: String) { greeting(name: $name) } ``` ```json { "name": "crash" } ``` -------------------------------- ### Generate Documentation Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Generates aggregated Javadocs for the project using Gradle. ```bash # Generate documentation ./gradlew aggregateJavadocs ``` -------------------------------- ### Run Spring Boot Application Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-4-webflux/README.md Execute this command from the module directory to run the Spring Boot application. ```bash ../../gradlew bootRun ``` -------------------------------- ### Assemble Android Test APKs Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Builds the release APKs for the Android integration tests and the Android test APK. ```bash # Assemble Android test APKs ./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest ``` -------------------------------- ### Programmatic OpenTelemetry Initialization with Sentry Source: https://github.com/getsentry/sentry-java/blob/main/sentry-opentelemetry/README.md Initialize OpenTelemetry programmatically by using `AutoConfiguredOpenTelemetrySdk`. This automatically registers the `SentrySpanProcessor` and `SentryPropagator`. Ensure to disable OTEL exporters if they are not in use by providing properties. ```java AutoConfiguredOpenTelemetrySdk.builder() .setResultAsGlobal() .addPropertiesSupplier(() -> { final Map properties = new HashMap<>(); properties.put("otel.logs.exporter", "none"); properties.put("otel.metrics.exporter", "none"); properties.put("otel.traces.exporter", "none"); return properties; }) .build(); ``` -------------------------------- ### Initialize sentry-android (Old) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md This is the old way of initializing the Sentry SDK for Java applications. ```java Sentry.init("___PUBLIC_DSN___", new AndroidSentryClientFactory(context)); ``` -------------------------------- ### Run All UI Tests Source: https://github.com/getsentry/sentry-java/blob/main/sentry-android-integration-tests/sentry-uitest-android/README.md Execute all UI tests across all modules. Requires a connected Android device or emulator. ```bash ./gradlew connectedCheck ``` -------------------------------- ### Check Code Formatting Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Verifies code formatting for Java and Kotlin files according to project standards. ```bash # Check code formatting ./gradlew spotlessJavaCheck spotlessKotlinCheck ``` -------------------------------- ### Launch Java Application with Agent Source: https://github.com/getsentry/sentry-java/blob/main/sentry-opentelemetry/sentry-opentelemetry-agent/README.md Use this command to launch your Java application with the Sentry OpenTelemetry agent. Ensure sentry.properties is configured. ```bash $ SENTRY_PROPERTIES_FILE=sentry.properties java -javaagent:sentry-opentelemetry-agent.jar -jar your-application.jar ``` -------------------------------- ### Run Perfetto Trace on Android Device Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/sdkperf/README.md Execute a Perfetto trace configuration on an Android device via ADB. Ensure a device is connected and accessible via ADB before running. ```bash adb shell perfetto \ -c basic.pbtx --txt \ -o /data/misc/perfetto-traces/trace ``` -------------------------------- ### Format Code and Regenerate API Files Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Required before committing. Formats code and regenerates .api files using Gradle. ```bash # Format code and regenerate .api files (REQUIRED before committing) ./gradlew spotlessApply apiDump ``` -------------------------------- ### Sentry Properties Configuration Source: https://github.com/getsentry/sentry-java/blob/main/sentry-opentelemetry/sentry-opentelemetry-agentless/README.md Configure Sentry DSN and trace sample rate using a properties file. Ensure to replace the test DSN with your actual Sentry DSN. ```properties # NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry project/dashboard dsn=https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563 traces-sample-rate=1.0 ``` -------------------------------- ### Format Code and Regenerate API Files Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md After completing development tasks, format the code and regenerate .api files using the provided Gradle command. This ensures code consistency and updates API definitions. ```bash ./gradlew spotlessApply apiDump ``` -------------------------------- ### GraphQL Greeting Query with Variables Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-4-webflux/README.md GraphQL query that utilizes variables for dynamic input. This demonstrates how to pass parameters to GraphQL queries. ```graphql query GreetingQuery($name: String) { greeting(name: $name) } ``` -------------------------------- ### Publish Local SAGP Build Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/README.md Publishes a locally built Sentry Android Gradle Plugin to the Maven local repository. ```bash ./gradlew -p plugin-build publishToMavenLocal ``` -------------------------------- ### Run Unit Tests for Specific File Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Executes unit tests for a particular file within a specified module, with detailed logging. ```bash # Run unit tests for a specific file ./gradlew '::testDebugUnitTest' --tests="**" --info ``` -------------------------------- ### Configure OpenTelemetry Properties for Sentry Source: https://github.com/getsentry/sentry-java/blob/main/sentry-opentelemetry/sentry-opentelemetry-agentless-spring/README.md Add these properties to your `application.properties` file to configure OpenTelemetry propagators and exporters for Sentry integration. Ensure `otel.propagators` includes `sentry`. ```properties otel.propagators=tracecontext,baggage,sentry otel.logs.exporter=none otel.metrics.exporter=none otel.traces.exporter=none ``` -------------------------------- ### FasterXML Jackson ISO8601Utils License Source: https://github.com/getsentry/sentry-java/blob/main/THIRD_PARTY_NOTICES.md Provides the Apache License 2.0 for the ISO8601Utils component from FasterXML Jackson used in the Sentry Java SDK. ```text Copyright (C) 2007-, Tatu Saloranta Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` -------------------------------- ### GraphQL Greeting Query Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-4-webflux/README.md A simple GraphQL query to test the greeting functionality. This query is used to verify basic GraphQL integration. ```graphql { greeting(name: "crash") } ``` -------------------------------- ### Manual Sentry Initialization Source: https://github.com/getsentry/sentry-java/blob/main/sentry-opentelemetry/sentry-opentelemetry-agent/README.md Manually initialize Sentry within your application if auto-initialization is disabled. Provide your DSN and other options. ```java Sentry.init( options -> { options.setDsn("..."); ... } ) ``` -------------------------------- ### Run Benchmark Tests Only Source: https://github.com/getsentry/sentry-java/blob/main/sentry-android-integration-tests/sentry-uitest-android/README.md Execute only the benchmark UI tests. These tests may take a significant amount of time to complete. ```bash ./gradlew :sentry-android-integration-tests:sentry-uitest-android-benchmark:connectedCheck ``` -------------------------------- ### GraphQL Greeting Query Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/README.md A simple GraphQL query to test the greeting functionality. This can be used to trigger events. ```graphql { greeting(name: "crash") } ``` -------------------------------- ### GraphQL Playground Configuration Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-netflix-dgs/README.md Configuration for GraphQL Playground to connect to a local DGS application. Ensure the URLs match your application's endpoint. ```yaml extensions: endpoints: default: url: 'http://localhost:8080/graphql' subscription: url: 'ws://localhost:8080/subscriptions' ``` -------------------------------- ### Fetch All Shows Query Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-netflix-dgs/README.md A basic GraphQL query to retrieve a list of shows, including their ID, title, and release year. This is useful for fetching general show information. ```graphql { shows { id title releaseYear } } ``` -------------------------------- ### Run Specific Test Suites Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Executes specific unit test suites for the sentry-android-core and sentry modules. ```bash # Run specific test suites ./gradlew :sentry-android-core:testDebugUnitTest ./gradlew :sentry:test ``` -------------------------------- ### Run Spring Boot App with Sentry Agent Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/README.md Execute this command to build and run the Spring Boot application with the Sentry OpenTelemetry agent. Ensure the agent module is built first. Replace the SENTRY_DSN with your own to see events in your Sentry dashboard. ```bash SENTRY_DSN="https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563" SENTRY_DEBUG=true ../../gradlew bootRunWithAgent ``` -------------------------------- ### Configure CMake for Sentry Native Integration Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/CMakeLists.txt This CMakeLists.txt file configures the build for a native Android library, finding and linking the sentry-native-ndk library. It also includes specific linker options for Android 15 page size support. ```cmake cmake_minimum_required(VERSION 3.10) project(Sentry-Sample LANGUAGES C CXX) add_library(native-sample SHARED src/main/cpp/native-sample.cpp) find_package(sentry-native-ndk REQUIRED CONFIG) find_library(LOG_LIB log) target_link_libraries(native-sample PRIVATE ${LOG_LIB} sentry-native-ndk::sentry-android sentry-native-ndk::sentry ) # Android 15: Support 16KB page sizes # see https://developer.android.com/guide/practices/page-sizes target_link_options(native-sample PRIVATE "-Wl,-z,max-page-size=16384") ``` -------------------------------- ### Set user (New) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The new method for setting user information in Sentry. ```java User user = new User(); user.setEmail("hello@sentry.io"); Sentry.setUser(user); ``` -------------------------------- ### Shows with Actor Data Loader Query Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-netflix-dgs/README.md A GraphQL query demonstrating the use of a data loader to fetch shows and their associated actors. This query retrieves show details and actor information, optimizing N+1 query problems. ```graphql query QueryShows { shows { id title releaseYear actorId actor { id name } } } ``` -------------------------------- ### Google GSON License Source: https://github.com/getsentry/sentry-java/blob/main/THIRD_PARTY_NOTICES.md Provides the Apache License 2.0 for the Google GSON library used in the Sentry Java SDK. ```text Copyright (C) 2010 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` -------------------------------- ### GraphQL Project Query Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot/README.md A GraphQL query to retrieve project details, including slug, name, repository URL, and status. Requires a project slug as a variable. ```graphql query ProjectQuery($slug: ID!) { project(slug: $slug) { slug name repositoryUrl status } } ``` ```json { "slug": "statuscrash" } ``` -------------------------------- ### Run Critical UI Tests Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Executes the critical UI tests for the Android application using a provided script. ```bash # Run critical UI tests ./scripts/test-ui-critical.sh ``` -------------------------------- ### Check Dependency Updates Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md Checks for available dependency updates, filtering by release revisions. ```bash # Dependency updates check ./gradlew dependencyUpdates -Drevision=release ``` -------------------------------- ### GraphQL Data Loader Tasks and Assignees Query Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot/README.md A GraphQL query demonstrating the use of a data loader to fetch tasks and their assignees efficiently. Requires a project slug. ```graphql query TasksAndAssigneesQuery($slug: ID!) { tasks(projectSlug: $slug) { id name assigneeId assignee { id name } } } ``` ```json { "slug": "crash" } ``` -------------------------------- ### Pull Perfetto Trace from Android Device Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/sdkperf/README.md Retrieve the generated Perfetto trace file from the Android device to the local machine for analysis. This command should be run after the trace has finished collecting. ```bash adb pull /data/misc/perfetto-traces/trace ``` -------------------------------- ### Add Third-Party Code License Header Source: https://github.com/getsentry/sentry-java/blob/main/AGENTS.md When adapting code from third-party libraries, include a license header at the top of the file before the package statement. This header should contain attribution details and the license name. ```java // Adapted from . // Copyright . // Licensed under the . // ``` -------------------------------- ### Set user (Old) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The old method for setting user information in Sentry context. ```java Sentry.getContext().setUser( new UserBuilder().setEmail("hello@sentry.io").build() ); ``` -------------------------------- ### Run UI Tests Excluding Benchmarks Source: https://github.com/getsentry/sentry-java/blob/main/sentry-android-integration-tests/sentry-uitest-android/README.md Execute all UI tests except for the benchmark tests. Useful for faster test runs when benchmarks are not needed. ```bash ./gradlew connectedCheck -x :sentry-android-integration-tests:sentry-uitest-android-benchmark:connectedCheck ``` -------------------------------- ### GraphQL Project Query Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/README.md A GraphQL query to retrieve project details, including slug, name, repositoryUrl, and status. It requires a 'slug' variable. ```graphql query ProjectQuery($slug: ID!) { project(slug: $slug) { slug name repositoryUrl status } } ``` -------------------------------- ### Trigger Sentry Events with cURL Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-7/README.md Make an HTTP POST request to trigger events in the Sentry sample application. Ensure you replace 'http://localhost:8080/sentry-samples-spring-jakarta/' with your application's base URL if it differs. ```bash curl -XPOST --user user:password http://localhost:8080/sentry-samples-spring-jakarta/person/ -H "Content-Type:application/json" -d '{"firstName":"John","lastName":"Smith"}' ``` -------------------------------- ### Enable Automatic Context Propagation Source: https://github.com/getsentry/sentry-java/blob/main/sentry-reactor/README.md Call this method to enable automatic context propagation for Reactor. Ensure you are using compatible versions of micrometer context-propagation and reactor-core. ```java import reactor.core.publisher.Hooks; // ... Hooks.enableAutomaticContextPropagation(); ``` -------------------------------- ### Capture exception (Old) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The old way to capture an exception in Sentry. ```java try { int x = 1 / 0; } catch (Exception e) { Sentry.capture(e); } ``` -------------------------------- ### GraphQL Add Project Mutation Variables Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/README.md JSON object containing variables for the AddProjectMutation. Both 'slug' and 'name' variables are provided. ```json { "slug": "nocrash", "name": "nocrash" } ``` -------------------------------- ### Disable auto-init in AndroidManifest.xml Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md To manually initialize the SDK, disable the auto-init feature by setting the corresponding meta-data tag to false in your AndroidManifest.xml. ```xml ``` -------------------------------- ### JVM Arguments for Agentless OpenTelemetry Source: https://github.com/getsentry/sentry-java/blob/main/sentry-opentelemetry/README.md Use these JVM arguments to enable global auto-configuration for OpenTelemetry when running without the Sentry agent. This automatically registers Sentry's SpanProcessor and Propagator. It's recommended to disable default OpenTelemetry exporters if you are not using them. ```bash -Dotel.java.global-autoconfigure.enabled=true ``` -------------------------------- ### Set tag (New) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The new method for setting a tag globally for Sentry events. ```java Sentry.setTag("tagName", "tagValue"); ``` -------------------------------- ### View Sentry SDK Logs Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/README.md Filters logcat output to display messages from the Sentry SDK, useful for debugging. ```bash adb logcat -s Sentry ``` -------------------------------- ### Wrap Mono/Flux with Sentry for Tracing Source: https://github.com/getsentry/sentry-java/blob/main/sentry-reactor/README.md Use `withSentry` to wrap Mono or Flux operations. This forks the current Sentry scopes and applies them throughout the stream's execution, enabling tracing and error capture within reactive operations. Ensure Sentry is initialized before use. ```java import reactor.core.publisher.Mono; import io.sentry.Sentry; import io.sentry.ISpan; import io.sentry.ITransaction; import io.sentry.TransactionOptions; TransactionOptions txOptions = new TransactionOptions(); txOptions.setBindToScope(true); ITransaction tx = Sentry.startTransaction("Transaction", "op", txOptions); ISpan child = tx.startChild("Outside Mono", "op") Sentry.captureMessage("Message outside Mono") child.finish() String result = SentryReactorUtils.withSentry( Mono.just("hello") .map({ (it) -> ISpan span = Sentry.getCurrentScopes().transaction.startChild("Inside Mono", "map"); Sentry.captureMessage("Message inside Mono"); span.finish(); return it; }) ).block(); System.out.println(result); tx.finish(); ``` -------------------------------- ### JavaFixes License Source: https://github.com/getsentry/sentry-java/blob/main/THIRD_PARTY_NOTICES.md This notice outlines the Apache License 2.0 for the JavaFixes library, specifically the ReusableCountLatch component adapted for the Sentry Java SDK. ```text Copyright (C) 2016 Matej Tymes Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` -------------------------------- ### Capture custom event (Old) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The old method for capturing a custom Sentry event using an EventBuilder. ```java Exception exception = new Exception("custom error"); EventBuilder eventBuilder = new EventBuilder() .withLevel(Event.Level.ERROR) .withSentryInterface(new ExceptionInterface(exception)); Sentry.capture(eventBuilder); ``` -------------------------------- ### MIT License for Breadwallet Root Detection Source: https://github.com/getsentry/sentry-java/blob/main/THIRD_PARTY_NOTICES.md This snippet contains the full MIT license text applicable to the root detection code adapted from breadwallet. ```plaintext MIT License Copyright (c) 2016 breadwallet LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` -------------------------------- ### Configure DSN via AndroidManifest.xml Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md Configure the Sentry DSN by adding a meta-data tag to your AndroidManifest.xml. This enables auto-initialization. ```xml ``` -------------------------------- ### Capture exception (New) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The new method for capturing an exception in Sentry. ```java try { int x = 1 / 0; } catch (Exception e) { Sentry.captureException(e); } ``` -------------------------------- ### Validate Binary Compatibility Source: https://github.com/getsentry/sentry-java/blob/main/CONTRIBUTING.md Generates or updates API declarations for binary compatibility validation. ```shell make api ``` ```shell ./gradlew apiDump ``` -------------------------------- ### Format Code Source: https://github.com/getsentry/sentry-java/blob/main/CONTRIBUTING.md Formats the changed code to adhere to project standards and pass CI checks. ```shell make format ``` ```shell ./gradlew spotlessApply ``` -------------------------------- ### Trigger Sentry Events with Curl Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-4-webflux/README.md Make an HTTP POST request to trigger events that will be sent to Sentry. Ensure your DSN is configured in application.properties. ```bash curl -XPOST --user user:password http://localhost:8080/person/ -H "Content-Type:application/json" -d '{"firstName":"John","lastName":"Smith"}' ``` -------------------------------- ### GraphQL Data Loader Query for Tasks and Assignees Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/README.md A GraphQL query that utilizes a data loader to fetch tasks and their assignees for a given project slug. This can help optimize fetching related data. ```graphql query TasksAndAssigneesQuery($slug: ID!) { tasks(projectSlug: $slug) { id name assigneeId assignee { id name } } } ``` -------------------------------- ### GraphQL Add Project Mutation Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/README.md A GraphQL mutation to add a new project. It requires a 'slug' variable and optionally accepts a 'name' variable. ```graphql mutation AddProjectMutation($slug: ID!) { addProject(slug: $slug) } ``` -------------------------------- ### Capture custom event (New) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The new method for capturing a custom Sentry event using a SentryEvent object. ```java Exception exception = new Exception("custom error"); SentryEvent event = new SentryEvent(exception); event.setLevel(SentryLevel.ERROR); Sentry.captureEvent(event); ``` -------------------------------- ### Trigger Sentry Events with Curl Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring/README.md Make an HTTP POST request using curl to trigger Sentry events. Ensure you replace 'user:password' with valid credentials if authentication is required. ```bash curl -XPOST --user user:password http://localhost:8080/sentry-samples-spring/person/ -H "Content-Type:application/json" -d '{"firstName":"John","lastName":"Smith"}' ``` -------------------------------- ### GraphQL Project Query Variables Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/README.md JSON object containing variables for the ProjectQuery. The 'slug' variable is set to 'statuscrash'. ```json { "slug": "statuscrash" } ``` -------------------------------- ### Add Show Mutation Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-netflix-dgs/README.md A GraphQL mutation to add a new show to the system. It requires a 'title' argument and returns the ID of the added show. ```graphql mutation AddShowMutation($title: String!) { addShow(title: $title) } ``` -------------------------------- ### Set extra data (New) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The new method for setting extra data globally for Sentry events. ```java Sentry.setExtra("extra", "thing"); ``` -------------------------------- ### Set extra data (Old) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The old method for adding extra data to the Sentry context. ```java Sentry.getContext().addExtra("extra", "thing"); ``` -------------------------------- ### Set tag (Old) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The old method for adding a tag to the current Sentry context. ```java Sentry.getContext().addTag("tagName", "tagValue"); ``` -------------------------------- ### Apache Commons Collections License Source: https://github.com/getsentry/sentry-java/blob/main/THIRD_PARTY_NOTICES.md This notice details the Apache License 2.0 for Apache Commons Collections, which is adapted for use within the Sentry Java SDK. ```text Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` -------------------------------- ### Freeze Android App Process Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/sdkperf/README.md Freeze an Android application process using ADB. This is a step to reproduce issues related to background processing and event delivery. ```bash adb shell am freeze --sticky io.sentry.samples.android ``` -------------------------------- ### Capture message (Old) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The old method for capturing a simple string message in Sentry. ```java Sentry.capture("This is a test"); ``` -------------------------------- ### GraphQL Subscription NotifyNewTask Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/README.md A GraphQL subscription to notify when a new task is created within a project. It requires a 'slug' variable and returns details about the new task and its assignee. ```graphql subscription SubscriptionNotifyNewTask($slug: ID!) { notifyNewTask(projectSlug: $slug) { id name assigneeId assignee { id name } } } ``` -------------------------------- ### Environment Variables for Agentless OpenTelemetry Source: https://github.com/getsentry/sentry-java/blob/main/sentry-opentelemetry/README.md Set these environment variables if you are not using OpenTelemetry exporters and want to disable them when running without the Sentry agent. This is an alternative to configuring exporters programmatically. ```bash OTEL_LOGS_EXPORTER=none;OTEL_METRICS_EXPORTER=none;OTEL_TRACES_EXPORTER=none ``` -------------------------------- ### Capture message (New) Source: https://github.com/getsentry/sentry-java/blob/main/MIGRATION.md The new method for capturing a string message in Sentry, with an optional SentryLevel. ```java Sentry.captureMessage("This is a test"); // SentryLevel.INFO by default Sentry.captureMessage("This is a test", SentryLevel.WARNING); // or specific level ``` -------------------------------- ### Fetch New Shows Query with Non-existent Field Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-netflix-dgs/README.md This query fetches new shows and includes a field 'iDoNotExist' which will likely result in a GraphQL error. Use this to test error handling or schema validation. ```graphql { newShows { id title releaseYear iDoNotExist } } ``` -------------------------------- ### Force Stop Android App Source: https://github.com/getsentry/sentry-java/blob/main/sentry-samples/sentry-samples-android/sdkperf/README.md Force stop an Android application using ADB. This is used to ensure a clean state before launching the app with specific importance. ```bash adb shell am force-stop io.sentry.samples.android ```