Skip to content

Commit

Permalink
Merge branch 'canary' into firefox-transform-stream
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed Mar 31, 2022
2 parents c53fc7b + 69a166b commit 5b74809
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/build_test_deploy.yml
Expand Up @@ -1202,10 +1202,21 @@ jobs:
name: wasm-dev-binary
path: packages/next-swc/crates/wasm/pkg-nodejs

check-trace-secrests:
runs-on: ubuntu-latest
outputs:
trace-api-key: ${{ steps.trace-api-key.outputs.defined }}
steps:
- id: trace-api-key
env:
TRACE_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
if: "${{ env.TRACE_API_KEY != '' }}"
run: echo "::set-output name=defined::true"
build-performance-metrics:
name: Performance Metrics for Release Build
runs-on: ubuntu-latest
needs: [build, build-native-test]
needs: [build, build-native-test, check-trace-secrests]
if: needs.check-trace-secrests.trace-api-key == 'true'
steps:
- name: Setup node
uses: actions/setup-node@v2
Expand Down Expand Up @@ -1239,16 +1250,16 @@ jobs:
run: |
yarn --cwd bench/nested-deps install
node bench/nested-deps/bench.mjs build
- uses: datadog/agent-github-action@v1
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
api_key: ${{ secrets.DATA_DOG_API_KEY }}

- name: Sending metrics data to Datadog
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
run: |
node scripts/trace-dd.mjs bench/nested-deps/.next/trace build ${GIT_SHORT_SHA} ./bench/nested-deps/next.config.js
env:
DD_TRACE_PARTIAL_FLUSH_MIN_SPANS: 10
DD_ENV: canary
DD_SERVICE: http://localhost:8126
DD_SERVICE: nextjs-dev-build
DD_TRACE_DEBUG: true
1 change: 0 additions & 1 deletion packages/next/build/webpack-config.ts
Expand Up @@ -1573,7 +1573,6 @@ export default async function getBaseWebpackConfig(
webpack5Config.module!.parser = {
javascript: {
url: 'relative',
commonjsMagicComments: true,
},
}
webpack5Config.module!.generator = {
Expand Down
11 changes: 7 additions & 4 deletions packages/next/pages/_document.tsx
Expand Up @@ -85,7 +85,8 @@ function getPreNextWorkerScripts(context: HtmlProps, props: OriginProps) {
try {
let {
partytownSnippet,
} = require(/* webpackIgnore: true */ '@builder.io/partytown/integration'!)
// @ts-ignore: Prevent webpack from processing this require
} = __non_webpack_require__('@builder.io/partytown/integration'!)

const children = Array.isArray(props.children)
? props.children
Expand Down Expand Up @@ -135,9 +136,11 @@ function getPreNextWorkerScripts(context: HtmlProps, props: OriginProps) {
</>
)
} catch (err) {
console.warn(
`Warning: Partytown could not be instantiated in your application due to an error. ${err}`
)
if (isError(err) && err.code !== 'MODULE_NOT_FOUND') {
console.warn(
`Warning: Partytown could not be instantiated in your application due to an error. ${err.message}`
)
}
return null
}
}
Expand Down
9 changes: 8 additions & 1 deletion scripts/trace-dd.mjs
Expand Up @@ -132,7 +132,14 @@ const collectTraces = async (filePath, metadata) => {
* Naively validate, collect necessary args.
*/
const validateArgs = async () => {
const { DD_ENV, DD_SERVICE } = process.env
const { DD_ENV, DD_SERVICE, DATA_DOG_API_KEY } = process.env

if (!DATA_DOG_API_KEY) {
console.log(
"Skipping trace collection, api key is not available. Ensure 'DATA_DOG_API_KEY' env variable is set."
)
return
}

if (!DD_ENV || !DD_SERVICE) {
throw new Error(
Expand Down

0 comments on commit 5b74809

Please sign in to comment.