Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification about instrumentation for non-Next.js apps and on local development environment #130

Open
chicoxyzzy opened this issue Oct 17, 2024 · 1 comment

Comments

@chicoxyzzy
Copy link

chicoxyzzy commented Oct 17, 2024

Hello, I have a few questions about @vercel/otel usage with my own OT Collector.

I'm following the guide on https://vercel.com/docs/observability/otel-overview#quickstart-for-using-the-vercel-opentelemetry-collector

My app is an Astro app with @astrojs/vercel/serverless adapter (so it runs on Node.js runtime), which is deployed on Vercel.

I've have this code in my instrumentation.ts:

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


export function register() {
  registerOTel({
    serviceName: 'project-name',
    traceExporter: new OTLPHttpProtoTraceExporter({
      url: import.meta.env.OTLP_ENDPOINT,
    }),
  });
}

How can I test that instrumentation.ts is actually used and sends traces? Astro's dev mode doesn't know anything about instrumentation.ts file and it's not taken into account.
Is it possible to make it work on local development environment as well?

Do I need to activate tracing via the Vercel Dashboard or it's only necessary when I want to use Vercel's OT Collector?

@chicoxyzzy chicoxyzzy changed the title Clarification about custom URL configuration for OTLPHttpProtoTraceExporter in @vercel/otel for Vercel serverless and local environments Clarification about instrumentation on local development environment Oct 17, 2024
@KiithNabaal
Copy link

KiithNabaal commented Oct 17, 2024

I was trying to figure out how to get this started as well, since it didn't seem like just implementing the instrumentation file was enough. I am not developing an Astro app, but I added the following to the next.config.mjs file:

experimental: { instrumentationHook: true, }

And it looked like this started the instrumentation when I re-ran the app, although in my case I got an error message when it was trying to load lol. I was looking at their example app here: https://github.com/vercel/next.js/tree/canary/examples/with-opentelemetry

@chicoxyzzy chicoxyzzy changed the title Clarification about instrumentation on local development environment Clarification about instrumentation for non-Next.js apps and on local development environment Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants