feat(upload): Add metadata support#6028
Conversation
| async fn scoping( | ||
| state: &ServiceState, | ||
| meta: RequestMeta, | ||
| project: Project<'_>, | ||
| ) -> Result<Scoping, BadStoreRequest> { |
There was a problem hiding this comment.
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).
…entry/relay into tobias-wilfert/feat/upload-metadata
| match &self.backend { | ||
| Backend::Upstream { addr } => { | ||
| let (request, rx) = UploadRequest::create(scoping, length); | ||
| let (request, rx) = UploadRequest::create(scoping, length, attachment_type); |
There was a problem hiding this comment.
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.
| Ok(scoping) | ||
| } | ||
|
|
||
| async fn validate_request( |
There was a problem hiding this comment.
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?
This adds support for sending metadata with a post request to the
/uploadendpoint via the Upload-Metadata header (specified by the TUS protocol).For now the only metadata that is supported is
attachment_typewhich 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:
Upload-Metadataheader 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 specifyattachement_type. (We could also force the client to always send aUpload-Metadataheader with a sentry entry but I am not sure there is an upside to that).Ref: INGEST-771