# Next.js and opentelemetry

**URL:** <https://community.dynatrace.com/t/next-js-and-opentelemetry/46252>\
**Category:** OpenTelemetry\
**Tags:** activegate, opentelemetry\
**Created:** [June 21, 2024, 11:09am UTC](https://community.dynatrace.com/t/next-js-and-opentelemetry/46252 "2024-06-21T11:09:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nm-seme](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@nm-seme](https://community.dynatrace.com/u/nm-seme)\
**Post date:** [June 21, 2024, 11:09am UTC](https://community.dynatrace.com/t/next-js-and-opentelemetry/46252/1 "2024-06-21T11:09:29Z")

</div>

We have a Next.js app running in GCP Cloud Run, we can to use open telemetry with the app to export OTel data to Oneagent or Activegate. It looks like this is possible but there seems to gaps in the documentation.

[“Next.js supports OpenTelemetry instrumentation out of the box”](https://nextjs.org/docs/pages/building-your-application/optimizing/open-telemetry)&nbsp;which means we don’t need to do anything expect enable this with the next.js app (I noted that is it experimental on their site)

So once the app is setup to we can then use either the SaaS or Local Env ActiveGate paths [[LINK]](https://docs.dynatrace.com/docs/extend-dynatrace/opentelemetry/getting-started/otlp-export#export-to-activegate)&nbsp;to export using OTLP.

Flow should this.&nbsp; Next.js → ActiveGate → Dynatrace SaaS

From what I have read this will give us the traces and spans from the next.js app so that dynatrace can correlate these with the traces from other backend systems. Is there anything that I am missing in this setup or are there any limitations that anyone can point out?

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [June 24, 2024, 10:35am UTC](https://community.dynatrace.com/t/next-js-and-opentelemetry/46252/2 "2024-06-24T10:35:15Z")

</div>

Here you have further information regarding the export to an AG endpoint&nbsp;[Dynatrace OTLP API endpoints — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/otel-getstarted-otlpexport#export-to-activegate)

And for your use case this example should adhere the most&nbsp;[Instrument your JavaScript application on Node.js with OpenTelemetry — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/otel-wt-nodejs)

What you need to take care of is the context extraction and propagation to have the correlation between services.

---

<div class="post-metadata">

**Author:** ![nm-seme](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@nm-seme](https://community.dynatrace.com/u/nm-seme)\
**Post date:** [June 28, 2024, 2:49pm UTC](https://community.dynatrace.com/t/next-js-and-opentelemetry/46252/3 "2024-06-28T14:49:24Z")

</div>

Thanks for the information, are you saying that to monitor Next.js we can use the Node.js docuentation?

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [June 28, 2024, 3:47pm UTC](https://community.dynatrace.com/t/next-js-and-opentelemetry/46252/4 "2024-06-28T15:47:03Z")

</div>

It is the next best thing I would suggest that already exists as official documentation.

But feel free to go through some of the other samples if you feel more comfortable in another language&nbsp;[Instrument your application — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/otel-walkthroughs)
