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

feat(ruby): Add attachments docs #11086

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 38 additions & 0 deletions docs/platforms/ruby/common/enriching-events/attachments/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: Attachments
description: "Learn more about how Sentry can store additional files in the same request as event attachments."
---

Sentry can enrich your events for further investigation by storing additional files, such as config or log files, as attachments.

## Uploading Attachments

<PlatformContent includePath="enriching-events/add-attachment" />

<Note>

Sentry allows at most 20MB for a compressed request, and at most 100MB of uncompressed attachments per event, including the crash report file (if applicable). Uploads exceeding this size are rejected with HTTP error `413 Payload Too Large` and the data is dropped immediately. To add larger or more files, consider secondary storage options.

</Note>

Attachments persist for 30 days; if your total storage included in your quota is exceeded, attachments will not be stored. You can delete attachments or their containing events at any time. Deleting an attachment does not affect your quota - Sentry counts an attachment toward your quota as soon as it is stored.

Learn more about how attachments impact your [quota](/pricing/quotas/).

### Access to Attachments

To limit access to attachments, navigate to your organization's **General Settings**, then select the _Attachments Access_ dropdown to set appropriate access — any member of your organization, the organization billing owner, member, admin, manager, or owner.

<Include name="common-imgs/attachments-access" />

By default, access is granted to all members when storage is enabled. If a member does not have access to the project, the ability to download an attachment is not available; the button will be greyed out in Sentry. The member may only view that an attachment is stored.

## Viewing Attachments

Attachments display on the bottom of the **Issue Details** page for the event that is shown.

<Include name="common-imgs/attachments-access-denied" />

Alternately, attachments also appear in the _Attachments_ tab on the **Issue Details** page, where you can view the _Type_ of attachment, as well as associated events. Click the Event ID to open the **Issue Details** of that specific event.

<Include name="common-imgs/attachments-list-example" />
33 changes: 33 additions & 0 deletions platform-includes/enriching-events/add-attachment/ruby.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
```ruby
Sentry.add_attachment(path: '/path/to/attachment/file.txt')
Sentry.add_attachment(filename: 'payload.json', bytes: '{"value": 42}'))
```

These attachments live on the current `Scope` and will be sent with all events.
You can also add them directly on the scope as follows:

```ruby
Sentry.configure_scope do |scope|
scope.add_attachment(path: '/path/to/attachment/file.txt')
scope.add_attachment(filename: 'payload.json', bytes: '{"value": 42}'))
end
```


An attachment has the following fields:

`path`

The path to the attachment file. The `filename` will be inferred if not explicitly provided when using this mode.

`bytes`

The content of the attachment as bytes.

`filename`

The filename is required if using `bytes` and will be displayed in [sentry.io](https://sentry.io).

`content_type`

The type of content stored in this attachment. Any [MIME type](https://www.iana.org/assignments/media-types/media-types.xhtml) may be used.
Loading