elastic / elastic/elastic-otel-node

edot doc: add Next.js example

Open
#607 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12
Forks
22
Avg merge
16h 54m
Merged PRs (30d)
5

Description

We should have examples/nextjs and/or Next.js doc section in the EDOT Node.js docs.
Jessica has an example we can use or crib from.
IIUC, the core of it is using Next.js automatic loading of `instrumentation.{ts,js}` (https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation) to start the SDK. Something roughly like:

`instrumentation.ts` or `src/instrumentation.ts` (or .js):

```js
export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('@elastic/opentelemetry-node');
}
}
```

Compare to similar usage of Vercel's own `@vercel/otel` described at: https://nextjs.org/docs/app/building-your-application/optimizing/open-telemetry
I'm curious whether the instrumentation compares favourably. E.g. does the Next.js by default send spans with route info to any registered global TracerProvider? Etc.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.