Code Monkey home page Code Monkey logo

otel's Issues

which runtime

it is works on browser or nodejs/edge server?
whether it can as a replacement for sentry?

CommonJS import error

I'm trying to use the package in my project, but I'm getting an import error deep inside the @vercel/otel package, so there's nothing I can do about it.
I created the official nextjs example from the docs to ensure this wasn't a problem specific to my project.

$ npx create-next-app --example with-opentelemetry with-opentelemetry-app
$ npm run dev

> dev
> next

- ready started server on 0.0.0.0:3000, url: http://localhost:3000
- warn You have enabled experimental feature (instrumentationHook) in next.config.js.
- warn Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.

- event compiled client and server successfully in 129 ms (20 modules)
- wait compiling...
- wait compiling /instrumentation (client and server)...
- event compiled client and server successfully in 164 ms (62 modules)
file:///tmp/bla/with-opentelemetry-app/node_modules/@vercel/otel/dist/index.node.js:3
import { Resource } from "@opentelemetry/resources";
         ^^^^^^^^
SyntaxError: Named export 'Resource' not found. The requested module '@opentelemetry/resources' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@opentelemetry/resources';
const { Resource } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5) {
  type: 'SyntaxError'
}

NodeJS version: 18.16.0
npm version: 9.5.1

Update

Apparently, the problem was that I followed these official instructions and there is missing the need to install @opentelemetry/api, which causes the error above.
Following other recipe solved the issue.

Error with next build: Legacy octal escape is not permitted in strict mode

Description

When trying to use this package with latest Next.js, I get a build failure using next build

Steps to reproduce

  1. pnpm create next-app my-app
  2. Follow the instructions here: https://vercel.com/docs/concepts/observability/otel-overview/quickstart#-install-an-otel-integration-to-visualize-traces
  3. pnpm run build

Expected:

Should build

Actual:

Throws Legacy octal escape is not permitted in strict mode.

./node_modules/.pnpm/[email protected]/node_modules/ansi-color/lib/ansi-color.js
Error: 
  × Legacy octal escape is not permitted in strict mode
    ╭─[/Users/tom.sherman/code/next-app-dir-tracing/node_modules/.pnpm/[email protected]/node_modules/ansi-color/lib/ansi-color.js:32:1]
 32 │   var color_attrs = color.split("+");
 33 │   var ansi_str = "";
 34 │   for(var i=0, attr; attr = color_attrs[i]; i++) {
 35 │     ansi_str += "\033[" + ANSI_CODES[attr] + "m";
    ·                  ──
 36 │   }
 37 │   ansi_str += str + "\033[" + ANSI_CODES["off"] + "m";
 38 │   return ansi_str;
    ╰────

  × Legacy octal escape is not permitted in strict mode
    ╭─[/Users/tom.sherman/code/next-app-dir-tracing/node_modules/.pnpm/[email protected]/node_modules/ansi-color/lib/ansi-color.js:34:1]
 34 │   for(var i=0, attr; attr = color_attrs[i]; i++) {
 35 │     ansi_str += "\033[" + ANSI_CODES[attr] + "m";
 36 │   }
 37 │   ansi_str += str + "\033[" + ANSI_CODES["off"] + "m";
    ·                      ──
 38 │   return ansi_str;
 39 │ };
    ╰────

Caused by:
    Syntax Error

Import trace for requested module:
./node_modules/.pnpm/[email protected]/node_modules/ansi-color/lib/ansi-color.js
./node_modules/.pnpm/[email protected]/node_modules/bufrw/annotated_buffer.js
./node_modules/.pnpm/[email protected]/node_modules/bufrw/interface.js
./node_modules/.pnpm/[email protected]/node_modules/bufrw/index.js
./node_modules/.pnpm/[email protected]/node_modules/thriftrw/index.js
./node_modules/.pnpm/[email protected]/node_modules/jaeger-client/dist/src/reporters/udp_sender.js
./node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/exporter-jaeger/build/src/types.js
./node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/exporter-jaeger/build/src/jaeger.js
./node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/exporter-jaeger/build/src/index.js
./node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/sdk-node/build/src/TracerProviderWithEnvExporter.js
./node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/sdk-node/build/src/sdk.js
./node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/sdk-node/build/src/index.js
./node_modules/.pnpm/@[email protected]/node_modules/@vercel/otel/dist/index.node.js
./src/OTEL-initializer.ts.ts
./src/fetcher.ts
./src/app/page.tsx

Reproduction repo

https://github.com/tom-sherman/next-app-dir-tracing

Additional info

