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

Stablize instrumentation.js #68853

Merged
merged 2 commits into from
Aug 21, 2024
Merged

Stablize instrumentation.js #68853

merged 2 commits into from
Aug 21, 2024

Conversation

huozhi
Copy link
Member

@huozhi huozhi commented Aug 13, 2024

What

  • After adding a new API onRequestError() and a few fixes on register() for instrumentation.js, it's time to promote it as stable API.
  • Add warning "experimental.instrumentationHook is no longer needed to be configured in Next.js" when you configure a instrumentationHook option in next.config.js

Related PRs
#67539, #67671, #67703, #67848, #67859, #67856, #67805, #68616, #68672, #68764, #68845 #68976, #68983

Closes NDX-89

Copy link
Member Author

huozhi commented Aug 13, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @huozhi and the rest of your teammates on Graphite Graphite

@ijjk
Copy link
Member

ijjk commented Aug 13, 2024

Stats from current PR

Default Build (Increase detected ⚠️)
General
vercel/next.js canary vercel/next.js 08-13-stable_instrumentation Change
buildDuration 18.3s 15.7s N/A
buildDurationCached 8.6s 7.4s N/A
nodeModulesSize 356 MB 356 MB N/A
nextStartRea..uration (ms) 425ms 432ms N/A
Client Bundles (main, webpack)
vercel/next.js canary vercel/next.js 08-13-stable_instrumentation Change
1921-HASH.js gzip 37.9 kB 37.9 kB N/A
1995.HASH.js gzip 169 B 169 B
66c22fe9-HASH.js gzip 51.9 kB 51.9 kB N/A
9018-HASH.js gzip 5.19 kB 5.19 kB N/A
framework-HASH.js gzip 56.7 kB 56.7 kB
main-app-HASH.js gzip 225 B 223 B N/A
main-HASH.js gzip 32.5 kB 32.6 kB N/A
webpack-HASH.js gzip 1.71 kB 1.71 kB N/A
Overall change 56.9 kB 56.9 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary vercel/next.js 08-13-stable_instrumentation Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary vercel/next.js 08-13-stable_instrumentation Change
_app-HASH.js gzip 192 B 193 B N/A
_error-HASH.js gzip 193 B 192 B N/A
amp-HASH.js gzip 512 B 510 B N/A
css-HASH.js gzip 342 B 342 B
dynamic-HASH.js gzip 1.84 kB 1.84 kB N/A
edge-ssr-HASH.js gzip 265 B 264 B N/A
head-HASH.js gzip 363 B 364 B N/A
hooks-HASH.js gzip 391 B 392 B N/A
image-HASH.js gzip 4.39 kB 4.4 kB N/A
index-HASH.js gzip 269 B 268 B N/A
link-HASH.js gzip 2.82 kB 2.81 kB N/A
routerDirect..HASH.js gzip 328 B 326 B N/A
script-HASH.js gzip 396 B 396 B
withRouter-HASH.js gzip 325 B 324 B N/A
1afbb74e6ecf..834.css gzip 106 B 106 B
Overall change 844 B 844 B
Client Build Manifests
vercel/next.js canary vercel/next.js 08-13-stable_instrumentation Change
_buildManifest.js gzip 749 B 748 B N/A
Overall change 0 B 0 B
Rendered Page Sizes
vercel/next.js canary vercel/next.js 08-13-stable_instrumentation Change
index.html gzip 522 B 522 B
link.html gzip 535 B 538 B N/A
withRouter.html gzip 519 B 520 B N/A
Overall change 522 B 522 B
Edge SSR bundle Size
vercel/next.js canary vercel/next.js 08-13-stable_instrumentation Change
edge-ssr.js gzip 127 kB 127 kB N/A
page.js gzip 173 kB 173 kB N/A
Overall change 0 B 0 B
Middleware size
vercel/next.js canary vercel/next.js 08-13-stable_instrumentation Change
middleware-b..fest.js gzip 668 B 670 B N/A
middleware-r..fest.js gzip 156 B 155 B N/A
middleware.js gzip 29.7 kB 29.7 kB
edge-runtime..pack.js gzip 844 B 844 B
Overall change 30.5 kB 30.5 kB
Next Runtimes
vercel/next.js canary vercel/next.js 08-13-stable_instrumentation Change
928-experime...dev.js gzip 322 B 322 B
928.runtime.dev.js gzip 314 B 314 B
app-page-exp...dev.js gzip 309 kB 309 kB
app-page-exp..prod.js gzip 122 kB 122 kB
app-page-tur..prod.js gzip 135 kB 135 kB
app-page-tur..prod.js gzip 130 kB 130 kB
app-page.run...dev.js gzip 298 kB 298 kB
app-page.run..prod.js gzip 118 kB 118 kB
app-route-ex...dev.js gzip 30.7 kB 30.7 kB
app-route-ex..prod.js gzip 20.7 kB 20.7 kB
app-route-tu..prod.js gzip 20.7 kB 20.7 kB
app-route-tu..prod.js gzip 20.5 kB 20.5 kB
app-route.ru...dev.js gzip 32.3 kB 32.3 kB
app-route.ru..prod.js gzip 20.5 kB 20.5 kB
pages-api-tu..prod.js gzip 9.62 kB 9.62 kB
pages-api.ru...dev.js gzip 11.5 kB 11.5 kB
pages-api.ru..prod.js gzip 9.61 kB 9.61 kB
pages-turbo...prod.js gzip 21.6 kB 21.6 kB
pages.runtim...dev.js gzip 27.5 kB 27.5 kB
pages.runtim..prod.js gzip 21.6 kB 21.6 kB
server.runti..prod.js gzip 56.8 kB 56.8 kB N/A
Overall change 1.36 MB 1.36 MB
build cache Overall increase ⚠️
vercel/next.js canary vercel/next.js 08-13-stable_instrumentation Change
0.pack gzip 1.49 MB 1.49 MB ⚠️ +2.92 kB
index.pack gzip 128 kB 126 kB N/A
Overall change 1.49 MB 1.49 MB ⚠️ +2.92 kB
Diff details
Diff for page.js

Diff too large to display

Diff for middleware.js

Diff too large to display

Diff for edge-ssr.js

Diff too large to display

Diff for image-HASH.js
@@ -1,7 +1,7 @@
 (self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
   [8358],
   {
-    /***/ 6835: /***/ (
+    /***/ 9606: /***/ (
       __unused_webpack_module,
       __unused_webpack_exports,
       __webpack_require__
@@ -9,7 +9,7 @@
       (window.__NEXT_P = window.__NEXT_P || []).push([
         "/image",
         function () {
-          return __webpack_require__(1274);
+          return __webpack_require__(9670);
         },
       ]);
       if (false) {
@@ -18,7 +18,7 @@
       /***/
     },
 
-    /***/ 9784: /***/ (module, exports, __webpack_require__) => {
+    /***/ 6307: /***/ (module, exports, __webpack_require__) => {
       "use strict";
       /* __next_internal_client_entry_do_not_use__  cjs */
       Object.defineProperty(exports, "__esModule", {
@@ -40,17 +40,17 @@
         __webpack_require__(7864)
       );
       const _head = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(4888)
+        __webpack_require__(4984)
       );
-      const _getimgprops = __webpack_require__(7204);
-      const _imageconfig = __webpack_require__(5319);
-      const _imageconfigcontextsharedruntime = __webpack_require__(3170);
-      const _warnonce = __webpack_require__(7920);
-      const _routercontextsharedruntime = __webpack_require__(7209);
+      const _getimgprops = __webpack_require__(4855);
+      const _imageconfig = __webpack_require__(4609);
+      const _imageconfigcontextsharedruntime = __webpack_require__(3316);
+      const _warnonce = __webpack_require__(2651);
+      const _routercontextsharedruntime = __webpack_require__(4057);
       const _imageloader = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(7443)
+        __webpack_require__(8495)
       );
-      const _usemergedref = __webpack_require__(2531);
+      const _usemergedref = __webpack_require__(7553);
       // This is replaced by webpack define plugin
       const configEnv = {
         deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
@@ -371,7 +371,7 @@
       /***/
     },
 
-    /***/ 2531: /***/ (module, exports, __webpack_require__) => {
+    /***/ 7553: /***/ (module, exports, __webpack_require__) => {
       "use strict";
 
       Object.defineProperty(exports, "__esModule", {
@@ -440,7 +440,7 @@
       /***/
     },
 
-    /***/ 7204: /***/ (
+    /***/ 4855: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -456,9 +456,9 @@
           return getImgProps;
         },
       });
-      const _warnonce = __webpack_require__(7920);
-      const _imageblursvg = __webpack_require__(2200);
-      const _imageconfig = __webpack_require__(5319);
+      const _warnonce = __webpack_require__(2651);
+      const _imageblursvg = __webpack_require__(5067);
+      const _imageconfig = __webpack_require__(4609);
       const VALID_LOADING_VALUES =
         /* unused pure expression or super */ null && [
           "lazy",
@@ -830,7 +830,7 @@
       /***/
     },
 
-    /***/ 2200: /***/ (__unused_webpack_module, exports) => {
+    /***/ 5067: /***/ (__unused_webpack_module, exports) => {
       "use strict";
       /**
        * A shared function, used on both client and server, to generate a SVG blur placeholder.
@@ -885,7 +885,7 @@
       /***/
     },
 
-    /***/ 1356: /***/ (
+    /***/ 3505: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -912,10 +912,10 @@
         },
       });
       const _interop_require_default = __webpack_require__(4345);
-      const _getimgprops = __webpack_require__(7204);
-      const _imagecomponent = __webpack_require__(9784);
+      const _getimgprops = __webpack_require__(4855);
+      const _imagecomponent = __webpack_require__(6307);
       const _imageloader = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(7443)
+        __webpack_require__(8495)
       );
       function getImageProps(imgProps) {
         const { props } = (0, _getimgprops.getImgProps)(imgProps, {
@@ -947,7 +947,7 @@
       /***/
     },
 
-    /***/ 7443: /***/ (__unused_webpack_module, exports) => {
+    /***/ 8495: /***/ (__unused_webpack_module, exports) => {
       "use strict";
 
       Object.defineProperty(exports, "__esModule", {
@@ -982,7 +982,7 @@
       /***/
     },
 
-    /***/ 1274: /***/ (
+    /***/ 9670: /***/ (
       __unused_webpack_module,
       __webpack_exports__,
       __webpack_require__
@@ -999,8 +999,8 @@
 
       // EXTERNAL MODULE: ./node_modules/.pnpm/react@19.0.0-rc-1eaccd82-20240816/node_modules/react/jsx-runtime.js
       var jsx_runtime = __webpack_require__(1822);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-1eaccd82-20240816_re_5yc7ktq4kyrrvzaq2fultvg3y4/node_modules/next/image.js
-      var next_image = __webpack_require__(7091);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-1eaccd82-20240816_re_kxzj53dvrxjpf46fi64kfjrpy4/node_modules/next/image.js
+      var next_image = __webpack_require__(142);
       var image_default = /*#__PURE__*/ __webpack_require__.n(next_image); // CONCATENATED MODULE: ./pages/nextjs.png
       /* harmony default export */ const nextjs = {
         src: "/_next/static/media/nextjs.cae0b805.png",
@@ -1030,12 +1030,12 @@
       /***/
     },
 
-    /***/ 7091: /***/ (
+    /***/ 142: /***/ (
       module,
       __unused_webpack_exports,
       __webpack_require__
     ) => {
-      module.exports = __webpack_require__(1356);
+      module.exports = __webpack_require__(3505);
 
       /***/
     },
@@ -1045,7 +1045,7 @@
     /******/ var __webpack_exec__ = (moduleId) =>
       __webpack_require__((__webpack_require__.s = moduleId));
     /******/ __webpack_require__.O(0, [2888, 9774, 179], () =>
-      __webpack_exec__(6835)
+      __webpack_exec__(9606)
     );
     /******/ var __webpack_exports__ = __webpack_require__.O();
     /******/ _N_E = __webpack_exports__;
Diff for 9018-HASH.js
@@ -1,8 +1,8 @@
 "use strict";
 (self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
-  [9018],
+  [9149],
   {
-    /***/ 9018: /***/ (module, exports, __webpack_require__) => {
+    /***/ 9149: /***/ (module, exports, __webpack_require__) => {
       /* __next_internal_client_entry_do_not_use__  cjs */
       Object.defineProperty(exports, "__esModule", {
         value: true,
@@ -13,27 +13,27 @@
           return Image;
         },
       });
-      const _interop_require_default = __webpack_require__(9384);
-      const _interop_require_wildcard = __webpack_require__(9913);
-      const _jsxruntime = __webpack_require__(9113);
+      const _interop_require_default = __webpack_require__(8232);
+      const _interop_require_wildcard = __webpack_require__(5339);
+      const _jsxruntime = __webpack_require__(5335);
       const _react = /*#__PURE__*/ _interop_require_wildcard._(
-        __webpack_require__(6193)
+        __webpack_require__(9960)
       );
       const _reactdom = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(2527)
+        __webpack_require__(7851)
       );
       const _head = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(5723)
+        __webpack_require__(5358)
       );
-      const _getimgprops = __webpack_require__(7428);
-      const _imageconfig = __webpack_require__(4011);
-      const _imageconfigcontextsharedruntime = __webpack_require__(7352);
-      const _warnonce = __webpack_require__(1970);
-      const _routercontextsharedruntime = __webpack_require__(1015);
+      const _getimgprops = __webpack_require__(8934);
+      const _imageconfig = __webpack_require__(4021);
+      const _imageconfigcontextsharedruntime = __webpack_require__(614);
+      const _warnonce = __webpack_require__(6748);
+      const _routercontextsharedruntime = __webpack_require__(1013);
       const _imageloader = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(22)
+        __webpack_require__(3003)
       );
-      const _usemergedref = __webpack_require__(3501);
+      const _usemergedref = __webpack_require__(9648);
       // This is replaced by webpack define plugin
       const configEnv = {
         deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
@@ -355,7 +355,7 @@
       /***/
     },
 
-    /***/ 3501: /***/ (module, exports, __webpack_require__) => {
+    /***/ 9648: /***/ (module, exports, __webpack_require__) => {
       Object.defineProperty(exports, "__esModule", {
         value: true,
       });
@@ -375,7 +375,7 @@
           return useMergedRef;
         },
       });
-      const _react = __webpack_require__(6193);
+      const _react = __webpack_require__(9960);
       function useMergedRef(refA, refB) {
         return (0, _react.useMemo)(() => mergeRefs(refA, refB), [refA, refB]);
       }
@@ -422,11 +422,7 @@
       /***/
     },
 
-    /***/ 4783: /***/ (
-      __unused_webpack_module,
-      exports,
-      __webpack_require__
-    ) => {
+    /***/ 31: /***/ (__unused_webpack_module, exports, __webpack_require__) => {
       Object.defineProperty(exports, "__esModule", {
         value: true,
       });
@@ -436,9 +432,9 @@
           return AmpStateContext;
         },
       });
-      const _interop_require_default = __webpack_require__(9384);
+      const _interop_require_default = __webpack_require__(8232);
       const _react = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(6193)
+        __webpack_require__(9960)
       );
       const AmpStateContext = _react.default.createContext({});
       if (false) {
@@ -447,7 +443,7 @@
       /***/
     },
 
-    /***/ 4122: /***/ (__unused_webpack_module, exports) => {
+    /***/ 3208: /***/ (__unused_webpack_module, exports) => {
       Object.defineProperty(exports, "__esModule", {
         value: true,
       });
@@ -469,7 +465,7 @@
       /***/
     },
 
-    /***/ 7428: /***/ (
+    /***/ 8934: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -483,9 +479,9 @@
           return getImgProps;
         },
       });
-      const _warnonce = __webpack_require__(1970);
-      const _imageblursvg = __webpack_require__(7992);
-      const _imageconfig = __webpack_require__(4011);
+      const _warnonce = __webpack_require__(6748);
+      const _imageblursvg = __webpack_require__(9736);
+      const _imageconfig = __webpack_require__(4021);
       const VALID_LOADING_VALUES =
         /* unused pure expression or super */ null && [
           "lazy",
@@ -857,7 +853,7 @@
       /***/
     },
 
-    /***/ 5723: /***/ (module, exports, __webpack_require__) => {
+    /***/ 5358: /***/ (module, exports, __webpack_require__) => {
       /* __next_internal_client_entry_do_not_use__  cjs */
       Object.defineProperty(exports, "__esModule", {
         value: true,
@@ -878,19 +874,19 @@
           return defaultHead;
         },
       });
-      const _interop_require_default = __webpack_require__(9384);
-      const _interop_require_wildcard = __webpack_require__(9913);
-      const _jsxruntime = __webpack_require__(9113);
+      const _interop_require_default = __webpack_require__(8232);
+      const _interop_require_wildcard = __webpack_require__(5339);
+      const _jsxruntime = __webpack_require__(5335);
       const _react = /*#__PURE__*/ _interop_require_wildcard._(
-        __webpack_require__(6193)
+        __webpack_require__(9960)
       );
       const _sideeffect = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(2907)
+        __webpack_require__(114)
       );
-      const _ampcontextsharedruntime = __webpack_require__(4783);
-      const _headmanagercontextsharedruntime = __webpack_require__(1854);
-      const _ampmode = __webpack_require__(4122);
-      const _warnonce = __webpack_require__(1970);
+      const _ampcontextsharedruntime = __webpack_require__(31);
+      const _headmanagercontextsharedruntime = __webpack_require__(866);
+      const _ampmode = __webpack_require__(3208);
+      const _warnonce = __webpack_require__(6748);
       function defaultHead(inAmpMode) {
         if (inAmpMode === void 0) inAmpMode = false;
         const head = [
@@ -1074,7 +1070,7 @@
       /***/
     },
 
-    /***/ 7992: /***/ (__unused_webpack_module, exports) => {
+    /***/ 9736: /***/ (__unused_webpack_module, exports) => {
       /**
        * A shared function, used on both client and server, to generate a SVG blur placeholder.
        */
@@ -1128,7 +1124,7 @@
       /***/
     },
 
-    /***/ 7352: /***/ (
+    /***/ 614: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -1142,11 +1138,11 @@
           return ImageConfigContext;
         },
       });
-      const _interop_require_default = __webpack_require__(9384);
+      const _interop_require_default = __webpack_require__(8232);
       const _react = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(6193)
+        __webpack_require__(9960)
       );
-      const _imageconfig = __webpack_require__(4011);
+      const _imageconfig = __webpack_require__(4021);
       const ImageConfigContext = _react.default.createContext(
         _imageconfig.imageConfigDefault
       );
@@ -1156,7 +1152,7 @@
       /***/
     },
 
-    /***/ 4011: /***/ (__unused_webpack_module, exports) => {
+    /***/ 4021: /***/ (__unused_webpack_module, exports) => {
       Object.defineProperty(exports, "__esModule", {
         value: true,
       });
@@ -1203,7 +1199,7 @@
       /***/
     },
 
-    /***/ 22: /***/ (__unused_webpack_module, exports) => {
+    /***/ 3003: /***/ (__unused_webpack_module, exports) => {
       Object.defineProperty(exports, "__esModule", {
         value: true,
       });
@@ -1236,7 +1232,7 @@
       /***/
     },
 
-    /***/ 1015: /***/ (
+    /***/ 1013: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -1250,9 +1246,9 @@
           return RouterContext;
         },
       });
-      const _interop_require_default = __webpack_require__(9384);
+      const _interop_require_default = __webpack_require__(8232);
       const _react = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(6193)
+        __webpack_require__(9960)
       );
       const RouterContext = _react.default.createContext(null);
       if (false) {
@@ -1261,7 +1257,7 @@
       /***/
     },
 
-    /***/ 2907: /***/ (
+    /***/ 114: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -1275,7 +1271,7 @@
           return SideEffect;
         },
       });
-      const _react = __webpack_require__(6193);
+      const _react = __webpack_require__(9960);
       const isServer = typeof window === "undefined";
       const useClientOnlyLayoutEffect = isServer
         ? () => {}
Diff for server.runtime.prod.js

Diff too large to display

Commit: 7f3769d

Base automatically changed from 08-09-isr_reason to canary August 14, 2024 19:44
An error occurred while trying to automatically change base from 08-09-isr_reason to canary August 14, 2024 19:44
@huozhi huozhi force-pushed the 08-13-stable_instrumentation branch from 5859263 to 4886373 Compare August 14, 2024 20:06
@huozhi huozhi changed the title remove instrumentation exp flag Stablize instrumentation.js Aug 14, 2024
@huozhi huozhi force-pushed the 08-13-stable_instrumentation branch from a36cb97 to 5c761be Compare August 19, 2024 17:46
@ijjk
Copy link
Member

ijjk commented Aug 19, 2024

Tests Passed

@huozhi huozhi force-pushed the 08-13-stable_instrumentation branch from fa94ad7 to 7f3769d Compare August 20, 2024 08:48
@huozhi huozhi marked this pull request as ready for review August 20, 2024 11:07
Copy link

vercel bot commented Aug 20, 2024

Notifying the following users due to files changed in this PR based on this repo's notify modifiers:

@timneutkens, @ijjk, @shuding:

packages/next/src/server/config.ts

lforst added a commit to getsentry/sentry-javascript that referenced this pull request Sep 4, 2024
The logic in this PR is slightly intense but all it does is check for
the Next.js version and if we are on a version that included [this
change](vercel/next.js#68853) which stabilized
`instrumentation.ts` we no longer inject the
`experimental.instrumentationHook` option in `next.config.js`.

This is necessary because otherwise Next.js prints scary warnings and
users may be confused why.
@github-actions github-actions bot added the locked label Sep 5, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants