-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Fixes profiles export source prefix to end in slash #103509
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
Conversation
`google.api_core.exceptions.InvalidArgument: 400 GCS source Path argument must end with '/'`
| transfer_job_name=None, | ||
| source_bucket=source_bucket, | ||
| source_prefix=f"{organization_id}", | ||
| source_prefix=f"{organization_id}/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: export_replay_blob_data creates GCS transfer jobs with source_prefix values missing a trailing slash, violating GCS API requirements.
Severity: CRITICAL | Confidence: 1.00
🔍 Detailed Analysis
The export_replay_blob_data function in src/sentry/replays/data_export.py constructs source_prefix values like "30/1", "60/1", "90/1" without a trailing slash. The Google Cloud Storage Transfer Service API requires source paths to end with a /. This will cause google.api_core.exceptions.InvalidArgument: 400 GCS source Path argument must end with '/' errors when attempting to create transfer jobs, making replay blob exports non-functional.
💡 Suggested Fix
Modify src/sentry/replays/data_export.py to append a trailing slash to source_prefix in export_replay_blob_data, e.g., source_prefix=f"{retention_days}/{project_id}/". Update test_export_replay_blob_data() to assert the correct path format.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: src/sentry/profiles/data_export.py#L47
Potential issue: The `export_replay_blob_data` function in
`src/sentry/replays/data_export.py` constructs `source_prefix` values like `"30/1"`,
`"60/1"`, `"90/1"` without a trailing slash. The Google Cloud Storage Transfer Service
API requires source paths to end with a `/`. This will cause
`google.api_core.exceptions.InvalidArgument: 400 GCS source Path argument must end with
'/'` errors when attempting to create transfer jobs, making replay blob exports
non-functional.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference_id: 2760760
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #103509 +/- ##
===========================================
+ Coverage 78.03% 80.68% +2.65%
===========================================
Files 9245 9247 +2
Lines 394973 394995 +22
Branches 25190 25190
===========================================
+ Hits 308215 318701 +10486
+ Misses 86327 75863 -10464
Partials 431 431 |
google.api_core.exceptions.InvalidArgument: 400 GCS source Path argument must end with '/'