Skip to content

Commit 96e2a3e

Browse files
authored
docs: Add Next.js v14 configuration requirements to LangSmith docs (#5974)
## Background To get LangSmith tracing to work correctly in Next.js v14, it seems that enabling the instrumentation hook via next.config.js is necessary. This might be a helpful addition to the docs. ## Summary Added a section to the LangSmith observability documentation explaining the required `next.config.js` configuration for Next.js v14 users, including: - Code example showing how to enable the instrumentation hook - Link to the official Next.js documentation for further reference
1 parent 8d7f355 commit 96e2a3e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

content/providers/05-observability/langsmith.mdx

+12
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ export function register() {
6969

7070
You can learn more how to [setup OpenTelemetry instrumentation within your Next.js app here](https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation).
7171

72+
If you are using Next.js version 14, you need to add the following configuration to your `next.config.js`:
73+
74+
```js
75+
module.exports = {
76+
experimental: {
77+
instrumentationHook: true,
78+
},
79+
};
80+
```
81+
82+
For more information, see the [Next.js documentation on instrumentationHook](https://nextjs.org/docs/14/pages/api-reference/next-config-js/instrumentationHook).
83+
7284
Afterwards, add the `experimental_telemetry` argument to your AI SDK calls that you want to trace. For convenience, we've included the `AISDKExporter.getSettings()` method which appends additional metadata for LangSmith.
7385

7486
```ts highlight="8"

0 commit comments

Comments
 (0)