sentry-kubernetes / charts

Easily deploy Sentry on your Kubernetes Cluster
MIT License
1.08k stars 513 forks source link

Add support for lazy loader on self hosted #1560

Open sdernbach-ionos opened 4 days ago

sdernbach-ionos commented 4 days ago

Hi,

officially Sentry supports a loader script that handles which parts are needed which is better from performance perspective. This does not work on self-hosted but a user suggested a solution here: https://github.com/getsentry/sentry/issues/22715#issuecomment-2275108592

I guess we could implement a Job that is doing that as post-install hook by either reading the version from the web container or using the online url for the same JSON file: https://release-registry.services.sentry.io/sdks/sentry.javascript.browser/versions

The problem is more I'm not sure if we need a storage as if we just put it to the nginx /var/www/js-sdk folder I guess it is lost as soon as the pod gets recreated, right?

@patsevanton any opinions or ideas about that?

Thanks, Sebastian

patsevanton commented 4 days ago

@sdernbach-ionos Hi! What exactly are the JS files that need to be downloaded and put into the nginx pod? I'm reading, but I don't yet understand what JS files need to be downloaded.

sdernbach-ionos commented 4 days ago

@patsevanton the JS files are basically like the modules of the Sentry JS SDK. A loader script is dynamically build based on the project settings which minimizes the filesize which improves the performance when including Sentry in web applications.

You can read more about the Sentry loader here: https://docs.sentry.io/platforms/javascript/install/loader/

patsevanton commented 4 days ago

I dowloaded by wget https://browser.sentry-cdn.com/8.34.0/browserprofiling.debug.min.js but

sha384sum browserprofiling.debug.min.js 
fee7f6ef2d3f5c0b79f16c2b2f01399c59459d77950addd9c4982acf206f03458da4bc5bf2834067b28d454c4db79fd7  browserprofiling.debug.min.js

It doesn't match with

sha384-/uf27y0/XAt58WwrLwE5nFlFnXeVCt3ZxJgqzyBvA0WNpLxb8oNAZ7KNRUxNt5/X
sdernbach-ionos commented 4 days ago

@patsevanton they use base64 with the hash, I used this and then I get the same as they have in the JSON file:

curl -s https://browser.sentry-cdn.com/8.34.0/browserprofiling.debug.min.js | openssl dgst -sha384 -binary |  openssl enc -base64