feat(loader): Add endpoint for dynamic SDK loader#44346
Merged
AbhiPrasad merged 3 commits intomasterfrom Feb 10, 2023
Merged
Conversation
markstory
reviewed
Feb 9, 2023
|
|
||
| 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) |
Member
There was a problem hiding this comment.
What does super() do with all these parameters?
Contributor
Author
There was a problem hiding this comment.
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.
lforst
approved these changes
Feb 10, 2023
This was referenced Feb 10, 2023
AbhiPrasad
added a commit
that referenced
this pull request
Feb 16, 2023
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.
wmak
pushed a commit
that referenced
this pull request
Feb 16, 2023
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.
wmak
pushed a commit
that referenced
this pull request
Feb 16, 2023
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.