Skip to content

instrumentation.{js|ts} script debugging #134

@chicoxyzzy

Description

@chicoxyzzy

Is there any way to debug the instrumentation script?

I'm trying to add logging in this way:

import { registerOTel, OTLPHttpProtoTraceExporter } from "@vercel/otel";
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-proto';
import { SimpleLogRecordProcessor, LoggerProvider } from '@opentelemetry/sdk-logs';

export function register() {
  const loggerProvider = new LoggerProvider();

  const logExporter = new OTLPLogExporter({
    url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
  });
  const logRecordProcessor = new SimpleLogRecordProcessor(logExporter);
  loggerProvider.addLogRecordProcessor(logRecordProcessor);

  registerOTel({
    serviceName: "service-name",
    traceExporter: new OTLPHttpProtoTraceExporter({
      url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
    }),
    logRecordProcessor,
  });
}

The application deployment works, but when I open a preview, the application looks broken and for some reason have CSS for some reason. When I comment out logging, the app works again. There's no logs for instrumentation.ts anywhere in the Vercel dashboard or in terminal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions