vercel / otel

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

Attributes set using attributesFromHeaders not showing up on trace #121

Open cbodin opened 2 months ago

cbodin commented 2 months ago

The attributesFromHeaders option does not seem to be working correctly, or it needs some more documentation for how to configure it.

I've configured everything according to the Using @vercel/otel page, and configured the OpenTelemetry dev environment.

My instrumentation.ts file:

export async function register() {
  registerOTel({
    serviceName: "sample-service-name",
    attributes: {
      "app.environment": process.env.NEXT_PUBLIC_ENVIRONMENT,
      "app.test": "hello",
    },
    attributesFromHeaders: {
      "app.referer": "referer",
      "app.host": "host",
      "app.accept": "accept",
      "app.method": "method",
      "http.referer": "referer",
      "http.host": "host",
      "http.accept": "accept",
      "http.method": "method",
    },
  });
}

Looking at the collected trace in Zipkin, all the header attributes are missing:

Tag Value
app.environment local
app.test hello
http.method GET
http.route /[locale]/[[...slug]]
http.status_code 200
http.target /sample-page
next.route /[locale]/[[...slug]]
next.rsc false
next.span_name GET /[locale]/[[...slug]]
next.span_type BaseServer.handleRequest
node.env development
operation.name web.request
otel.library.name next.js
otel.library.version 0.0.1
resource.name GET /[locale]/[[...slug]]
telemetry.sdk.language nodejs
telemetry.sdk.name opentelemetry
telemetry.sdk.version 1.19.0
vercel.runtime nodejs

Package Version
next 14.2.3
@vercel/otel 1.10.0
@opentelemetry/api 1.9.0

Possible duplicate of https://github.com/vercel/otel/issues/109