-
Notifications
You must be signed in to change notification settings - Fork 6
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
[plugin] RUM plugin #78
Conversation
de6d30d
to
64d26cf
Compare
b477374
to
795c522
Compare
3951241
to
d581174
Compare
5bfc8c0
to
c5e6849
Compare
d581174
to
e824eef
Compare
// Using form-data as a dependency isn't really required. | ||
// But this implementation makes it mandatory for the gzip step. | ||
// NodeJS' fetch SHOULD support everything else from the native FormData primitive. | ||
// content.options are totally optional and should only be filename. | ||
// form.getHeaders() is natively handled by fetch and FormData. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is a toughy, so any help will be appreciated.
Not blocking, but would be great to remove this dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I have a few comments/suggestions but otherwise it looks good
@@ -6,3 +6,7 @@ | |||
# Telemetry | |||
packages/plugins/telemetry @DataDog/frontend-devx @yoannmoinet | |||
packages/tests/src/plugins/telemetry @DataDog/frontend-devx @yoannmoinet | |||
|
|||
# Rum | |||
packages/plugins/rum @DataDog/rum @yoannmoinet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably fix these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we have a good team to add for RUM?
This one seemed a bit too wide maybe.
export const helpers = { | ||
// Add the helpers you'd like to expose here. | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove this? It seems like it's not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, I was just thinking of this, I think right now we can't remove it, as the publish script expect all the plugins to have this.
But I'll submit a separate PR to make this optional, and only use the ones that are existing.
// Always using the posix version to avoid \ on Windows. | ||
const newPath = path.posix.normalize(basePath); | ||
return path.join(newPath, '**/*.@(js|mjs).map'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Should the pattern be configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed datadog-ci
's implementation, where this is not configurable.
I prefer to cross that bridge when we get there for simplicity's sake.
|
||
export const getApiUrl = (context: GlobalContext) => { | ||
const siteUrl = context.auth?.endPoint || 'datadoghq.com'; | ||
return `https://sourcemap-intake.${siteUrl}/api/v2/srcmap`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: We could also make this pattern configurable if there's any chance it could change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as prior, followed datadog-ci
's implementation, where it's not configurable (yet).
I do see where it could be valuable to make it configurable, but I prefer to cross this bridge when we get there.
For the sake of simplicity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ps: I'll add support for env vars in a separate PR as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 this may be actually needed before we release this plugin after all, given that datadog-ci
's offers the DATADOG_SOURCEMAP_INTAKE_URL
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added it in the last commit 19e3862
[testing] Refactor testing telemetry
[core] More global contexts
[rum] Use context for sourcemaps instead of `basePath`.
Note
Stacked on #82
What and why?
Adding a new customer facing plugin to let them upload sourcemaps at the end of a build.
I followed
datadog-ci
's implementation but re-wrote it entirely to make it leverage native primitives (likefetch
). And straightened its helpers.I could have imported
datadog-ci
directly, but this was bringing A TON of unnecessary dependencies, so I decided to re-wrote it.Note
This also slightly changes how the git internal plugin works. It will only enable it if the
sourcemaps
plugin is enabled.How?
This is a sub-plugin of the higher order
rum
plugin.Added some configuration validation, as well as a lot of tests for the added functionality.
I've also split out the git internal plugin in #82 so we keep this one more digest to review.
The implementation is pretty straight-forward:
In the future I'd like to:
basePath
from the bundler's config.form-data
to use the native one instead.Finally, I tested the upload and it seemed to work as expected.