@@ -35,9 +35,9 @@ To get started, you must install `@vercel/otel`:
...
@@ -35,9 +35,9 @@ To get started, you must install `@vercel/otel`:
npm install @vercel/otel
npm install @vercel/otel
```
```
Next, create a custom [`instrumentation.ts`](/docs/pages/building-your-application/optimizing/instrumentation) file in the root of the project:
Next, create a custom [`instrumentation.ts`](/docs/pages/building-your-application/optimizing/instrumentation) (or `.js`) file in the **root directory** of the project:
> **Note**: We have created a basic [with-opentelemetry](https://github.com/vercel/next.js/tree/canary/examples/with-opentelemetry) example that you can use.
> **Good to know**
>
> - The `instrumentation` file should be in the root of your project and not the `app` or `pages` directory.
> - If you use the [`pagesExtension` config option](/docs/pages/api-reference/next-config-js/pageExtensions) to add a suffix, you will also need to update the `instrumentation` filename to match.
> - We have created a basic [with-opentelemetry](https://github.com/vercel/next.js/tree/canary/examples/with-opentelemetry) example that you can use.
@@ -46,7 +53,7 @@ By doing this, you can colocate all of your side effects in one place in your co
...
@@ -46,7 +53,7 @@ By doing this, you can colocate all of your side effects in one place in your co
Wecall`register`inallenvironments,soit's necessary to conditionally import any code that doesn'tsupportboth`edge`and`nodejs`.Youcanusetheenvironmentvariable`NEXT_RUNTIME`togetthecurrentenvironment.Importinganenvironment-specificcodewouldlooklikethis:
Wecall`register`inallenvironments,soit's necessary to conditionally import any code that doesn'tsupportboth`edge`and`nodejs`.Youcanusetheenvironmentvariable`NEXT_RUNTIME`togetthecurrentenvironment.Importinganenvironment-specificcodewouldlooklikethis:
For example, if you reconfigure `.ts` page extensions to `.page.ts`, you would need to rename pages like `_app.page.ts`.
For example, if you reconfigure `.ts` page extensions to `.page.ts`, you would need to rename pages like `middleware.page.ts`, `instrumentation.page.ts`, `_app.page.ts`.
## Including non-page files in the `pages` directory
## Including non-page files in the `pages` directory