Skip to content

Commit 7d2bcf5

Browse files
romtsnclaude
andauthored
feat(java, android): Add Spotlight integration docs (#16323)
## DESCRIBE YOUR PR Add documentation for the new `sentry-spotlight` module extracted in [sentry-java#5064](getsentry/sentry-java#5064) (available from 8.32.0). This module allows Android users to include Spotlight only in debug builds via `debugImplementation`, preventing insecure HTTP URLs from leaking into production APKs. - Add Android Spotlight integration page (`/platforms/android/integrations/spotlight/`) with AndroidManifest.xml and programmatic configuration - Add Java Spotlight integration page (`/platforms/java/integrations/spotlight/`) with Gradle, Maven, and SBT install snippets ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent d5f6056 commit 7d2bcf5

2 files changed

Lines changed: 177 additions & 0 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: Spotlight
3+
description: "Learn how to use Sentry Spotlight for local development observability on Android."
4+
---
5+
6+
[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.
7+
8+
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.
9+
10+
## Install
11+
12+
We recommend using `debugImplementation` so the Spotlight dependency is excluded from release builds:
13+
14+
```groovy {filename:app/build.gradle}
15+
debugImplementation 'io.sentry:sentry-spotlight:{{@inject packages.version('sentry.java.spotlight', '8.32.0') }}'
16+
```
17+
18+
```kotlin {filename:app/build.gradle.kts}
19+
debugImplementation("io.sentry:sentry-spotlight:{{@inject packages.version('sentry.java.spotlight', '8.32.0') }}")
20+
```
21+
22+
If you need Spotlight in all build types, use `implementation` instead of `debugImplementation`.
23+
24+
## Configure
25+
26+
```xml {tabTitle:XML}
27+
<application>
28+
<!-- Enable Spotlight -->
29+
<meta-data android:name="io.sentry.spotlight.enable" android:value="true" />
30+
<!-- Optional: override the default Spotlight URL -->
31+
<meta-data android:name="io.sentry.spotlight.url" android:value="http://10.0.2.2:8969/stream" />
32+
</application>
33+
```
34+
35+
```java {tabTitle:Java}
36+
import io.sentry.android.core.SentryAndroid;
37+
38+
SentryAndroid.init(this, options -> {
39+
options.setDsn("___PUBLIC_DSN___");
40+
options.setEnableSpotlight(true);
41+
// Optional: override the default Spotlight URL
42+
options.setSpotlightConnectionUrl("http://10.0.2.2:8969/stream");
43+
});
44+
```
45+
46+
```kotlin {tabTitle:Kotlin}
47+
import io.sentry.android.core.SentryAndroid
48+
49+
SentryAndroid.init(this) { options ->
50+
options.dsn = "___PUBLIC_DSN___"
51+
options.isEnableSpotlight = true
52+
// Optional: override the default Spotlight URL
53+
options.spotlightConnectionUrl = "http://10.0.2.2:8969/stream"
54+
}
55+
```
56+
57+
<Alert level="info">
58+
59+
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.
60+
61+
</Alert>
62+
63+
## Verify
64+
65+
To verify the integration is working, capture a test exception and check the Spotlight UI:
66+
67+
```java
68+
import io.sentry.Sentry;
69+
70+
Sentry.captureException(new Exception("Spotlight test from Android!"));
71+
```
72+
73+
```kotlin
74+
import io.sentry.Sentry
75+
76+
Sentry.captureException(Exception("Spotlight test from Android!"))
77+
```
78+
79+
Open the Spotlight UI and confirm that the error event appears.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
title: Spotlight
3+
description: "Learn how to use Sentry Spotlight for local development observability in your Java app."
4+
---
5+
6+
[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.
7+
8+
The `sentry-spotlight` module provides a `SpotlightIntegration` that sends a copy of all Sentry events to your local Spotlight instance.
9+
10+
## Install
11+
12+
To install use:
13+
14+
```groovy {tabTitle:Gradle}
15+
implementation 'io.sentry:sentry-spotlight:{{@inject packages.version('sentry.java.spotlight', '8.32.0') }}'
16+
```
17+
18+
```xml {tabTitle:Maven}
19+
<dependency>
20+
<groupId>io.sentry</groupId>
21+
<artifactId>sentry-spotlight</artifactId>
22+
<version>{{@inject packages.version('sentry.java.spotlight', '8.32.0') }}</version>
23+
</dependency>
24+
```
25+
26+
```scala {tabTitle: SBT}
27+
libraryDependencies += "io.sentry" % "sentry-spotlight" % "{{@inject packages.version('sentry.java.spotlight', '8.32.0') }}"
28+
```
29+
30+
For other dependency managers, check out the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-spotlight).
31+
32+
## Configure
33+
34+
<PlatformSection supported={["java.spring-boot"]}>
35+
36+
```text {tabTitle:Properties} {filename:application.properties}
37+
sentry.enable-spotlight=true
38+
# Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream)
39+
sentry.spotlight-connection-url=http://localhost:8969/stream
40+
```
41+
42+
</PlatformSection>
43+
44+
<PlatformSection notSupported={["java.spring-boot"]}>
45+
46+
```text {tabTitle:Properties} {filename:sentry.properties}
47+
enable-spotlight=true
48+
# Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream)
49+
spotlight-connection-url=http://localhost:8969/stream
50+
```
51+
52+
</PlatformSection>
53+
54+
```java {tabTitle:Java}
55+
import io.sentry.Sentry;
56+
57+
Sentry.init(options -> {
58+
options.setDsn("___PUBLIC_DSN___");
59+
options.setEnableSpotlight(true);
60+
// Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream)
61+
options.setSpotlightConnectionUrl("http://localhost:8969/stream");
62+
});
63+
```
64+
65+
```kotlin {tabTitle:Kotlin}
66+
import io.sentry.Sentry
67+
68+
Sentry.init { options ->
69+
options.dsn = "___PUBLIC_DSN___"
70+
options.isEnableSpotlight = true
71+
// Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream)
72+
options.spotlightConnectionUrl = "http://localhost:8969/stream"
73+
}
74+
```
75+
76+
<Alert level="info">
77+
78+
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.
79+
80+
</Alert>
81+
82+
## Verify
83+
84+
To verify the integration is working, capture a test exception and check the Spotlight UI:
85+
86+
```java
87+
import io.sentry.Sentry;
88+
89+
Sentry.captureException(new Exception("Spotlight test from Java!"));
90+
```
91+
92+
```kotlin
93+
import io.sentry.Sentry
94+
95+
Sentry.captureException(Exception("Spotlight test from Java!"))
96+
```
97+
98+
Open the Spotlight UI and confirm that the error event appears.

0 commit comments

Comments
 (0)