Skip to content

Commit a163ee8

Browse files
authored
chore: Merge next branch (#2412)
2 parents 41c1cc6 + aef69e2 commit a163ee8

File tree

162 files changed

+3571
-6872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+3571
-6872
lines changed

.eslintrc.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ module.exports = {
3434
parserOptions: {
3535
ecmaVersion: 2022
3636
},
37-
ignorePatterns: ['test/versioned-external'],
37+
ignorePatterns: [
38+
'test/versioned-external',
39+
'test/versioned/nextjs/app',
40+
'test/versioned/nextjs/app-dir'
41+
],
3842
overrides: [
3943
{
4044
files: ['**/*.mjs'],

.github/workflows/benchmark-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
node-version: [16.x, 18.x, 20.x, 22.x]
19+
node-version: [18.x, 20.x, 22.x]
2020

2121
steps:
2222
- uses: actions/checkout@v4

.github/workflows/ci-workflow.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
strategy:
9999
fail-fast: false
100100
matrix:
101-
node-version: [16.x, 18.x, 20.x, 22.x]
101+
node-version: [18.x, 20.x, 22.x]
102102

103103
steps:
104104
- uses: actions/checkout@v4
@@ -130,7 +130,7 @@ jobs:
130130
strategy:
131131
fail-fast: false
132132
matrix:
133-
node-version: [16.x, 18.x, 20.x, 22.x]
133+
node-version: [18.x, 20.x, 22.x]
134134

135135
steps:
136136
- uses: actions/checkout@v4
@@ -166,7 +166,7 @@ jobs:
166166
strategy:
167167
fail-fast: false
168168
matrix:
169-
node-version: [16.x, 18.x, 20.x, 22.x]
169+
node-version: [18.x, 20.x, 22.x]
170170

171171
steps:
172172
- uses: actions/checkout@v4
@@ -217,7 +217,7 @@ jobs:
217217
strategy:
218218
fail-fast: false
219219
matrix:
220-
node-version: [16.x, 18.x, 20.x, 22.x]
220+
node-version: [18.x, 20.x, 22.x]
221221

222222
steps:
223223
- uses: actions/checkout@v4
@@ -240,7 +240,7 @@ jobs:
240240

241241
strategy:
242242
matrix:
243-
node-version: [16.x, 18.x, 20.x, 22.x]
243+
node-version: [18.x, 20.x, 22.x]
244244

245245
steps:
246246
- uses: actions/checkout@v4

.github/workflows/smoke-test-workflow.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [16.x, 18.x, 20.x, 22.x]
19+
node-version: [18.x, 20.x, 22.x]
2020

2121
steps:
2222
- uses: actions/checkout@v4

.github/workflows/versioned-coverage.yml

-38
This file was deleted.

.github/workflows/versioned-security-agent.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
strategy:
6464
fail-fast: false
6565
matrix:
66-
node-version: [16.x, 18.x, 20.x, 22.x]
66+
node-version: [18.x, 20.x, 22.x]
6767

6868
steps:
6969
- uses: actions/checkout@v4

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,37 @@ If you cannot control how your program is run, you can load the `newrelic` modul
6161
/* ... the rest of your program ... */
6262
```
6363

64+
## Next.js instrumentation
65+
**Note**: The minimum supported Next.js version is [12.0.9](https://github.com/vercel/next.js/releases/tag/v12.0.9). If you are using Next.js middleware the minimum supported version is [12.2.0](https://github.com/vercel/next.js/releases/tag/v12.2.0).
66+
67+
The New Relic Node.js agent provides instrumentation for Next.js The instrumentation provides telemetry for server-side rendering via [getServerSideProps](https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props), [middleware](https://nextjs.org/docs/middleware), and New Relic transaction naming for both page and server requests. It does not provide any instrumentation for actions occurring during build or in client-side code. If you want telemetry data on actions occurring on the client (browser), you can [inject the browser agent](./documentation/nextjs/faqs/browser-agent.md).
68+
69+
Here are documents for more in-depth explanations about [transaction naming](./documentation/nextjs/transactions.md), and [segments/spans](./documentation/nextjs/segments-and-spans.md).
70+
71+
72+
### Setup
73+
Typically you are running a Next.js app with the `next` cli and you must load the agent via `NODE_OPTIONS`:
74+
75+
```sh
76+
NODE_OPTIONS='-r newrelic' next start
77+
```
78+
79+
If you are having trouble getting the `newrelic` package to instrument Next.js, take a look at our [FAQs](./documentation/nextjs/faqs/README.md).
80+
81+
### Next.js example projects
82+
The following example applications show how to load the `newrelic` instrumentation, inject browser agent, and handle errors:
83+
84+
* [Pages Router example](https://github.com/newrelic/newrelic-node-examples/tree/58f760e828c45d90391bda3f66764d4420ba4990/nextjs-legacy)
85+
* [App Router example](https://github.com/newrelic/newrelic-node-examples/tree/58f760e828c45d90391bda3f66764d4420ba4990/nextjs-app-router)
86+
87+
### Custom Next.js servers
88+
89+
If you are using next as a [custom server](https://nextjs.org/docs/advanced-features/custom-server), you're probably not running your application with the `next` CLI. In that scenario we recommend running the Next.js instrumentation as follows.
90+
91+
```sh
92+
node -r newrelic your-program.js
93+
```
94+
6495
## ECMAScript Modules
6596

6697
If your application is written with `import` and `export` statements in javascript, you are using [ES Modules](https://nodejs.org/api/esm.html#modules-ecmascript-modules) and must bootstrap the agent in a different way.

0 commit comments

Comments
 (0)