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: Added AddAttachment to the Hint #2585

Merged
merged 5 commits into from Aug 31, 2023
Merged

Conversation

bitsandfoxes
Copy link
Contributor

Resolves: #2549

Taken from the API we have on the scope to add an attachment. So instead of

options.SetBeforeSend((@event, hint) =>
{
    hint.Attachments.Add(new Attachment(
        AttachmentType.Default,
        new FileAttachmentContent("<filepath>", true),
        Path.GetFileName("<filepath>"),
        null));
    return @event;
});

we can do

options.SetBeforeSend((@event, hint) =>
{
    hint.AddAttachment("<filepath>");
    return @event;
});

@github-actions
Copy link
Contributor

github-actions bot commented Aug 29, 2023

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 89d49a0

@jamescrosswell
Copy link
Collaborator

@bitsandfoxes do hints get sent to Sentry? I thought they were just there for context prior to capturing an event (so useful in the BeforeSend callback but not afterwards)...

@bitsandfoxes
Copy link
Contributor Author

@bitsandfoxes do hints get sent to Sentry? I thought they were just there for context prior to capturing an event (so useful in the BeforeSend callback but not afterwards)...

Yes they do. Hints have a bit of a mixed responsibility but the attachment part is supposed to be the answer to "how do I add attachments in the BeforeSend callback?".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we have good basic tests to ensure attachments can be added to the Hints.

Maybe worth adding a test to the Hub to ensure Hint.Attachments make their way through to Sentry when capturing an event?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks for the callout!

@bitsandfoxes bitsandfoxes merged commit e8f5b10 into main Aug 31, 2023
15 checks passed
@bitsandfoxes bitsandfoxes deleted the feat/add-attachment branch August 31, 2023 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to add attachments to events with User Feedback in BeforeSend or SetBeforeSend in v3.35.1
2 participants