Skip to content

Conversation

@jjbayer
Copy link
Member

@jjbayer jjbayer commented Nov 28, 2025

Upload attachment V2 bodies to objectstore and write a trace item to EAP.

Closes INGEST-614.

Base automatically changed from tobias-wilfert/feat/span-attachment to master December 1, 2025 12:57
@linear
Copy link

linear bot commented Dec 2, 2025

@@ -1,5 +1,6 @@
use std::collections::BTreeMap;

use itertools::Either;
Copy link
Member Author

Choose a reason for hiding this comment

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

Either seems to get imported from a couple of different crates, not sure if this is the canonical one.

project_id: ctx.scoping.project_id.value(),
trace_id: trace_id.into_value()?.to_string(),
item_id: attachment_id.into_value()?.into_bytes().to_vec(),
item_type: 10, // FIXME: use enum from sentry-protos
Copy link
Member Author

Choose a reason for hiding this comment

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

Depends on getsentry/sentry-protos#156. Do not merge until it's published.

Copy link
Member Author

Choose a reason for hiding this comment

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

@jjbayer jjbayer changed the title Feat/upload attachment v2 feat(spans): Store span attachments Dec 2, 2025
@jjbayer jjbayer marked this pull request as ready for review December 2, 2025 15:27
@jjbayer jjbayer requested a review from a team as a code owner December 2, 2025 15:27
@jjbayer jjbayer force-pushed the feat/upload-attachment-v2 branch from feccbe5 to 02e2506 Compare December 3, 2025 11:43
categories=None,
quantity=None,
timeout=1,
timeout=None,
Copy link
Member Author

Choose a reason for hiding this comment

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

Drive-by: assert_rate_limited did not use a shorter timeout than the default one so was prone to flake.

span_id: Option<SpanId>,
}

// TODO: remove code-duplication between logs, trace metrics and attachments.
Copy link
Member

Choose a reason for hiding this comment

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

That's on my todo as well 😢

} = fields;

result.insert(
"sentry.content-type".to_owned(),
Copy link
Member

Choose a reason for hiding this comment

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

Wonder if it's better to have another namespace for these attributes sentry.attachment.content-type, but maybe just having an EAP item 'attachment' is namespace enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

Personally l like the un-prefixed version, but I have no strong opinions on this.

}

impl<L: Counted, R: Counted> Managed<Either<L, R>> {
/// Turns a managed option into an optional [`Managed`].
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment still refers to Option.


let objectstore_client = Client::builder(objectstore_url).build()?;
let attachments_usecase = Usecase::new("attachments")
let event_attachments = Usecase::new("attachments")
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this can be changed at this point, but might be clearer to call this "event_attachments"?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is code in the sentry monolith that expects "attachments", so I'm afraid we need to keep it: https://github.com/getsentry/sentry/blob/70575b5ffb0266231d0dc48445c70bf285770800/src/sentry/objectstore/__init__.py#L41

@jjbayer jjbayer added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@jjbayer jjbayer added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@jjbayer jjbayer enabled auto-merge December 4, 2025 13:37
@jjbayer jjbayer added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Dec 4, 2025
Comment on lines 167 to 175
match message {
Upload::Envelope(envelope) => {
// Event attachments can still go the old route.
self.inner.store.send(envelope);
}
Upload::Attachment(managed) => {
let _ = managed.reject_err(Error::LoadShed);
}
}

This comment was marked as outdated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes but this is deliberate (for now).

@jjbayer jjbayer enabled auto-merge December 5, 2025 06:48
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.

4 participants