Skip to content

Commit bfccc10

Browse files
tonyogetsantry[bot]lizokm
authored
feat(sentry-go): Document Attachments support (getsentry#7568)
Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com> Co-authored-by: Liza Mock <liza.mock@sentry.io>
1 parent 61aa10c commit bfccc10

File tree

2 files changed

+40
-1
lines changed
  • src
    • platform-includes/enriching-events/add-attachment
    • platforms/common/enriching-events/attachments

2 files changed

+40
-1
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Attachments live on the `Scope` and will be sent with all events.
2+
3+
```go
4+
sentry.ConfigureScope(func(scope *sentry.Scope) {
5+
// Add an attachment
6+
scope.AddAttachment(&Attachment{
7+
Filename: "report.html",
8+
ContentType: "text/html",
9+
Payload: []byte("<h1>Look, HTML</h1>"),
10+
})
11+
})
12+
```
13+
14+
An attachment has the following fields:
15+
16+
`Filename`
17+
18+
: The filename that will be displayed in [sentry.io](https://sentry.io).
19+
20+
`Payload`
21+
22+
: The content of the attachment in bytes.
23+
24+
`ContentType`
25+
26+
: (Optional) The type of content stored in this attachment. Any [MIME
27+
type](https://www.iana.org/assignments/media-types/media-types.xhtml) may be
28+
used.

src/platforms/common/enriching-events/attachments/index.mdx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ supported:
1616
- react-native
1717
- python
1818
- kotlin-multiplatform
19+
- go
1920
---
2021

2122
<PlatformSection supported={["apple", "android", "java"]}>
@@ -34,6 +35,16 @@ This feature is supported in version 3.0 and higher of Sentry's .NET SDK.
3435

3536
</PlatformSection>
3637

38+
<PlatformSection supported={["go"]}>
39+
40+
<Note>
41+
42+
Attachments are supported in `sentry-go` version `0.23.0` and above.
43+
44+
</Note>
45+
46+
</PlatformSection>
47+
3748
<PlatformSection supported={["unreal"]}>
3849

3950
<Note>
@@ -86,7 +97,7 @@ In addition, you can set these parameters:
8697

8798
## Uploading Attachments
8899

89-
<PlatformSection supported={["native", "javascript", "java", "python", "kotlin-multiplatform"]}>
100+
<PlatformSection supported={["native", "javascript", "java", "python", "kotlin-multiplatform", "go"]}>
90101

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

0 commit comments

Comments
 (0)