-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(loader): Add endpoint for dynamic SDK loader #44346
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
|
|
||
| def get(self, request: Request, public_key: str, minified: str) -> Response: | ||
| """Returns a JS file that dynamically loads the SDK based on project settings""" | ||
| return super().get(request, public_key, minified) |
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.
What does super() do with all these parameters?
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.
Good point - nothing for now. This was just a no-op implementation that is going away very soon right after we add the appropriate project settings.
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.
I can remove.
ref #44225 Building on the work from #44346, this PR adds `dynamicSdkLoaderOptions`, a dictionary of options for the new dynamic SDK loader. The `dynamicSdkLoaderOptions` live on the data `JSONField` on the `ProjectKey` model, as the there is a dynamic loader unique to each DSN. `dynamicSdkLoaderOptions` is also a dictionary, for ease of use, with 3 keys: 1. `hasReplay`: If the loader should include the replay sdk in the bundle 2. `hasPerformance`: If the loader should include the tracing sdk in the bundle 3. `hasDebug`: If the loader should load the debug bundle In the future we could migrate this onto the model directly (as a `BitField` or something), but for now for iteration speed and fluid schema, adding it as a JSON is good enough. To validate we are using the correct fields, `dynamicSdkLoaderOptions` is validated in the `ProjectKeySerializer` via a custom serializer. These new options are used by the `_get_bundle_kind_modifier` method in the `JavaScriptSdkDynamicLoader` view, but for now are not used since the templates are not added (we render a no-op template instead). In the next PR we will add templates for the loader view, alongside tests to validate this all together.
In this PR we add a new `JavaScriptSdkDynamicLoader` view that will render the new dynamic js sdk loader as a template. This view does nothing atm, but adding functionality will be the next step. Currently this is not gated by the feature flag introduced with #44228, but will be as soon as it has complicated logic. As a next step, we need to introduce a `JS_SDK_DYNAMIC_LOADER_SDK_VERSION` config value, and then move to adding project dsn settings for the dynamic loader.
ref #44225 Building on the work from #44346, this PR adds `dynamicSdkLoaderOptions`, a dictionary of options for the new dynamic SDK loader. The `dynamicSdkLoaderOptions` live on the data `JSONField` on the `ProjectKey` model, as the there is a dynamic loader unique to each DSN. `dynamicSdkLoaderOptions` is also a dictionary, for ease of use, with 3 keys: 1. `hasReplay`: If the loader should include the replay sdk in the bundle 2. `hasPerformance`: If the loader should include the tracing sdk in the bundle 3. `hasDebug`: If the loader should load the debug bundle In the future we could migrate this onto the model directly (as a `BitField` or something), but for now for iteration speed and fluid schema, adding it as a JSON is good enough. To validate we are using the correct fields, `dynamicSdkLoaderOptions` is validated in the `ProjectKeySerializer` via a custom serializer. These new options are used by the `_get_bundle_kind_modifier` method in the `JavaScriptSdkDynamicLoader` view, but for now are not used since the templates are not added (we render a no-op template instead). In the next PR we will add templates for the loader view, alongside tests to validate this all together.
ref: #44225
In this PR we add a new
JavaScriptSdkDynamicLoaderview that will render the new dynamic js sdk loader as a template. This view does nothing atm, but adding functionality will be the next step. Currently this is not gated by the feature flag introduced with #44228, but will be as soon as it has complicated logic.As a next step, we need to introduce a
JS_SDK_DYNAMIC_LOADER_SDK_VERSIONconfig value, and then move to adding project dsn settings for the dynamic loader.