Skip to content

Conversation

@AbhiPrasad
Copy link
Member

ref: #44225

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.

@AbhiPrasad AbhiPrasad requested review from HazAT and lforst February 9, 2023 14:23
@AbhiPrasad AbhiPrasad requested a review from a team as a code owner February 9, 2023 14:23
@AbhiPrasad AbhiPrasad self-assigned this Feb 9, 2023
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label 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)
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove.

@AbhiPrasad AbhiPrasad merged commit b632214 into master Feb 10, 2023
@AbhiPrasad AbhiPrasad deleted the abhi-sdk-dynamic-loader-endpoint branch February 10, 2023 15:22
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.
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants