diff --git a/docs/platforms/android/integrations/spotlight/index.mdx b/docs/platforms/android/integrations/spotlight/index.mdx new file mode 100644 index 0000000000000..93018cf8290b8 --- /dev/null +++ b/docs/platforms/android/integrations/spotlight/index.mdx @@ -0,0 +1,79 @@ +--- +title: Spotlight +description: "Learn how to use Sentry Spotlight for local development observability on Android." +--- + +[Sentry Spotlight](https://spotlightjs.com/) is a local development tool that provides real-time observability for errors, traces, logs, and performance data during development. It allows you to see Sentry events in real-time without sending them to Sentry's servers, making it ideal for local debugging. + +The `sentry-spotlight` module provides a `SpotlightIntegration` that sends a copy of all Sentry events to your local Spotlight instance. By using `debugImplementation`, you can ensure Spotlight is excluded from release builds, preventing insecure HTTP URLs from leaking into production APKs. + +## Install + +We recommend using `debugImplementation` so the Spotlight dependency is excluded from release builds: + +```groovy {filename:app/build.gradle} +debugImplementation 'io.sentry:sentry-spotlight:{{@inject packages.version('sentry.java.spotlight', '8.32.0') }}' +``` + +```kotlin {filename:app/build.gradle.kts} +debugImplementation("io.sentry:sentry-spotlight:{{@inject packages.version('sentry.java.spotlight', '8.32.0') }}") +``` + +If you need Spotlight in all build types, use `implementation` instead of `debugImplementation`. + +## Configure + +```xml {tabTitle:XML} + + + + + + +``` + +```java {tabTitle:Java} +import io.sentry.android.core.SentryAndroid; + +SentryAndroid.init(this, options -> { + options.setDsn("___PUBLIC_DSN___"); + options.setEnableSpotlight(true); + // Optional: override the default Spotlight URL + options.setSpotlightConnectionUrl("http://10.0.2.2:8969/stream"); +}); +``` + +```kotlin {tabTitle:Kotlin} +import io.sentry.android.core.SentryAndroid + +SentryAndroid.init(this) { options -> + options.dsn = "___PUBLIC_DSN___" + options.isEnableSpotlight = true + // Optional: override the default Spotlight URL + options.spotlightConnectionUrl = "http://10.0.2.2:8969/stream" +} +``` + + + +The default Spotlight URL is `http://10.0.2.2:8969/stream`. The `10.0.2.2` address is the Android emulator's bridge to the host machine's `localhost`. If you're running on a physical device, replace this with your machine's local IP address. + + + +## Verify + +To verify the integration is working, capture a test exception and check the Spotlight UI: + +```java +import io.sentry.Sentry; + +Sentry.captureException(new Exception("Spotlight test from Android!")); +``` + +```kotlin +import io.sentry.Sentry + +Sentry.captureException(Exception("Spotlight test from Android!")) +``` + +Open the Spotlight UI and confirm that the error event appears. diff --git a/docs/platforms/java/common/integrations/spotlight.mdx b/docs/platforms/java/common/integrations/spotlight.mdx new file mode 100644 index 0000000000000..b5a2e052d684a --- /dev/null +++ b/docs/platforms/java/common/integrations/spotlight.mdx @@ -0,0 +1,98 @@ +--- +title: Spotlight +description: "Learn how to use Sentry Spotlight for local development observability in your Java app." +--- + +[Sentry Spotlight](https://spotlightjs.com/) is a local development tool that provides real-time observability for errors, traces, logs, and performance data during development. It allows you to see Sentry events in real-time without sending them to Sentry's servers, making it ideal for local debugging. + +The `sentry-spotlight` module provides a `SpotlightIntegration` that sends a copy of all Sentry events to your local Spotlight instance. + +## Install + +To install use: + +```groovy {tabTitle:Gradle} +implementation 'io.sentry:sentry-spotlight:{{@inject packages.version('sentry.java.spotlight', '8.32.0') }}' +``` + +```xml {tabTitle:Maven} + + io.sentry + sentry-spotlight + {{@inject packages.version('sentry.java.spotlight', '8.32.0') }} + +``` + +```scala {tabTitle: SBT} +libraryDependencies += "io.sentry" % "sentry-spotlight" % "{{@inject packages.version('sentry.java.spotlight', '8.32.0') }}" +``` + +For other dependency managers, check out the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-spotlight). + +## Configure + + + +```text {tabTitle:Properties} {filename:application.properties} +sentry.enable-spotlight=true +# Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream) +sentry.spotlight-connection-url=http://localhost:8969/stream +``` + + + + + +```text {tabTitle:Properties} {filename:sentry.properties} +enable-spotlight=true +# Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream) +spotlight-connection-url=http://localhost:8969/stream +``` + + + +```java {tabTitle:Java} +import io.sentry.Sentry; + +Sentry.init(options -> { + options.setDsn("___PUBLIC_DSN___"); + options.setEnableSpotlight(true); + // Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream) + options.setSpotlightConnectionUrl("http://localhost:8969/stream"); +}); +``` + +```kotlin {tabTitle:Kotlin} +import io.sentry.Sentry + +Sentry.init { options -> + options.dsn = "___PUBLIC_DSN___" + options.isEnableSpotlight = true + // Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream) + options.spotlightConnectionUrl = "http://localhost:8969/stream" +} +``` + + + +The default Spotlight URL is `http://localhost:8969/stream`. You only need to set `spotlightConnectionUrl` if your Spotlight instance is running on a different host or port. + + + +## Verify + +To verify the integration is working, capture a test exception and check the Spotlight UI: + +```java +import io.sentry.Sentry; + +Sentry.captureException(new Exception("Spotlight test from Java!")); +``` + +```kotlin +import io.sentry.Sentry + +Sentry.captureException(Exception("Spotlight test from Java!")) +``` + +Open the Spotlight UI and confirm that the error event appears.