Skip to content
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

feat: upload source maps to Datadog during MFE deploy #3

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

adamstankiewicz
Copy link
Member

@adamstankiewicz adamstankiewicz commented May 31, 2024

Related PR: https://github.com/edx/edx-internal/pull/10993

https://docs.datadoghq.com/real_user_monitoring/guide/upload-javascript-source-maps/

Without source maps uploaded to Datadog for MFEs, any reported JS errors are largely not actionable as engineers cannot discern which specific area of code caused the exception due to minified production JS code.

Example from Datadog docs:

Without source maps

JS error without any clues to to which code area/path triggered the error:

image

With source maps

Human-readable unminified source code of the exact line of JS code that triggered the error, including a direct link to source code on GitHub:

image

@adamstankiewicz adamstankiewicz force-pushed the ags/datadog-sourcemaps branch 2 times, most recently from 3e2f22e to b407224 Compare June 6, 2024 16:57
def _upload_js_sourcemaps(self, app_path):
""" Upload JavaScript sourcemaps to Datadog. """
app_config = self.get_app_config()
api_key = app_config.get('DATADOG_API_KEY')
Copy link
Member Author

@adamstankiewicz adamstankiewicz Jun 6, 2024

Choose a reason for hiding this comment

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

[inform/context]

# Can't upload source maps without ``DATADOG_API_KEY``, which must be set as an environment variable
# before executing the Datadog CLI. The Datadog documentation suggests using a dedicated Datadog API key:
# https://docs.datadoghq.com/real_user_monitoring/guide/upload-javascript-source-maps/

It looks like DATADOG_API_KEY exists in edx-internal as an ansible secret (e.g., here), but I'm not too sure whether this is accessible by the frontend configs used in frontend_utils.py.

As is, I'm attempting to extract DATADOG_API_KEY from the MFE APP_CONFIG. Assumes DATADOG_API_KEY is defined under the common frontend config (e.g., here, shared across all MFEs.

Comment on lines +25 to +28
@click.option(
'--common-config-file',
help='File from which common configuration variables are read.',
)
Copy link
Member Author

@adamstankiewicz adamstankiewicz Jun 6, 2024

Choose a reason for hiding this comment

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

[inform/context] The frontend_deploy.py script now requires supplying the --common-config-file when it's executed to provide the path to the common frontend config (source).

The related edx-internal PR accounts for this and would be merged first.

@adamstankiewicz adamstankiewicz force-pushed the ags/datadog-sourcemaps branch from 22b38e4 to eb9e6ed Compare June 7, 2024 12:59
@adamstankiewicz adamstankiewicz marked this pull request as ready for review June 7, 2024 13:11
@adamstankiewicz adamstankiewicz merged commit a2f22eb into master Jun 11, 2024
4 checks passed
@adamstankiewicz adamstankiewicz deleted the ags/datadog-sourcemaps branch June 11, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants