-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(objectstore): Improve host rewriting #103964
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
Dav1dde
left a comment
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.
If I understand that correctly you need to have 2 different URLs to access objectstore. One which is used by Sentry and one Sentry hands out to other services?
Why not just have 2 separate variables/configurations and a central point which hands out the correct URL based on use-case?
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #103964 +/- ##
===========================================
- Coverage 80.62% 80.61% -0.01%
===========================================
Files 9311 9311
Lines 397326 397369 +43
Branches 25338 25338
===========================================
+ Hits 320338 320342 +4
- Misses 76547 76586 +39
Partials 441 441 |
|
@Dav1dde If we were to have other services which we need to pass the URL to, then yes, we would need similar rewriting logic. |
That would mean you'd have to reconfigure Sentry in the symbolicator CI setup, though. |
Yeah in practice we would have to do this with any of these solutions. |
|
What I was proposing was that Possibly I prefer tackling problems at the root, instead of trying to workaround them later. |
|
@Dav1dde I also agree that it's better to tackle problems at the root, in fact I hate the current solution, however I struggle to see an approach that works cleanly and is not error prone here. |
|
@lcian I haven't put too much thought into this, I was thinking of (very pseudo): # Need to bikeshed on the names
session = get_attachments_session(self.project.organization_id, self.project.id, usage='external')
storage_url = session.object_url(report.stored_id)
json: dict[str, Any] = {Internally return _ATTACHMENTS_CLIENT_EXTERNAL if usage == 'external' else _ATTACHMENTS_CLIENT_INTERNAL |
|
We have two dirty problems in general:
We will need something similar in the Sentry endpoints that are supposed to create public pre-signed URLs. Note that these pre-signed URLs don't necessarily are an object URL - they could also be the POST/batch endpoint. I think we should expose functions independent of an instantiated client from objectstore_client that do either:
The signature might be a bit unwieldy, but what I'm thinking of is: # most generic version
format_url(base, usecase, scopes[, path])
# convenience helpers, use `format_url` internally
format_post_url(base, usecase, scopes) # path is empty or "/"
format_object_url(base, usecase, scopes, key) # path is the key |
|
There's another problem: Technically, the hostname under which objectstore is reachable can be different for every service - both in production and in development environments. I think we should embrace this and separate:
|
|
I can confirm that checking |
Thanks for testing. I'm now caching the result so we only run the command once. |
Oh you're right, totally missed that. |
|
@jan-auer I agree that we will need something similar for our proxy. While the problem is similar as it involves URLs, I also think that it's a different one, so I would focus on trying to solve this one for now. @Dav1dde I understand that ideally you would want |
jan-auer
left a comment
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.
Let's move forward with this implementation, provided @loewenheim can confirm they are usually not running their local symbolicators on a different port in addition to the one in devservices.
Please just address the comment by seer, this is valid.
We should follow up on this once we're implementing auth.
That's correct, we either run the one from devservices or disable it and run the local one instead. |
The previous setup with
maybe_rewrite_objectstore_urldidn't work if you were using a local Symbolicator.This happens, for example, in Symbolicator's CI, where both Sentry and Symbolicator are ran locally.
We introduce a new utility to get the URL to an object from Symbolicator's point of view, replacing
maybe_rewrite_objectstore_url.This checks whether a Symbolicator container is detected, therefore it doesn't require any extra env vars/settings from the user.