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

support bundling via esbuild #2763

Merged
merged 10 commits into from
Mar 31, 2023
Merged

support bundling via esbuild #2763

merged 10 commits into from
Mar 31, 2023

Conversation

tlhunter
Copy link
Member

@tlhunter tlhunter commented Feb 2, 2023

What does this PR do?

  • adds experimental support for bundling via esbuild
    • requires Node.js >= v14.17 for now
      • support for older versions will require a diagnostics_channel polyfill
    • only works on the v3 release line
  • currently checking in some phony appsec files
  • includes a CI test that builds a basic app and ensures an Express call is instrumented

Motivation

  • many serverless developers enjoy bundling their projects

Plugin Checklist

@github-actions
Copy link

github-actions bot commented Feb 2, 2023

Overall package size

Self size: 4.01 MB
Deduped: 59.61 MB
No deduping: 59.65 MB

Dependency sizes

name version self size total size
@datadog/native-iast-taint-tracking 1.3.1 13.47 MB 13.47 MB
@datadog/pprof 2.1.0 12.31 MB 13.2 MB
@datadog/native-appsec 2.0.0 12.33 MB 12.34 MB
@datadog/native-metrics 1.5.0 7.1 MB 7.11 MB
protobufjs 7.1.2 2.76 MB 6.55 MB
@datadog/native-iast-rewriter 2.0.1 2.09 MB 2.1 MB
opentracing 0.14.7 194.81 kB 194.81 kB
@datadog/sketches-js 2.1.0 109.9 kB 109.9 kB
lodash.sortby 4.7.0 75.76 kB 75.76 kB
lru-cache 7.14.0 74.95 kB 74.95 kB
semver 5.7.1 61.58 kB 61.58 kB
ipaddr.js 2.0.1 59.52 kB 59.52 kB
ignore 5.2.0 48.87 kB 48.87 kB
import-in-the-middle 1.3.4 32.7 kB 37.17 kB
istanbul-lib-coverage 3.2.0 29.34 kB 29.34 kB
retry 0.10.1 27.44 kB 27.44 kB
lodash.uniq 4.5.0 25.01 kB 25.01 kB
limiter 1.1.5 23.17 kB 23.17 kB
lodash.kebabcase 4.1.1 17.75 kB 17.75 kB
lodash.pick 4.4.0 16.33 kB 16.33 kB
node-abort-controller 3.0.1 14.33 kB 14.33 kB
crypto-randomuuid 1.0.0 11.18 kB 11.18 kB
diagnostics_channel 1.1.0 7.07 kB 7.07 kB
path-to-regexp 0.1.7 6.78 kB 6.78 kB
koalas 1.0.2 6.47 kB 6.47 kB
methods 1.1.2 5.29 kB 5.29 kB
module-details-from-path 1.0.3 4.47 kB 4.47 kB

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@codecov
Copy link

codecov bot commented Feb 2, 2023

Codecov Report

Merging #2763 (b0cc43c) into master (b765f3e) will increase coverage by 0.00%.
The diff coverage is 94.11%.

@@           Coverage Diff           @@
##           master    #2763   +/-   ##
=======================================
  Coverage   87.63%   87.63%           
=======================================
  Files         328      329    +1     
  Lines       11730    11747   +17     
  Branches       33       33           
=======================================
+ Hits        10279    10295   +16     
- Misses       1451     1452    +1     
Impacted Files Coverage Δ
packages/dd-trace/src/dcitm.js 94.11% <94.11%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pr-commenter
Copy link

pr-commenter bot commented Feb 2, 2023

Benchmarks

Comparing candidate commit b0cc43c in PR branch tlhunter/esbuild with baseline commit b765f3e in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 667 metrics, 41 unstable metrics.

@tlhunter tlhunter force-pushed the tlhunter/esbuild branch 9 times, most recently from 33662f0 to e950783 Compare February 24, 2023 00:46
@tlhunter tlhunter force-pushed the tlhunter/esbuild branch 2 times, most recently from 94d2cc1 to 2af8199 Compare February 24, 2023 23:27
@tlhunter tlhunter force-pushed the tlhunter/esbuild branch 6 times, most recently from ef98ae5 to 0d14b2d Compare March 9, 2023 22:18
@tlhunter tlhunter added the dont-land-on-v2.x If a commit depends on a major change not included in v2.x label Mar 9, 2023
@tlhunter tlhunter force-pushed the tlhunter/esbuild branch 5 times, most recently from 3abb731 to d949d6a Compare March 10, 2023 21:59
"license": "ISC",
"dependencies": {
"esbuild": "0.16.12",
"express": "^4.16.2"
Copy link
Member Author

Choose a reason for hiding this comment

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

These two entries are required for the linter to pass, even though they're never installed. Instead, the dev dep packages available in the root of the repo are used.

I could simply delete the package.json file but I kind of like the scripts section as it provides docs of sorts.

Copy link
Member

Choose a reason for hiding this comment

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

I agree, and also it would be good in any case at some point to decouple this from the parent dependencies.

@tianchu
Copy link
Contributor

tianchu commented Mar 27, 2023

@duncanista given that you recently looked into the esbuild problem for serverless deeply, could you help take a look? Maybe it's worth a quick trial as well?

@simon-id
Copy link
Member

Appsec files fix landed: #2913

@tlhunter tlhunter dismissed rochdev’s stale review March 31, 2023 17:43

Will create a PR to corp docs once this is live.

Copy link
Contributor

@Qard Qard left a comment

Choose a reason for hiding this comment

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

LGTM other than the comment about checking hasSubscribers before calling unsubscribe due to the functionally potentially not being there on early versions of diagnostics_channel.

@tlhunter tlhunter merged commit 0c34f6b into master Mar 31, 2023
@tlhunter tlhunter deleted the tlhunter/esbuild branch March 31, 2023 18:37
tlhunter added a commit that referenced this pull request Apr 3, 2023
@tlhunter tlhunter mentioned this pull request Apr 3, 2023
tlhunter added a commit that referenced this pull request Apr 3, 2023
@tlhunter tlhunter mentioned this pull request Apr 3, 2023
@tlhunter tlhunter removed the dont-land-on-v2.x If a commit depends on a major change not included in v2.x label Apr 3, 2023
tlhunter added a commit that referenced this pull request Apr 6, 2023
tlhunter added a commit that referenced this pull request Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants