Skip to content

Commit ad32f69

Browse files
romtsnclaude
andcommitted
docs(java, android): Add Spotlight integration docs
Add documentation for the new `sentry-spotlight` module extracted in sentry-java#5064 (available from 8.32.0). Covers install, configure, and verify sections for both Android and Java platforms. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4414cd7 commit ad32f69

2 files changed

Lines changed: 161 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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 {tabTitle:Gradle}
15+
debugImplementation 'io.sentry:sentry-spotlight:{{@inject packages.version('sentry.java.spotlight', '8.32.0') }}'
16+
```
17+
18+
If you need Spotlight in all build types, use `implementation` instead:
19+
20+
```groovy {tabTitle:Gradle}
21+
implementation 'io.sentry:sentry-spotlight:{{@inject packages.version('sentry.java.spotlight', '8.32.0') }}'
22+
```
23+
24+
For other dependency managers, check out the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-spotlight).
25+
26+
## Configure
27+
28+
```xml {tabTitle:XML}
29+
<application>
30+
<!-- Enable Spotlight -->
31+
<meta-data android:name="io.sentry.spotlight.enable" android:value="true" />
32+
<!-- Optional: override the default Spotlight URL -->
33+
<meta-data android:name="io.sentry.spotlight.url" android:value="http://10.0.2.2:8969/stream" />
34+
</application>
35+
```
36+
37+
```java {tabTitle:Java}
38+
import io.sentry.android.core.SentryAndroid;
39+
40+
SentryAndroid.init(this, options -> {
41+
options.setDsn("___PUBLIC_DSN___");
42+
options.setEnableSpotlight(true);
43+
// Optional: override the default Spotlight URL
44+
options.setSpotlightConnectionUrl("http://10.0.2.2:8969/stream");
45+
});
46+
```
47+
48+
```kotlin {tabTitle:Kotlin}
49+
import io.sentry.android.core.SentryAndroid
50+
51+
SentryAndroid.init(this) { options ->
52+
options.dsn = "___PUBLIC_DSN___"
53+
options.isEnableSpotlight = true
54+
// Optional: override the default Spotlight URL
55+
options.spotlightConnectionUrl = "http://10.0.2.2:8969/stream"
56+
}
57+
```
58+
59+
<Note>
60+
61+
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.
62+
63+
</Note>
64+
65+
## Verify
66+
67+
To verify the integration is working, capture a test exception and check the Spotlight UI:
68+
69+
```java
70+
import io.sentry.Sentry;
71+
72+
Sentry.captureException(new Exception("Spotlight test from Android!"));
73+
```
74+
75+
```kotlin
76+
import io.sentry.Sentry
77+
78+
Sentry.captureException(Exception("Spotlight test from Android!"))
79+
```
80+
81+
Open the Spotlight UI and confirm that the error event appears.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
Enable Spotlight through `SentryOptions` during initialization:
35+
36+
```java
37+
import io.sentry.Sentry;
38+
39+
Sentry.init(options -> {
40+
options.setDsn("___PUBLIC_DSN___");
41+
options.setEnableSpotlight(true);
42+
// Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream)
43+
options.setSpotlightConnectionUrl("http://localhost:8969/stream");
44+
});
45+
```
46+
47+
```kotlin
48+
import io.sentry.Sentry
49+
50+
Sentry.init { options ->
51+
options.dsn = "___PUBLIC_DSN___"
52+
options.isEnableSpotlight = true
53+
// Optional: override the default Spotlight URL (defaults to http://localhost:8969/stream)
54+
options.spotlightConnectionUrl = "http://localhost:8969/stream"
55+
}
56+
```
57+
58+
<Note>
59+
60+
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.
61+
62+
</Note>
63+
64+
## Verify
65+
66+
To verify the integration is working, capture a test exception and check the Spotlight UI:
67+
68+
```java
69+
import io.sentry.Sentry;
70+
71+
Sentry.captureException(new Exception("Spotlight test from Java!"));
72+
```
73+
74+
```kotlin
75+
import io.sentry.Sentry
76+
77+
Sentry.captureException(Exception("Spotlight test from Java!"))
78+
```
79+
80+
Open the Spotlight UI and confirm that the error event appears.

0 commit comments

Comments
 (0)