vercel/otel version: 0.3.0
@opentelemetry/api: 1.4.1

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.13.0
      npm: 8.13.2
      Yarn: 1.22.19
      pnpm: 8.2.0
    Relevant packages:
      next: 13.4.4
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.0.4

jaeger.thrift no such file or directory

I'm trying to get this set up with a NextJS app, however when I try to run the app I get the following error:

Error: An error occurred while loading instrumentation hook: ENOENT: no such file or directory, open '.next/server/jaeger-idl/thrift/jaeger.thrift'

I checked in the server folder and it is indeed not there. Did I miss a setup step?

Ignore list for specific routes

Is there a way to add an ignore list to the configuration file? I'd like to not record spans for /liveness . This is my instrumentation.ts file:

import { OTLPHttpJsonTraceExporter, registerOTel } from '@vercel/otel';

export async function register() {
  registerOTel({
    serviceName: 'app-name,
    instrumentationConfig: {
      fetch: {
        propagateContextUrls: ['*'],
      },
    },
    traceExporter: new OTLPHttpJsonTraceExporter({ url: 'https//...' }),
  });
}

Not building when when using yarn...

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 i_nstrumentationHook_ 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!

Registering a `LogRecordProcessor` throws an exception

Registering a LogRecordProcessor throws an exception reading:

An error occurred while loading instrumentation hook: Cannot read properties of undefined (reading 'attributeCountLimit')

This was possibly introduced in open-telemetry/opentelemetry-js#4564. Upgrading @opentelemetry/sdk-logs seems to fix the issue but only if you do not pass anything to logRecordProcessor and instead create your own logRecordProcessor and pass a resource and empty value for logRecordLimits.

This only happens on the edge runtime, at runtime (not build), when there is a middleware.ts file (NextJS), and using SimpleLogRecordProcessor,

Updating the range for peer dependencies in #89 seems to have solved the warnings from package managers during installation but not actual logic changes.

Not able to install due to broken dependencies

I'm having an issue trying to install @versel/otel both with npm install @versel/otel or inside the pipeline with npm ci.

here is an example of the error:

