Skip to content

feat(upload): Add metadata support#6028

Merged
tobias-wilfert merged 14 commits into
masterfrom
tobias-wilfert/feat/upload-metadata
Jun 3, 2026
Merged

feat(upload): Add metadata support#6028
tobias-wilfert merged 14 commits into
masterfrom
tobias-wilfert/feat/upload-metadata

Conversation

@tobias-wilfert
Copy link
Copy Markdown
Member

@tobias-wilfert tobias-wilfert commented May 29, 2026

This adds support for sending metadata with a post request to the /upload endpoint via the Upload-Metadata header (specified by the TUS protocol).
For now the only metadata that is supported is attachment_type which is needed so that the endpoint can do the correct preliminary quota check. Specifically this solves the issue where a minidump send to the endpoint would be rejected if there was no more attachment quota.

Current design:

  • Sending no Upload-Metadata header is allowed, as is sending one that does not contain a sentry entry. If however one is send with a sentry entry it needs to specify attachement_type. (We could also force the client to always send a Upload-Metadata header with a sentry entry but I am not sure there is an upside to that).

Ref: INGEST-771

@tobias-wilfert tobias-wilfert self-assigned this May 29, 2026
Comment thread relay-server/src/endpoints/upload.rs Outdated
Comment on lines +357 to +361
async fn scoping(
state: &ServiceState,
meta: RequestMeta,
project: Project<'_>,
) -> Result<Scoping, BadStoreRequest> {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Potentially controversial: Since we don't have the attachment_type when handling the patch we do a dummer check now. If we wanted the same check as we currently already do during the post we would need to also encode the type into the Location returned by the post. (Since this is a preliminary check I decided against that for now, but maybe we want this).

Comment thread relay-server/src/services/upload.rs Outdated
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 29, 2026

INGEST-771

Comment thread relay-server/src/endpoints/upload.rs Outdated
Comment thread relay-server/src/services/upload.rs Outdated
Comment thread relay-server/src/utils/tus.rs Outdated
Comment thread relay-server/src/utils/tus.rs Outdated
Comment thread relay-server/src/utils/tus.rs Outdated
Comment thread relay-server/src/utils/tus.rs
Comment thread tests/integration/test_minidump.py
Comment thread tests/integration/test_upload.py Outdated
@tobias-wilfert tobias-wilfert changed the title WIP: feat(upload): Add metadata support feat(upload): Add metadata support Jun 3, 2026
@tobias-wilfert tobias-wilfert marked this pull request as ready for review June 3, 2026 13:24
@tobias-wilfert tobias-wilfert requested a review from a team as a code owner June 3, 2026 13:24
@tobias-wilfert tobias-wilfert requested a review from jjbayer June 3, 2026 13:25
…entry/relay into tobias-wilfert/feat/upload-metadata
@tobias-wilfert tobias-wilfert enabled auto-merge June 3, 2026 13:40
Comment thread relay-server/src/utils/tus.rs
Comment thread relay-server/src/endpoints/upload.rs Outdated
match &self.backend {
Backend::Upstream { addr } => {
let (request, rx) = UploadRequest::create(scoping, length);
let (request, rx) = UploadRequest::create(scoping, length, attachment_type);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not directly related to this PR, but here we are destructuring the Create parameter in the function signature only to pass the parts individually to UploadRequest::create. Instead, we could use Create as the parameter for that function as well.

@tobias-wilfert tobias-wilfert disabled auto-merge June 3, 2026 13:56
Comment thread relay-server/src/endpoints/upload.rs
Comment thread relay-server/src/utils/tus.rs
Comment thread relay-server/src/endpoints/upload.rs Outdated
Ok(scoping)
}

async fn validate_request(
Copy link
Copy Markdown
Member

@elramen elramen Jun 3, 2026

Choose a reason for hiding this comment

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

I think it would be good to add some documentation that explains the difference between validate_request and check_request.

Or could we merge them into one function with a parameter that decides whether we check quota?

@tobias-wilfert tobias-wilfert enabled auto-merge June 3, 2026 14:30
@tobias-wilfert tobias-wilfert added this pull request to the merge queue Jun 3, 2026
Merged via the queue into master with commit eef57e9 Jun 3, 2026
33 checks passed
@tobias-wilfert tobias-wilfert deleted the tobias-wilfert/feat/upload-metadata branch June 3, 2026 15:10
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