That's why we prepared a package `@vercel/otel` that helps you get started quickly.
That's why we prepared a package `@vercel/otel` that helps you get started quickly.
It's not extensible and you should configure OpenTelemetry manually if you need to customize your setup.
### Using `@vercel/otel`
### Using `@vercel/otel`
...
@@ -53,7 +49,7 @@ Next, create a custom [`instrumentation.ts`](/docs/pages/building-your-applicati
...
@@ -53,7 +49,7 @@ Next, create a custom [`instrumentation.ts`](/docs/pages/building-your-applicati
import { registerOTel } from '@vercel/otel'
import { registerOTel } from '@vercel/otel'
export function register() {
export function register() {
registerOTel('next-app')
registerOTel({ serviceName: 'next-app' })
}
}
```
```
...
@@ -61,10 +57,12 @@ export function register() {
...
@@ -61,10 +57,12 @@ export function register() {
import { registerOTel } from '@vercel/otel'
import { registerOTel } from '@vercel/otel'
export function register() {
export function register() {
registerOTel('next-app')
registerOTel({ serviceName: 'next-app' })
}
}
```
```
See the [`@vercel/otel` documentation](https://www.npmjs.com/package/@vercel/otel) for additional configuration options.
<AppOnly>
<AppOnly>
> **Good to know**
> **Good to know**
...
@@ -87,7 +85,7 @@ export function register() {
...
@@ -87,7 +85,7 @@ export function register() {
### Manual OpenTelemetry configuration
### Manual OpenTelemetry configuration
If our wrapper `@vercel/otel` doesn'tsuityourneeds,youcanconfigureOpenTelemetrymanually.
The `@vercel/otel` package provides many configuration options and should serve most of common use cases. But if it doesn'tsuityourneeds,youcanconfigureOpenTelemetrymanually.
FirstlyyouneedtoinstallOpenTelemetrypackages:
FirstlyyouneedtoinstallOpenTelemetrypackages:
...
@@ -146,8 +144,7 @@ const sdk = new NodeSDK({
...
@@ -146,8 +144,7 @@ const sdk = new NodeSDK({
sdk.start()
sdk.start()
```
```
Doingthisisequivalenttousing`@vercel/otel`,butit's possible to modify and extend.
Doingthisisequivalenttousing`@vercel/otel`,butit's possible to modify and extend some features that are not exposed by the `@vercel/otel`.
For example, you could use `@opentelemetry/exporter-trace-otlp-grpc` instead of `@opentelemetry/exporter-trace-otlp-http` or you can specify more resource attributes.
## Testing your instrumentation
## Testing your instrumentation
...
@@ -183,8 +180,7 @@ Once you have your collector up and running, you can deploy your Next.js app to
...
@@ -183,8 +180,7 @@ Once you have your collector up and running, you can deploy your Next.js app to
### Custom Exporters
### Custom Exporters
We recommend using OpenTelemetry Collector.
OpenTelemetry Collector is not necessary. You can use a custom OpenTelemetry exporter with [`@vercel/otel`](#using-vercelotel) or [manual OpenTelemetry configuration](/docs/pages/building-your-application/optimizing/open-telemetry#manual-opentelemetry-configuration).
If that is not possible on your platform, you can use a custom OpenTelemetry exporter with [manual OpenTelemetry configuration](/docs/pages/building-your-application/optimizing/open-telemetry#manual-opentelemetry-configuration)