npm ERR! Found: @opentelemetry/[email protected]
npm ERR! node_modules/@opentelemetry/api-logs
npm ERR!   @opentelemetry/api-logs@"^0.4[9](https://github.com/*************/actions/runs/8784239706/job/24102065468?pr=182#step:5:10).1" from @azure/[email protected]
npm ERR!   node_modules/@azure/monitor-opentelemetry
npm ERR!     @azure/monitor-opentelemetry@"^1.3.0" from the root project
npm ERR!   @opentelemetry/api-logs@"0.49.1" from @opentelemetry/[email protected]
npm ERR!   node_modules/@opentelemetry/instrumentation
npm ERR!     @opentelemetry/instrumentation@"^0.49.1" from @azure/[email protected]
npm ERR!     node_modules/@azure/monitor-opentelemetry
npm ERR!       @azure/monitor-opentelemetry@"^1.3.0" from the root project
npm ERR!     @opentelemetry/instrumentation@"^0.49.1" from @opentelemetry/[email protected]
npm ERR!     node_modules/@opentelemetry/instrumentation-bunyan
npm ERR!       @opentelemetry/instrumentation-bunyan@"^0.36.0" from @azure/[email protected]
npm ERR!       node_modules/@azure/monitor-opentelemetry
npm ERR!         @azure/monitor-opentelemetry@"^1.3.0" from the root project
npm ERR!     7 more (@opentelemetry/instrumentation-http, ...)
npm ERR!   4 more (@opentelemetry/instrumentation-bunyan, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! @vercel/otel@"latest" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @opentelemetry/[email protected]
npm ERR! node_modules/@opentelemetry/api-logs
npm ERR!   peer @opentelemetry/api-logs@"^0.46.0" from @vercel/[email protected]
npm ERR!   node_modules/@vercel/otel
npm ERR!     @vercel/otel@"latest" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

react and next version:

    "next": "13.4.19",
    "next-i18next": "^15.2.0",
    "pdf-parse": "^1.1.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",

Inside the CI pipeline it run on node as 18.17
locally on node 21

Using OTel semantic conventions for certain resource attributes

Hey folks,

would you be open to leveraging OpenTelemetry's semantic conventions for some of @vercel/otel's default resource attributes? That would make interop with observability solutions and visualizations clearer, i.e., Vercel data could be surfaced more nicely.

These attribute keys specifically could be replaced with their standardized counterparts:

I also see room to add the cloud.provider=vercel resource attribute (OTel specification).

Why I am bringing this up: At Dash0 we are surfacing specific resources attributes because they carry additional meaning to users. By surfacing these we can help users navigate/provide context. If @vercel/otel also used standard OTel attributes, this would just work OOTB. Sample screenshots showing how certain standardized resource attributes are leveraged to provide context:

image

Not recording fetch

It appears that fetch may not be instrumented. The docs appear to say it should work out of the box but a few spot checks doing fetch calls did not see any of them being reported. Happy to investigate in code if someone could point be in the right direction for where it’s implemented

Error: An error occurred while loading instrumentation hook: Cannot find module 'os'

⚠ ./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

Import trace for requested module:
./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js
Error: An error occurred while loading instrumentation hook: Cannot find module 'os'
    at webpackEmptyContext (/Users/aonsx/WebstormProjects/lobe-chat/.next/server/instrumentation.js:22:10)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:12687)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:832)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:29503)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:832)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:29991)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:832)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:30305)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:832)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:43728)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:832)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:60086)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:832)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:21:20565)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:20:832)
    at eval (webpack-internal:///(instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js:33:45327)
    at (instrument)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq/node_modules/@vercel/otel/dist/node/index.js (/Users/aonsx/WebstormProjects/lobe-chat/.next/server/vendor-chunks/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+ins_afxcmrvzguz46bycbb3njvxqfq.js:20:1)
    at __webpack_require__ (/Users/aonsx/WebstormProjects/lobe-chat/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///(instrument)/./src/instrumentation.ts:5:70)
    at (instrument)/./src/instrumentation.ts (/Users/aonsx/WebstormProjects/lobe-chat/.next/server/instrumentation.js:62:1)
    at __webpack_require__ (/Users/aonsx/WebstormProjects/lobe-chat/.next/server/webpack-runtime.js:33:42)
    at __webpack_exec__ (/Users/aonsx/WebstormProjects/lobe-chat/.next/server/instrumentation.js:72:39)
    at /Users/aonsx/WebstormProjects/lobe-chat/.next/server/instrumentation.js:73:287
    at __webpack_require__.X (/Users/aonsx/WebstormProjects/lobe-chat/.next/server/webpack-runtime.js:116:21)
    at /Users/aonsx/WebstormProjects/lobe-chat/.next/server/instrumentation.js:73:47
    at Object.<anonymous> (/Users/aonsx/WebstormProjects/lobe-chat/.next/server/instrumentation.js:76:3)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at mod.require (/Users/aonsx/WebstormProjects/lobe-chat/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/require-hook.js:65:28)
    at require (node:internal/modules/helpers:179:18)
    at DevServer.runInstrumentationHookIfAvailable (/Users/aonsx/WebstormProjects/lobe-chat/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/dev/next-dev-server.js:436:51)
    at async Span.traceAsyncFn (/Users/aonsx/WebstormProjects/lobe-chat/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/trace/trace.js:154:20)
    at async DevServer.prepareImpl (/Users/aonsx/WebstormProjects/lobe-chat/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/dev/next-dev-server.js:214:9)
    at async NextServer.prepare (/Users/aonsx/WebstormProjects/lobe-chat/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/next.js:161:13)
    at async initializeImpl (/Users/aonsx/WebstormProjects/lobe-chat/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/lib/render-server.js:98:5)
    at async initialize (/Users/aonsx/WebstormProjects/lobe-chat/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:423:22)
    at async Server.<anonymous> (/Users/aonsx/WebstormProjects/lobe-chat/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/lib/start-server.js:249:36) {
  code: 'MODULE_NOT_FOUND'
}

BatchExporter not working on nextjs/vercel/otel

Hi,

I made a small repo https://github.com/pksorensen/nextjs-repro-otel/tree/bugs/batchprocessor related to another issue and found additional issues that i am unsure where to report/solve.

vercel/next.js#67737

I found out that when using batchprocessor is used over simpleprocesor , then no spans are exported when it is on the edge runtime (was testing opentelemetry from Middleware ).

in instrumentation try to change from batch to simple and it works as expected (you see spans in console) and with batch you dont.

Incorrect Peer Dependencies when Installing

There appears to be dependency issues with the project at this point.

Steps to Reproduce

  1. Install a blank project with npx create-next-app and accept all the defaults.
  2. Remove the npm lock file and run yarn install
  3. Run yarn add @vercel/otel

Expected

The package installs with no warnings

Actual

I get several error messages for peer dependencies:

*[main][~/code/learning/otel-sandbox]$ yarn add @vercel/otel
yarn add v1.22.21
[1/4] 🔍  Resolving packages...
⠁ (node:26982) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative sinstead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "@vercel/otel > @opentelemetry/exporter-trace-otlp-grpc > @opentelemetry/[email protected]" has incorrect peer dependency "@opentelemetry/api@>=1.0.0 <1.5.0".
warning "@vercel/otel > @opentelemetry/[email protected]" has incorrect peer dependency "@opentelemetry/api@>=1.3.0 <1.5.0".
warning "@vercel/otel > @opentelemetry/sdk-node > @opentelemetry/[email protected]" has incorrect peer dependency "@opentelemetry/api@>=1.0.0 <1.5.0".
warning "@vercel/otel > @opentelemetry/exporter-trace-otlp-grpc > @opentelemetry/[email protected]" has incorrect peer dependency "@opentelemetry/api@>=1.0.0 <1.5.0".
warning "@vercel/otel > @opentelemetry/sdk-node > @opentelemetry/sdk-trace-node > @opentelemetry/[email protected]" has incorrect peer dependency "@opentelemetry/api@>=1.0.0 <1.5.0".
warning "@vercel/otel > @opentelemetry/exporter-trace-otlp-grpc > @opentelemetry/[email protected]" has incorrect peer dependency "@opentelemetry/api@>=1.3.0 <1.5.0".
warning "@vercel/otel > @opentelemetry/sdk-node > @opentelemetry/sdk-trace-node > @opentelemetry/[email protected]" has incorrect peer dependency "@opentelemetry/api@>=1.0.0 <1.5.0".
warning "@vercel/otel > @opentelemetry/sdk-node > @opentelemetry/sdk-trace-node > @opentelemetry/[email protected]" has incorrect peer dependency "@opentelemetry/api@>=1.0.0 <1.5.0".
warning "@vercel/otel > @opentelemetry/exporter-trace-otlp-grpc > @opentelemetry/[email protected]" has incorrect peer dependency "@opentelemetry/api@>=1.0.0 <1.5.0".
warning "@vercel/otel > @opentelemetry/sdk-node > @opentelemetry/[email protected]" has incorrect peer dependency "@opentelemetry/api@>=1.3.0 <1.5.0".
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
success Saved 49 new dependencies.
info Direct dependencies
└─ @vercel/[email protected]
info All dependencies
├─ @grpc/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @opentelemetry/[email protected]
├─ @protobufjs/[email protected]
├─ @protobufjs/[email protected]
├─ @protobufjs/[email protected]
├─ @protobufjs/[email protected]
├─ @protobufjs/[email protected]
├─ @protobufjs/[email protected]
├─ @protobufjs/[email protected]
├─ @protobufjs/[email protected]
├─ @protobufjs/[email protected]
├─ @vercel/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
✨  Done in 5.44s.
*

OTel support in the edge runtime

Hey people, I am the author of the new OTel library for Cloudflare Workers, which can now be done properly now that they have implemented AsyncLocalStorage.

Would you want to collaborate on making that work for the Vercel runtime? I would be happy to split up my package into core OTel and the Cloudflare Workers specific auto-instrumentation.

Issue with Handling Incoming traceparent Header (NEXT_OTEL_VERBOSE=1)

Hello, I have a question regarding the use of vercel/otel.

After setting the traceparent header in the browser and sending a request to Next.js,
I expect multiple spans to be created based on the same trace ID.
However, this is not happening as expected. Instead of using the trace ID from the traceparent header I set, a new trace ID generated by Next.js is being used.

Is there any additional configuration required to create spans based on the traceparent header sent from the browser?
Or is this functionality not supported by vercel/otel?

I am using the following:

node: v18.20.3

  • "@vercel/otel": "^1.9.1"
  • "next": "14.2.5"

next.config.mjs

const nextConfig = {
    experimental: {
        instrumentationHook: true
    }
};

export default nextConfig;

instrumentation.ts

import { registerOTel } from '@vercel/otel'
 
export function register() {
  registerOTel({ serviceName: 'next-app' })
}

.env.development

NEXT_OTEL_VERBOSE = 1
OTEL_EXPORTER_OTLP_ENDPOINT = https://<CUSTOM_DOMAIN>

Header

{ "traceparent": "00-6d2eac29c9283ece795b4fbaa2d57225-bad4e819c34d2cdb-01" }
스크린샷 2024-07-22 오전 12 38 07

Result
All requests were successfully created with random Trace IDs.
However, the Trace IDs were not the ones from the traceparent header as I expected.

스크린샷 2024-07-22 오전 12 50 20 스크린샷 2024-07-22 오전 12 39 51

Package overrides fetch polyfill on edge worker with broken version

There are two bugs here which make the package impossible to use:

  • Invoking registerOTel overwrites the current fetch implementation with the polyfill from otel
  • The fetch implementation is broken when using FormData, the formdata-undici in the headers does not match the body that is POST'd.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.