Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs to use Hint object #5062

Merged
merged 69 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
e5aef8a
Update docs to use Hint object
adinauer May 23, 2022
6e621e8
Revert migration guide changes
adinauer May 24, 2022
86cb4ad
Merge branch 'master' into feat/update-hints-docs
adinauer May 24, 2022
197422e
Change import for Hint
adinauer Jun 9, 2022
0852e8f
Document how to manipulate attachments via hints (#5070)
adinauer Jun 9, 2022
474a99e
ref(frontend): Bump JS SDK to 7.0 beta 2 (#5064)
lobsterkatie May 24, 2022
3c64c02
Fix manifest code snippet tag (#5069)
marandaneto May 24, 2022
71fdf96
fix: typos in Unity troubleshooting (#5060)
vaind May 24, 2022
7e069d6
Typo fix (#5059)
akauppi May 24, 2022
a8f546d
fix references to source maps and time range change example (#5051)
imatwawana May 24, 2022
c55950b
Fix typo in query builder docs (#5072)
arusahni May 24, 2022
8113e01
updated banner (#5067)
dorothymlee May 24, 2022
5f6b8ef
docs(js): Add sourcemaps explain to source maps troubleshooting guide…
kamilogorek May 25, 2022
75308d2
feat(discover): extend list of stacking functions (#5074)
wmak May 25, 2022
b545990
chore: bump Sentry SDK to 7.0.0-rc.0 (#5077)
vladanpaunovic May 25, 2022
143c5b2
chore(billing): GA on-demand budget for all performance plans (#5075)
dashed May 25, 2022
c935912
fix(alerts): Remove duplicate alert rules section (#5080)
taylangocmen May 26, 2022
3b9c06c
feat(visibility): Add a note about apdex score (#5081)
wmak May 27, 2022
d84beb4
feat(unity): Added Screenshot to Verify (#5031)
bitsandfoxes May 30, 2022
a3ce6a6
Add instructions to tree shake tracing code in JS SDK (#5086)
lforst May 30, 2022
af6ece1
Add docs for new attachments API (#5073)
timfish May 30, 2022
a1404ed
Add React Router v6 instrumentation docs. (#5037)
onurtemizkan May 30, 2022
40b0563
Remove `ignoreSentryErrors` section in JS docs (#5036)
lforst May 30, 2022
ecdd14a
Update ExtraErrorData depth description (#5021)
lforst May 30, 2022
63fb307
feat(angular): Update Angular docs for v7 release (#4963)
Lms24 May 30, 2022
727915b
Adjust JS CDN bundle page to reflect ES5/ES6 naming changes (#4962)
lforst May 30, 2022
23cc774
ref(js): change migration guide URLs from v7 branch to master (#5087)
Lms24 May 30, 2022
4f47cc4
Adust docs for dealing with baggage headers (CORS and meta tags) (#5061)
Lms24 May 30, 2022
ebc0790
Add tree shaking guide for default integrations (#4996)
Lms24 May 30, 2022
9088693
Replace deprecated severity enums with string literals (#4940)
lforst May 30, 2022
d221127
getsentry/relay@8fcff0b580ab5bbe58f81bf3b4d4a4a923180e90
jjbayer May 30, 2022
d6f0151
Adust docs after renaming `UserAgent` integration to `HttpContext` (#…
Lms24 May 30, 2022
5d6b7ca
Add Prisma ORM Integration Docs. (#4961)
onurtemizkan May 30, 2022
f87b8cf
chore: bump Sentry SDK to 7.0.0 (#5088)
lforst May 30, 2022
6c0867a
ref(native): capture-error using high-level API. (#5085)
supervacuus May 30, 2022
9898580
feat(widget-builder): Add GA documentation - (#5065)
priscilawebdev May 30, 2022
221bd03
Add SampleRate code sample for go (#5090)
sl0thentr0py May 30, 2022
22f62a0
fix(android): Typo for UI transactions (#5096)
philipphofmann May 31, 2022
6bd3fe4
ref(js): Add note about old name of HttpContext integration (#5099)
Lms24 May 31, 2022
0afaee8
ref(js): Add baggage intormation to automatic instrumentation page (#…
Lms24 May 31, 2022
80c6cb0
feat(apple): User interaction instrumentation (#5098)
philipphofmann Jun 1, 2022
b6d1488
dotnet performance clarify GetSpan (#5078)
souredoutlook Jun 1, 2022
a0b422e
chore(unity): Fixed typo (#5050)
bitsandfoxes Jun 1, 2022
7086e14
docs: add explanation regarding appcenter token (#5063)
jeremybarbet Jun 1, 2022
eaf4e1f
ref(integration-platform): Add URI formatting guidelines to docs (#5103)
leeandher Jun 1, 2022
a390fb2
improve enable suspect commits content (#5094)
imatwawana Jun 1, 2022
e20071a
feat(alerts): Restore duplciate alert rule docs (#5111)
taylangocmen Jun 2, 2022
118036f
feat(integrations): Direct users to the reference implementation (#5053)
leeandher Jun 2, 2022
7fbcf4c
getsentry/relay@acb94fa552036e598b28457d8b5c3d4489d9a961
jjbayer Jun 3, 2022
8f3b623
ref(android): Simplify UI transaction code sample (#5097)
philipphofmann Jun 3, 2022
8feace8
feat(unity): Added additional platforms to native support (#5109)
bitsandfoxes Jun 3, 2022
5cddf6e
feat(apple): Add UI instrumentation to wizard (#5100)
philipphofmann Jun 3, 2022
96c849f
Refactor Ionic/Capacitor/Cordova Wizards (#5093)
lucas-zimerman Jun 3, 2022
1fc0e48
fix(quotas): Clarify filters application scope (#5102)
iker-barriocanal Jun 3, 2022
0f49099
feat(api): Update the bump script since CI doesn't run it (#5115)
wmak Jun 3, 2022
a181ff3
chore(api): bump api sha with events doc (#5116)
wmak Jun 6, 2022
3f290d4
Add metric alert slack example with new chart (#5113)
scttcper Jun 6, 2022
4c854c2
Change migration guide for hints (#5068)
adinauer Jun 7, 2022
27f4bbe
Add discontinuation of AngularJS 1.x (#5123)
lforst Jun 7, 2022
ef27279
feat(docs): Document flutter autoInitializeNativeSdk (#5029)
denrase Jun 7, 2022
9f42fd7
chore(unity): Updated troubleshooting for 2022 (#5122)
bitsandfoxes Jun 7, 2022
4a38cf2
ref(native): Clarify before_send with Crashpad (#5092)
supervacuus Jun 8, 2022
2067a09
getsentry/relay@d8f887a595a3ee7c78c16d4513ab86242c859f50
jjbayer Jun 8, 2022
796748d
docs(dashboards): Releases in Dashboards (#5083)
shruthilayaj Jun 8, 2022
137a5e5
fix transaction quota management content (#5114)
imatwawana Jun 8, 2022
327d973
feat(alerts): Alert wizard v3 alert config docs (#5107)
taylangocmen Jun 8, 2022
92405ba
hid banner (#5127)
dorothymlee Jun 9, 2022
99f2eed
feat(android): App permissions in App Context (#5038)
romtsn Jun 9, 2022
3fe2c38
Merge branch 'master' into feat/update-hints-docs
adinauer Jun 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
```java
import io.sentry.SentryEvent;
import io.sentry.SentryOptions;
import io.sentry.Hint
import org.springframework.stereotype.Component;

@Component
public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallback {
@Override
public SentryEvent execute(SentryEvent event, Object hint) {
public SentryEvent execute(SentryEvent event, Hint hint) {
if (event.getThrowable() instanceof SQLException) {
event.setFingerprints(Arrays.asList("database-connection-error"));
}
Expand All @@ -18,11 +19,12 @@ public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallbac
```kotlin
import io.sentry.SentryEvent
import io.sentry.SentryOptions
import io.sentry.Hint
import org.springframework.stereotype.Component

@Component
class CustomBeforeSendCallback : SentryOptions.BeforeSendCallback {
override fun execute(event: SentryEvent, hint: Any?): SentryEvent? {
override fun execute(event: SentryEvent, hint: Hint): SentryEvent? {
if (event.throwable is SQLException) {
event.fingerprints = listOf("database-connection-error")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
```java
import io.sentry.SentryEvent;
import io.sentry.SentryOptions;
import io.sentry.Hint
import org.springframework.stereotype.Component;

@Component
public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallback {
@Override
public SentryEvent execute(SentryEvent event, Object hint) {
public SentryEvent execute(SentryEvent event, Hint hint) {
if (event.getThrowable() instanceof SQLException) {
event.setFingerprints(Arrays.asList("database-connection-error"));
}
Expand All @@ -18,11 +19,12 @@ public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallbac
```kotlin
import io.sentry.SentryEvent
import io.sentry.SentryOptions
import io.sentry.Hint
import org.springframework.stereotype.Component

@Component
class CustomBeforeSendCallback : SentryOptions.BeforeSendCallback {
override fun execute(event: SentryEvent, hint: Any?): SentryEvent? {
override fun execute(event: SentryEvent, hint: Hint): SentryEvent? {
if (event.throwable is SQLException) {
event.fingerprints = listOf("database-connection-error")
}
Expand Down
12 changes: 7 additions & 5 deletions src/includes/configuration/before-send-hint/java.spring-boot.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
A `BiFunction<SentryEvent, Object, SentryEvent>` can be used to mutate, discard (return null), or return a completely new event.
A `BiFunction<SentryEvent, Hint, SentryEvent>` can be used to mutate, discard (return null), or return a completely new event.

```java
import io.sentry.SentryEvent;
import io.sentry.SentryOptions;
import io.sentry.Hint
import org.springframework.stereotype.Component;

@Component
public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallback {
@Override
public SentryEvent execute(SentryEvent event, Object hint) {
if (hint instanceof MyHint) {
public SentryEvent execute(SentryEvent event, Hint hint) {
if (hint.get("my-hint-key") != null) {
return null;
} else {
return event;
Expand All @@ -21,12 +22,13 @@ public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallbac
```kotlin
import io.sentry.SentryEvent
import io.sentry.SentryOptions
import io.sentry.Hint
import org.springframework.stereotype.Component

@Component
class CustomBeforeSendCallback : SentryOptions.BeforeSendCallback {
override fun execute(event: SentryEvent, hint: Any?): SentryEvent? {
if (hint is MyHint) {
override fun execute(event: SentryEvent, hint: Hint): SentryEvent? {
if (hint["my-hint-key"] != null) {
null
} else {
event
Expand Down
12 changes: 7 additions & 5 deletions src/includes/configuration/before-send-hint/java.spring.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
A `BiFunction<SentryEvent, Object, SentryEvent>` can be used to mutate, discard (return null), or return a completely new event.
A `BiFunction<SentryEvent, Hint, SentryEvent>` can be used to mutate, discard (return null), or return a completely new event.

```java
import io.sentry.SentryEvent;
import io.sentry.SentryOptions;
import io.sentry.Hint
import org.springframework.stereotype.Component;

@Component
public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallback {
@Override
public SentryEvent execute(SentryEvent event, Object hint) {
if (hint instanceof MyHint) {
public SentryEvent execute(SentryEvent event, Hint hint) {
if (hint.get("my-hint-key") != null) {
return null;
} else {
return event;
Expand All @@ -21,12 +22,13 @@ public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallbac
```kotlin
import io.sentry.SentryEvent
import io.sentry.SentryOptions
import io.sentry.Hint
import org.springframework.stereotype.Component

@Component
class CustomBeforeSendCallback : SentryOptions.BeforeSendCallback {
override fun execute(event: SentryEvent, hint: Any?): SentryEvent? {
if (hint is MyHint) {
override fun execute(event: SentryEvent, hint: Hnt): SentryEvent? {
if (hint["my-hint-key"] != null) {
null
} else {
event
Expand Down
6 changes: 4 additions & 2 deletions src/includes/configuration/before-send/java.spring-boot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
```java
import io.sentry.SentryEvent;
import io.sentry.SentryOptions;
import io.sentry.Hint
import org.springframework.stereotype.Component;

@Component
public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallback {
@Override
public SentryEvent execute(SentryEvent event, Object hint) {
public SentryEvent execute(SentryEvent event, Hint hint) {
// Example: Never send server name in events
event.setServerName(null);
return event;
Expand All @@ -19,11 +20,12 @@ public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallbac
```kotlin
import io.sentry.SentryEvent
import io.sentry.SentryOptions
import io.sentry.Hint
import org.springframework.stereotype.Component

@Component
class CustomBeforeSendCallback : SentryOptions.BeforeSendCallback {
override fun execute(event: SentryEvent, hint: Any?): SentryEvent? {
override fun execute(event: SentryEvent, hint: Hint): SentryEvent? {
// Example: Never send server name in events
event.serverName = null
return event
Expand Down
6 changes: 4 additions & 2 deletions src/includes/configuration/before-send/java.spring.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
```java
import io.sentry.SentryEvent;
import io.sentry.SentryOptions;
import io.sentry.Hint
import org.springframework.stereotype.Component;

@Component
public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallback {
@Override
public SentryEvent execute(SentryEvent event, Object hint) {
public SentryEvent execute(SentryEvent event, Hint hint) {
// Example: Never send server name in events
event.setServerName(null);
return event;
Expand All @@ -19,11 +20,12 @@ public class CustomBeforeSendCallback implements SentryOptions.BeforeSendCallbac
```kotlin
import io.sentry.SentryEvent
import io.sentry.SentryOptions
import io.sentry.Hint
import org.springframework.stereotype.Component

@Component
class CustomBeforeSendCallback : SentryOptions.BeforeSendCallback {
override fun execute(event: SentryEvent, hint: Any?): SentryEvent? {
override fun execute(event: SentryEvent, hint: Hint): SentryEvent? {
// Example: Never send server name in events
event.serverName = null
return event
Expand Down
3 changes: 2 additions & 1 deletion src/includes/configuration/config-intro/java.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ public class MyClass {
```kotlin {tabTitle:Kotlin}
import io.sentry.Sentry
import io.sentry.SentryOptions.BeforeSendCallback
import io.sentry.Hint

fun main() {
Sentry.init { options ->
// your Sentry project/dashboard
options.dsn = "___PUBLIC_DSN___"
options.release = "io.sentry.samples.console@3.0.0+1"
options.beforeSend = BeforeSendCallback { event: SentryEvent, hint: Any? ->
options.beforeSend = BeforeSendCallback { event: SentryEvent, hint: Hint ->
// Drop an event altogether:
if (event.getTag("SomeTag") != null) {
null
Expand Down
110 changes: 110 additions & 0 deletions src/includes/enriching-events/add-attachment/java.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
To add an attachment, you can either add it to the scope, pass it to any of the `capture` methods, or manipulate the list of attachments in an `EventProcessor` or `beforeSend`.

### Passing Attachments to Capture

You may pass attachments to any of the `capture` methods, for example, when capturing an exception:

```java
import io.sentry.Attachment;
import io.sentry.Hint;
import io.sentry.Sentry;

Sentry.captureException(new IllegalStateException(), Hint.withAttachment("/path/to/file.txt"))
```

```kotlin
import io.sentry.Attachment;
import io.sentry.Hint;
import io.sentry.Sentry;

Sentry.captureException(IllegalStateException(), Hint.withAttachment("/path/to/file.txt"))
```

### Adding Attachments in `EventProcessor`

You may also manipulate attachments in `EventProcessor`:

```java
import io.sentry.Attachment;
import io.sentry.EventProcessor;
import io.sentry.Hint;
import io.sentry.Sentry;
import io.sentry.SentryEvent;

class AttachmentManipulationEventProcessor implements EventProcessor {
@Override
public SentryEvent process(SentryEvent event, Hint hint) {
hint.addAttachment(new Attachment("/path/to/file.txt"))
return event;
}
}

// Register the AttachmentManipulationEventProcessor using SentryOptions#addEventProcessor or Scope#addEventProcessor

// Send an event to Sentry. During construction of the event
// the attachment will be added by the event processor.
Sentry.captureMessage("Hello, world!");
```

```kotlin
import io.sentry.Attachment;
import io.sentry.EventProcessor;
import io.sentry.Hint;
import io.sentry.Sentry
import io.sentry.SentryEvent;
import io.sentry.protocol.Message

class AttachmentManipulationEventProcessor: EventProcessor {
override fun process(event: SentryEvent, hint: Hint): SentryEvent? {
hint.addAttachment(Attachment("/path/to/file.txt"))
return event
}
}

// Register the AttachmentManipulationEventProcessor using SentryOptions#addEventProcessor or Scope#addEventProcessor

// Send an event to Sentry. During construction of the event
// the attachment will be added by the event processor.
Sentry.captureMessage("Hello, world!")
```

<Note>

Instead of adding attachments, you can also remove them, by setting a different (or empty) list of attachments using `Hint#setAttachments()`.

</Note>

### Adding Attachments in `beforeSend`

Another way of adding attachments is using `beforeSend`:

```java
import io.sentry.Attachment;
import io.sentry.Hint;
import io.sentry.Sentry;

options.setBeforeSend((event, hint) -> {
hint.addAttachment(new Attachment("/path/to/file.txt"))
return event;
});
```

```kotlin
import io.sentry.Attachment;
import io.sentry.Hint;
import io.sentry.Sentry;
import io.sentry.SentryOptions.BeforeSendCallback

options.beforeSend = BeforeSendCallback { event, hint ->
hint.addAttachment(Attachment("/path/to/file.txt"))
event
}
```

<Note>

Instead of adding attachments, you can also remove them, by setting a different (or empty) list of attachments using `Hint#setAttachments()`.

</Note>

### Adding Attachments to the Scope
5 changes: 3 additions & 2 deletions src/platforms/android/configuration/manual-init.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Or, to completely remove the merging of the `ContentProvider`:
android:name="io.sentry.android.core.SentryInitProvider"
android:authorities="${applicationId}.SentryInitProvider"
tools:node="remove" />

<provider
android:name="io.sentry.android.core.SentryPerformanceProvider"
android:authorities="${applicationId}.SentryPerformanceProvider"
Expand Down Expand Up @@ -63,6 +63,7 @@ public class SentryApplication extends Application {
```kotlin
import io.sentry.android.core.SentryAndroid
import io.sentry.SentryOptions.BeforeSendCallback
import io.sentry.Hint
import android.app.Application

class SentryApplication : Application() {
Expand All @@ -74,7 +75,7 @@ class SentryApplication : Application() {
// Add a callback that will be used before the event is sent to Sentry.
// With this callback, you can modify the event or, when returning null, also discard the event.
options.beforeSend =
BeforeSendCallback { event: SentryEvent, hint: Any? ->
BeforeSendCallback { event: SentryEvent, hint: Hint ->
if (SentryLevel.DEBUG == event.level) {
null
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/android/migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ _New_:

```kotlin
SentryOptions#addEventProcessor(object : EventProcessor {
override fun process(event: SentryEvent, hint: Any?): SentryEvent? {
override fun process(event: SentryEvent, hint: Hint): SentryEvent? {
return event
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ In addition, you can set these parameters:

## Uploading Attachments

<PlatformSection supported={["native", "javascript"]}>
<PlatformSection supported={["native", "javascript", "java"]}>

<PlatformSection supported={["javascript", "node"]}>

Expand Down
Loading