feat(preprod): Add upload-options endpoint for snapshot uploads#108312
feat(preprod): Add upload-options endpoint for snapshot uploads#108312
Conversation
New project-scoped endpoint that returns all configuration needed by sentry-cli to upload preprod snapshots in a single request, reducing round-trips from multiple API calls to one.
src/sentry/preprod/api/endpoints/project_preprod_upload_options.py
Outdated
Show resolved
Hide resolved
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
src/sentry/preprod/api/endpoints/project_preprod_upload_options.py
Outdated
Show resolved
Hide resolved
|
bugbot run |
|
@sentry review |
|
bugbot run |
|
@sentry review |
src/sentry/preprod/api/endpoints/project_preprod_upload_options.py
Outdated
Show resolved
Hide resolved
| }, | ||
| expirationPolicy=format_expiration( | ||
| TimeToLive(timedelta(days=396)) | ||
| ), # Hardcoded for now |
There was a problem hiding this comment.
Expiration policy inconsistent with server-side preprod TTL
Medium Severity
The expirationPolicy is hardcoded to TimeToLive(timedelta(days=396)) (≈13 months), but _PREPROD_USECASE in src/sentry/objectstore/__init__.py defines the server-side preprod TTL as TimeToLive(timedelta(days=30)). The snapshot endpoint (preprod_artifact_snapshot.py) writes manifests using get_preprod_session() which uses the 30-day TTL. Clients are told their uploads last 396 days, but server-side snapshot manifests expire in 30 days — the manifests would disappear long before the referenced data, creating an inconsistency.
Additional Locations (1)
|
bugbot run |
) Adds a new GET endpoint at `/api/0/projects/{org}/{project}/preprodartifacts/snapshots/upload-options/` that returns objectstore upload configuration to the client. The response is wrapped under an `objectstore` key to act as a discriminator for forward compatibility if the backing storage service changes. It includes: - `url`: the objectstore URL to use (currently the regional proxy URL) - `scopes`: arbitrary key/value pairs (currently org and project as string IDs) - `expirationPolicy`: formatted using objectstore_client's format_expiration utility, currently hardcoded Also introduces a reusable `ObjectstoreUploadOptions` TypedDict in `src/sentry/objectstore/types.py` for other endpoints that will need to return similar upload configuration. --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
) Adds a new GET endpoint at `/api/0/projects/{org}/{project}/preprodartifacts/snapshots/upload-options/` that returns objectstore upload configuration to the client. The response is wrapped under an `objectstore` key to act as a discriminator for forward compatibility if the backing storage service changes. It includes: - `url`: the objectstore URL to use (currently the regional proxy URL) - `scopes`: arbitrary key/value pairs (currently org and project as string IDs) - `expirationPolicy`: formatted using objectstore_client's format_expiration utility, currently hardcoded Also introduces a reusable `ObjectstoreUploadOptions` TypedDict in `src/sentry/objectstore/types.py` for other endpoints that will need to return similar upload configuration. --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>


Adds a new GET endpoint at
/api/0/projects/{org}/{project}/preprodartifacts/snapshots/upload-options/that returns objectstore upload configuration to the client.The response is wrapped under an
objectstorekey to act as a discriminator for forward compatibility if the backing storage service changes. It includes:url: the objectstore URL to use (currently the regional proxy URL)scopes: arbitrary key/value pairs (currently org and project as string IDs)expirationPolicy: formatted using objectstore_client's format_expiration utility, currently hardcodedAlso introduces a reusable
ObjectstoreUploadOptionsTypedDict insrc/sentry/objectstore/types.pyfor other endpoints that will need to return similar upload configuration.