Uploading JavaScript source maps
Automatic JavaScript source maps retrieval does not work for customers who monitor private websites with Instana SaaS, because the source maps for private websites are not publicly accessible. Here, Instana provides a way to upload JavaScript source mapping files for private websites with Instana SaaS.
Prerequisites
- Create an API token with website monitoring configuration permissions enabled. For more information, see the API Tokens documentation.
- Store source maps for Self-Hosted Custom Edition (Kubernetes or Red Hat OpenShift Container Platform) by configuring external storage.
Procedure
Instana provides user interface to create File Upload Configurations, which are used to organize the uploaded JavaScript source map files. In the website's Configuration tab in the Instana UI, click JS Stack Trace Translation, and then click File Download Configurations. Here you can add a configuration.
After you create a new File Upload Configuration, you can use the following Web REST APIs to upload or remove your JavaScript source map files.
Web REST APIs
Starting from release 250, the Web REST APIs for uploading and removing the JavaScript source map file are changed.
-
To upload the JavaScript source map file, run the following command:
curl -L -X PUT \ 'https://$UNIT-$TENANT.instana.io/api/website-monitoring/config/$WEBSITE_ID/sourcemap-upload/$UPLOAD_CONFIG_ID/form' \ -H 'authorization: apiToken $API_TOKEN' \ -F 'url="$JAVASCRIPT_URL"' \ -F 'sourceMap=@"$LOCAL_MAPFILE_LOCATION"'
Notes:
-
This Web REST API does not support upload of multiple source map files. Only the first URL and the first source map file in Rest API CLI are accepted.
-
If the source map file is larger than 10MB, this Web Rest API will report request entity too large error. It's recommended to use compressed source map file, in format of tgz or tar.gz. And specify the parameter -F 'fileFormat="tgz"' in the Web REST API CLI.
-
-
To remove the JavaScript source map file, run the following command:
curl -L -X PUT \ 'https://$UNIT-$TENANT.instana.io/api/website-monitoring/config/$WEBSITE_ID/sourcemap-upload/$UPLOAD_CONFIG_ID/clear' \ -H 'authorization: apiToken $API_TOKEN'
But for release 249, use the following Web REST APIs:
-
To upload the JavaScript source map file:
curl -L -X PUT \ 'https://$UNIT-$TENANT.instana.io/api/website-monitoring/config/$WEBSITE_ID/sourceMapUpload/$UPLOAD_CONFIG_ID/form' \ -H 'authorization: apiToken $API_TOKEN' \ -F 'url="$JAVASCRIPT_URL"' \ -F 'sourceMap=@"$LOCAL_MAPFILE_LOCATION"'
-
To remove the JavaScript source map file:
curl -L -X PUT \ 'https://$UNIT-$TENANT.instana.io/api/website-monitoring/config/$WEBSITE_ID/sourceMapUpload/$UPLOAD_CONFIG_ID/clear' \ -H 'authorization: apiToken $API_TOKEN'