vercel / otel

OTEL tracing for Vercel
https://vercel.com/docs/observability/otel-overview
27 stars 7 forks source link

Not building when when using yarn... #106

Open patmancodes opened 2 months ago

patmancodes commented 2 months ago

Is it possible to use this package with a self hosted instance of a nextjs 14.2 'pages' directory app? (we've e custom collector used by other Backend apps within our org)

I've followed the instructions outlined here -https://vercel.com/docs/observability/otel-overview but hitting some dependency/build issues.

I've added the @vercel/otel package using yarn , added instrument.ts , set the instrumentationHook flag in next config.

First issue - Failed to compile with the following error

./node_modules/@vercel/otel/dist/edge/index.js:4362:1
Module not found: Can't resolve '@opentelemetry/api-logs'

So I tried adding that missing package manually to just try getting it working

Second issue I'm now getting this build issue which is very strange. The imported types are navigable in vscode..

./instrumentation.ts
Attempted import error: 'registerOTel' is not exported from '@vercel/otel' (imported as 'registerOTel').

Any help appreciated!

patmancodes commented 2 months ago

I obviously missed that yarn doesn't 'auto add' peer dependencies, this has to be done manually..

RichardsonBrandon commented 1 month ago

Similar issue except my error is

error - ../../node_modules/@vercel/otel/dist/edge/index.js:4:43681
Module not found: Can't resolve 'async_hooks'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./instrumentation.ts
TypeError: An error occurred while loading instrumentation hook: require(...).register is not a function

Next version: 13.2 Node version: 18.20.4 vercel/otel: 1.8.4