Skip to content

Automatic instrumentation for Next.js integrated server (instrumentation-http server request metrics) #3209

@mhoran

Description

@mhoran

Is your feature request related to a problem? Please describe

@opentelemetry/instrumentation-http automatically instruments built-in Node http server requests. However, the Next.js integrated server does not seem to use the built-in http server. As such, http.server.request.duration metrics are not collected.

Describe the solution you'd like to see

It is possible to use a custom server that does use the built-in Node http server. When this server is used, metrics will be collected. See https://github.com/mhoran/next-instrumentation.

Spans are created for the Next.js integrated server, but metrics are not collected. I would like a way to auto-instrument the Next.js integrated server similarly to the built-in Node http server. This will reduce configuration and improve the out-of-the-box Next.js experience.

Describe alternatives you've considered

Using a custom server as shown in https://github.com/mhoran/next-instrumentation works. However, this is not ideal, since there are downsides to using a custom server with Next.js.

Additional context

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions